langtools/test/tools/javac/classreader/FileSystemClosedTest.java
changeset 43277 edf2836a33f7
parent 43268 12436ebea906
equal deleted inserted replaced
43268:12436ebea906 43277:edf2836a33f7
    66         tb.writeJavaFiles(src, "class C { p1.C1 c1; }");
    66         tb.writeJavaFiles(src, "class C { p1.C1 c1; }");
    67 
    67 
    68         JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
    68         JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
    69         PrintWriter out = new PrintWriter(System.err, true);
    69         PrintWriter out = new PrintWriter(System.err, true);
    70         StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
    70         StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
    71         List<String> options = Arrays.asList("-classpath", jar.toString());
    71         List<String> options = Arrays.asList("-classpath", jar.toString(), "-proc:none");
    72         Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(src.resolve("C.java"));
    72         Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(src.resolve("C.java"));
    73         com.sun.source.util.JavacTask task =
    73         com.sun.source.util.JavacTask task =
    74                 (com.sun.source.util.JavacTask) comp.getTask(out, fm, null, options, null, files);
    74                 (com.sun.source.util.JavacTask) comp.getTask(out, fm, null, options, null, files);
    75         task.parse();
    75         task.parse();
    76 
    76 
    90             System.err.println("closing file manager");
    90             System.err.println("closing file manager");
    91             fm.close();
    91             fm.close();
    92             TypeElement p2C2 = elems.getTypeElement("p2.C2");
    92             TypeElement p2C2 = elems.getTypeElement("p2.C2");
    93             System.err.println("p2: " + p2 + ";  p2C2: " + p2C2);
    93             System.err.println("p2: " + p2 + ";  p2C2: " + p2C2);
    94             if (p2C2 != null) {
    94             if (p2C2 != null) {
    95                 throw new Exception("p1.C1 found unexpectedly");
    95                 throw new Exception("p2.C2 found unexpectedly");
    96             }
    96             }
    97         } catch (ClosedFileSystemException e) {
    97         } catch (ClosedFileSystemException e) {
    98             throw new Exception("unexpected exception thrown", e);
    98             throw new Exception("unexpected exception thrown", e);
    99         }
    99         }
   100 
   100