test/tools/javac/6589361/T6589361.java

Mon, 16 Jun 2008 13:28:00 -0700

author
jjg
date
Mon, 16 Jun 2008 13:28:00 -0700
changeset 50
b9bcea8bbe24
parent 38
65a447c75d4b
child 392
d5e76d422509
permissions
-rw-r--r--

6714364: refactor javac File handling code into new javac.file package
Reviewed-by: mcimadamore

     1 /**
     2  * @test
     3  * @bug     6589361
     4  * @summary 6589361:Failing building ct.sym file as part of the control build
     5  */
     7 import com.sun.tools.javac.file.JavacFileManager;
     8 import com.sun.tools.javac.util.Context;
     9 import java.io.File;
    10 import javax.tools.FileObject;
    11 import javax.tools.JavaFileObject;
    12 import javax.tools.JavaFileObject.Kind;
    13 import javax.tools.StandardLocation;
    14 import java.util.Set;
    15 import java.util.HashSet;
    17 public class T6589361 {
    18     public static void main(String [] args) throws Exception {
    19         JavacFileManager fm = null;
    20         try {
    21             fm = new JavacFileManager(new Context(), false, null);
    22             Set<JavaFileObject.Kind> set = new HashSet<JavaFileObject.Kind>();
    23             set.add(JavaFileObject.Kind.CLASS);
    24             Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);
    25             for (JavaFileObject file : files) {
    27                 if (file.toString().contains("java" + File.separator + "lang" + File.separator + "Object.class")) {
    28                     String str = fm.inferBinaryName(StandardLocation.CLASS_PATH, file);
    29                     if (!str.equals("java.lang.Object")) {
    30                         throw new AssertionError("Error in JavacFileManager.inferBinaryName method!");
    31                     }
    32                     else {
    33                         return;
    34                     }
    35                 }
    36             }
    37         }
    38         finally {
    39             if (fm != null) {
    40                 fm.close();
    41             }
    42         }
    43         throw new AssertionError("Could not fing java/lang/Object.class while compiling");
    44     }
    46 }

mercurial