langtools/test/tools/javac/6589361/T6589361.java
author ysuenaga
Wed, 30 Mar 2016 21:05:13 +0900
changeset 37218 c7241bc368bf
parent 36526 3b41f1c69604
child 37633 d16d6d59446d
permissions -rw-r--r--
8151674: STW phases at Concurrent GC should count in PerfCounter Reviewed-by: jmasa, sla, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * @test
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug     6589361
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary 6589361:Failing building ct.sym file as part of the control build
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 3995
diff changeset
     5
 * @modules jdk.compiler/com.sun.tools.javac.file
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 3995
diff changeset
     6
 *          jdk.compiler/com.sun.tools.javac.util
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
731
1dd22bdb9ca5 6714364: refactor javac File handling code into new javac.file package
jjg
parents: 657
diff changeset
     9
import com.sun.tools.javac.file.JavacFileManager;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
import com.sun.tools.javac.util.Context;
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
import java.io.File;
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
import javax.tools.FileObject;
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
import javax.tools.JavaFileObject;
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
import javax.tools.JavaFileObject.Kind;
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
import javax.tools.StandardLocation;
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
import java.util.Set;
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
import java.util.HashSet;
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
public class T6589361 {
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
    public static void main(String [] args) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
        JavacFileManager fm = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
            fm = new JavacFileManager(new Context(), false, null);
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
            Set<JavaFileObject.Kind> set = new HashSet<JavaFileObject.Kind>();
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
            set.add(JavaFileObject.Kind.CLASS);
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
            Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
            for (JavaFileObject file : files) {
3774
33a6953bed15 6877229: more javac tests fail on Windows
jjg
parents: 731
diff changeset
    28
                // Note: Zip/Jar entry names use '/', not File.separator, but just to be sure,
33a6953bed15 6877229: more javac tests fail on Windows
jjg
parents: 731
diff changeset
    29
                // we normalize the filename as well.
3995
73af8b6fb8bc 6410637: Make decision on deprecated methods in DefaultFileManager and BaseFileObject.
jjg
parents: 3774
diff changeset
    30
                if (file.getName().replace(File.separatorChar, '/').contains("java/lang/Object.class")) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30730
diff changeset
    31
                    String str = fm.inferBinaryName(StandardLocation.PLATFORM_CLASS_PATH, file);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
                    if (!str.equals("java.lang.Object")) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30730
diff changeset
    33
                        System.err.println("file object: " + file);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30730
diff changeset
    34
                        System.err.println("      class: " + file.getClass());
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30730
diff changeset
    35
                        System.err.println("       name: " + file.getName());
3b41f1c69604 8142968: Module System implementation
alanb
parents: 30730
diff changeset
    36
                        System.err.println("binary name: " + str);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
                        throw new AssertionError("Error in JavacFileManager.inferBinaryName method!");
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
                    else {
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
                        return;
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
        finally {
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
            if (fm != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
                fm.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
        }
3774
33a6953bed15 6877229: more javac tests fail on Windows
jjg
parents: 731
diff changeset
    50
        throw new AssertionError("Could not find java/lang/Object.class while compiling");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
}