use of javax.tools.JavaFileObject in project buck by facebook.
the class ClassUsageTrackerTest method readingFileFromGetJavaFileObjectsStringsOverloadShouldNotBeTracked.
@Test
public void readingFileFromGetJavaFileObjectsStringsOverloadShouldNotBeTracked() throws IOException {
final Iterable<? extends JavaFileObject> javaFileObjects = fileManager.getJavaFileObjects(SINGLE_FILE_NAME);
for (JavaFileObject javaFileObject : javaFileObjects) {
javaFileObject.openInputStream();
}
assertNoFilesRead();
}
use of javax.tools.JavaFileObject in project buck by facebook.
the class JavaInMemoryFileManagerTest method testRecursiveListOperationReturnsNewlyCreatedFile.
@Test
public void testRecursiveListOperationReturnsNewlyCreatedFile() throws Exception {
JavaFileObject fileObject1 = inMemoryFileManager.getJavaFileForOutput(StandardLocation.CLASS_OUTPUT, "jvm.java.JavaFileParser", JavaFileObject.Kind.CLASS, null);
Iterator<JavaFileObject> recursiveIterable = inMemoryFileManager.list(StandardLocation.CLASS_OUTPUT, "jvm", Collections.singleton(JavaFileObject.Kind.CLASS), true).iterator();
assertEquals(fileObject1, recursiveIterable.next());
assertFalse(recursiveIterable.hasNext());
}
use of javax.tools.JavaFileObject in project buck by facebook.
the class JavaInMemoryFileManagerTest method testNonRecursiveListOperationDoesntReturnNewlyCreatedFileOnOtherDir.
@Test
public void testNonRecursiveListOperationDoesntReturnNewlyCreatedFileOnOtherDir() throws Exception {
JavaFileObject fileObject1 = inMemoryFileManager.getJavaFileForOutput(StandardLocation.CLASS_OUTPUT, "jvm.java.JavaFileParser", JavaFileObject.Kind.CLASS, null);
assertEquals("jvm/java/JavaFileParser.class", fileObject1.getName());
Iterator<JavaFileObject> recursiveIterable = inMemoryFileManager.list(StandardLocation.CLASS_OUTPUT, "jvm", Collections.singleton(JavaFileObject.Kind.CLASS), false).iterator();
assertFalse(recursiveIterable.hasNext());
}
use of javax.tools.JavaFileObject in project buck by facebook.
the class JavaInMemoryFileManagerTest method testNonRecursiveListOperationReturnsNewlyCreatedFile.
@Test
public void testNonRecursiveListOperationReturnsNewlyCreatedFile() throws Exception {
JavaFileObject fileObject1 = inMemoryFileManager.getJavaFileForOutput(StandardLocation.CLASS_OUTPUT, "jvm.java.JavaFileParser", JavaFileObject.Kind.CLASS, null);
Iterator<JavaFileObject> nonRecursiveIterable = inMemoryFileManager.list(StandardLocation.CLASS_OUTPUT, "jvm.java", Collections.singleton(JavaFileObject.Kind.CLASS), false).iterator();
assertEquals(fileObject1, nonRecursiveIterable.next());
assertFalse(nonRecursiveIterable.hasNext());
}
use of javax.tools.JavaFileObject in project buck by facebook.
the class JavaInMemoryFileManagerTest method setUp.
@Before
public void setUp() {
outputStream = new TestCustomZipOutputStream();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
inMemoryFileManager = new JavaInMemoryFileManager(ToolProvider.getSystemJavaCompiler().getStandardFileManager(diagnostics, null, null), Paths.get(URI.create("file:///tmp/test.jar!/")), outputStream, /*classesToBeRemovedFromJar */
ImmutableSet.of());
}
Aggregations