mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8062348: langtools tests should close file manager (group 1)
Reviewed-by: darcy
This commit is contained in:
parent
b587478f7c
commit
8bd23f1681
145 changed files with 2701 additions and 2452 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -39,17 +39,18 @@ import static javax.tools.JavaFileObject.Kind.CLASS;
|
|||
public class Sibling {
|
||||
public static void main(String... args) throws IOException {
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
||||
JavaFileObject sibling =
|
||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File("Test.java")))
|
||||
.iterator().next();
|
||||
JavaFileObject classFile = fm.getJavaFileForOutput(CLASS_OUTPUT,
|
||||
"foo.bar.baz.Test",
|
||||
CLASS,
|
||||
sibling);
|
||||
File file = new File("Test.class").getAbsoluteFile();
|
||||
if (!classFile.toUri().equals(file.toURI()))
|
||||
throw new AssertionError("Expected " + file.toURI() + ", got " +
|
||||
classFile.toUri());
|
||||
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||
JavaFileObject sibling =
|
||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File("Test.java")))
|
||||
.iterator().next();
|
||||
JavaFileObject classFile = fm.getJavaFileForOutput(CLASS_OUTPUT,
|
||||
"foo.bar.baz.Test",
|
||||
CLASS,
|
||||
sibling);
|
||||
File file = new File("Test.class").getAbsoluteFile();
|
||||
if (!classFile.toUri().equals(file.toURI()))
|
||||
throw new AssertionError("Expected " + file.toURI() + ", got " +
|
||||
classFile.toUri());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue