langtools/test/tools/javac/api/T6400207.java
changeset 27319 030080f03e4f
parent 5520 86e4b9a9da40
child 30730 d3ce7619db2c
equal deleted inserted replaced
27318:4660a5da7d90 27319:030080f03e4f
     1 /*
     1 /*
     2  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    59                 throw e;
    59                 throw e;
    60         }
    60         }
    61     }
    61     }
    62 
    62 
    63     public static void main(String... args) throws Exception {
    63     public static void main(String... args) throws Exception {
    64         JavaFileManager fm =
    64         try (JavaFileManager fm =
    65             ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
    65                 ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
    66         JavaFileManager.Location bogusLocation = locationFor("bogus");
    66             JavaFileManager.Location bogusLocation = locationFor("bogus");
    67         JavaFileManager.Location knownLocation = CLASS_PATH;
    67             JavaFileManager.Location knownLocation = CLASS_PATH;
    68         String packageName = "java.lang";
    68             String packageName = "java.lang";
    69         Set<JavaFileObject.Kind> kinds = EnumSet.of(CLASS);
    69             Set<JavaFileObject.Kind> kinds = EnumSet.of(CLASS);
    70 
    70 
    71         for (StandardLocation location : StandardLocation.values()) {
    71             for (StandardLocation location : StandardLocation.values()) {
    72             if (location != locationFor(location.getName()))
    72                 if (location != locationFor(location.getName()))
    73                 throw new AssertionError(location + " != locationFor(" +
    73                     throw new AssertionError(location + " != locationFor(" +
    74                                          location.getName() + ")");
    74                                              location.getName() + ")");
       
    75             }
       
    76 
       
    77             testList(fm, null, null, null);
       
    78             testList(fm, bogusLocation, packageName, kinds);
       
    79             testList(fm, knownLocation, packageName, kinds);
       
    80             testList(fm, null, packageName, kinds);
       
    81             testList(fm, knownLocation, null, kinds);
       
    82             testList(fm, knownLocation, packageName, null);
       
    83             testList(fm, bogusLocation, null, kinds);
       
    84             testList(fm, bogusLocation, packageName, null);
       
    85 
       
    86             System.err.println("Test PASSED.");
    75         }
    87         }
    76 
       
    77         testList(fm, null, null, null);
       
    78         testList(fm, bogusLocation, packageName, kinds);
       
    79         testList(fm, knownLocation, packageName, kinds);
       
    80         testList(fm, null, packageName, kinds);
       
    81         testList(fm, knownLocation, null, kinds);
       
    82         testList(fm, knownLocation, packageName, null);
       
    83         testList(fm, bogusLocation, null, kinds);
       
    84         testList(fm, bogusLocation, packageName, null);
       
    85 
       
    86         System.err.println("Test PASSED.");
       
    87     }
    88     }
    88 }
    89 }