本文整理汇总了Java中com.sun.tools.javac.file.JavacFileManager.getFileForInput方法的典型用法代码示例。如果您正苦于以下问题:Java JavacFileManager.getFileForInput方法的具体用法?Java JavacFileManager.getFileForInput怎么用?Java JavacFileManager.getFileForInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.file.JavacFileManager
的用法示例。
在下文中一共展示了JavacFileManager.getFileForInput方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.sun.tools.javac.file.JavacFileManager; //导入方法依赖的package包/类
void run() throws Exception {
RelativeFile TEST_ENTRY_NAME = new RelativeFile("java/lang/String.class");
File testJar = createJar("test.jar", "java.lang.*");
try (JarFile j = new JarFile(testJar)) {
JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
long jarEntryTime = je.getTime();
Context context = new Context();
JavacFileManager fm = new JavacFileManager(context, false, null);
fm.setLocation(StandardLocation.CLASS_PATH, Collections.singletonList(testJar));
FileObject fo =
fm.getFileForInput(StandardLocation.CLASS_PATH, "", TEST_ENTRY_NAME.getPath());
long jfoTime = fo.getLastModified();
check(je, jarEntryTime, fo, jfoTime);
if (errors > 0)
throw new Exception(errors + " occurred");
}
}
示例2: main
import com.sun.tools.javac.file.JavacFileManager; //导入方法依赖的package包/类
public static void main(String... args) throws Throwable {
JavacFileManager fm = new JavacFileManager(new Context(), false, null);
JavaFileObject f = fm.getFileForInput(testSrc + File.separatorChar + T6358168.class.getName() + ".java");
try {
// first, test case with no annotation processing
testNoAnnotationProcessing(fm, f);
// now, test case with annotation processing
testAnnotationProcessing(fm, f);
}
catch (Throwable t) {
AssertionError e = new AssertionError();
e.initCause(t);
throw e;
}
}
示例3: main
import com.sun.tools.javac.file.JavacFileManager; //导入方法依赖的package包/类
public static void main(String... args) throws Throwable {
String self = T6358024.class.getName();
String testSrc = System.getProperty("test.src");
fm = new JavacFileManager(new Context(), false, null);
JavaFileObject f = fm.getFileForInput(testSrc + File.separatorChar + self + ".java");
test(fm, f,
new Option[] { new Option("-d", ".")},
7);
test(fm, f,
new Option[] { new XOption("-XprintRounds"),
new Option("-processorpath", "."),
new Option("-processor", self) },
12);
}
示例4: main
import com.sun.tools.javac.file.JavacFileManager; //导入方法依赖的package包/类
public static void main(String... args) throws Throwable {
String self = T6358166.class.getName();
String testSrc = System.getProperty("test.src");
JavacFileManager fm = new JavacFileManager(new Context(), false, null);
JavaFileObject f = fm.getFileForInput(testSrc + File.separatorChar + self + ".java");
test(fm, f, "-verbose", "-d", ".");
test(fm, f, "-verbose", "-d", ".", "-XprintRounds", "-processorpath", ".", "-processor", self);
}