changeset 860:20fec1b88bc1

Merge
author lana
date Thu, 13 Jan 2011 15:05:09 -0800
parents 4b0560c72b52 15484cb7e5ae
children 438a8ad60f7a
files test/tools/javac/meth/InvokeDyn.java test/tools/javac/meth/InvokeDynTrans.java
diffstat 16 files changed, 523 insertions(+), 296 deletions(-) [+]
line wrap: on
line diff
--- a/make/Makefile	Thu Jan 06 20:10:44 2011 -0800
+++ b/make/Makefile	Thu Jan 13 15:05:09 2011 -0800
@@ -187,7 +187,7 @@
 clobber: clean
 
 # All ant targets of interest
-ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
+ANT_TARGETS = build clean sanity post-sanity diagnostics build-all-tools  # for now
 
 # Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1)
 $(OUTPUTDIR)/build/ant-diagnostics.log:
--- a/src/share/bin/launcher.sh-template	Thu Jan 06 20:10:44 2011 -0800
+++ b/src/share/bin/launcher.sh-template	Thu Jan 13 15:05:09 2011 -0800
@@ -26,6 +26,12 @@
 #
 
 mydir="`dirname $0`"
+case `uname -s` in
+    CYGWIN*)
+      mydir=`cygpath -m $mydir`
+      ;;
+esac
+
 mylib="`dirname $mydir`"/lib
 
 # By default, put the jar file and its dependencies on the bootclasspath.
--- a/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Jan 13 15:05:09 2011 -0800
@@ -266,82 +266,116 @@
         System.out.println(message);
     }
 
+
     /**
-     * Insert all files in subdirectory `subdirectory' of `directory' which end
-     * in one of the extensions in `extensions' into packageSym.
+     * Insert all files in subdirectory subdirectory of directory directory
+     * which match fileKinds into resultList
      */
     private void listDirectory(File directory,
                                RelativeDirectory subdirectory,
                                Set<JavaFileObject.Kind> fileKinds,
                                boolean recurse,
-                               ListBuffer<JavaFileObject> l) {
-        Archive archive = archives.get(directory);
+                               ListBuffer<JavaFileObject> resultList) {
+        File d = subdirectory.getFile(directory);
+        if (!caseMapCheck(d, subdirectory))
+            return;
 
-        boolean isFile = fsInfo.isFile(directory);
+        File[] files = d.listFiles();
+        if (files == null)
+            return;
 
-        if (archive != null || isFile) {
-            if (archive == null) {
-                try {
-                    archive = openArchive(directory);
-                } catch (IOException ex) {
-                    log.error("error.reading.file",
-                       directory, getMessage(ex));
-                    return;
+        if (sortFiles != null)
+            Arrays.sort(files, sortFiles);
+
+        for (File f: files) {
+            String fname = f.getName();
+            if (f.isDirectory()) {
+                if (recurse && SourceVersion.isIdentifier(fname)) {
+                    listDirectory(directory,
+                                  new RelativeDirectory(subdirectory, fname),
+                                  fileKinds,
+                                  recurse,
+                                  resultList);
                 }
-            }
-
-            List<String> files = archive.getFiles(subdirectory);
-            if (files != null) {
-                for (String file; !files.isEmpty(); files = files.tail) {
-                    file = files.head;
-                    if (isValidFile(file, fileKinds)) {
-                        l.append(archive.getFileObject(subdirectory, file));
-                    }
-                }
-            }
-            if (recurse) {
-                for (RelativeDirectory s: archive.getSubdirectories()) {
-                    if (subdirectory.contains(s)) {
-                        // Because the archive map is a flat list of directories,
-                        // the enclosing loop will pick up all child subdirectories.
-                        // Therefore, there is no need to recurse deeper.
-                        listDirectory(directory, s, fileKinds, false, l);
-                    }
-                }
-            }
-        } else {
-            File d = subdirectory.getFile(directory);
-            if (!caseMapCheck(d, subdirectory))
-                return;
-
-            File[] files = d.listFiles();
-            if (files == null)
-                return;
-
-            if (sortFiles != null)
-                Arrays.sort(files, sortFiles);
-
-            for (File f: files) {
-                String fname = f.getName();
-                if (f.isDirectory()) {
-                    if (recurse && SourceVersion.isIdentifier(fname)) {
-                        listDirectory(directory,
-                                      new RelativeDirectory(subdirectory, fname),
-                                      fileKinds,
-                                      recurse,
-                                      l);
-                    }
-                } else {
-                    if (isValidFile(fname, fileKinds)) {
-                        JavaFileObject fe =
-                            new RegularFileObject(this, fname, new File(d, fname));
-                        l.append(fe);
-                    }
+            } else {
+                if (isValidFile(fname, fileKinds)) {
+                    JavaFileObject fe =
+                        new RegularFileObject(this, fname, new File(d, fname));
+                    resultList.append(fe);
                 }
             }
         }
     }
 
+    /**
+     * Insert all files in subdirectory subdirectory of archive archive
+     * which match fileKinds into resultList
+     */
+    private void listArchive(Archive archive,
+                               RelativeDirectory subdirectory,
+                               Set<JavaFileObject.Kind> fileKinds,
+                               boolean recurse,
+                               ListBuffer<JavaFileObject> resultList) {
+        // Get the files directly in the subdir
+        List<String> files = archive.getFiles(subdirectory);
+        if (files != null) {
+            for (; !files.isEmpty(); files = files.tail) {
+                String file = files.head;
+                if (isValidFile(file, fileKinds)) {
+                    resultList.append(archive.getFileObject(subdirectory, file));
+                }
+            }
+        }
+        if (recurse) {
+            for (RelativeDirectory s: archive.getSubdirectories()) {
+                if (subdirectory.contains(s)) {
+                    // Because the archive map is a flat list of directories,
+                    // the enclosing loop will pick up all child subdirectories.
+                    // Therefore, there is no need to recurse deeper.
+                    listArchive(archive, s, fileKinds, false, resultList);
+                }
+            }
+        }
+    }
+
+    /**
+     * container is a directory, a zip file, or a non-existant path.
+     * Insert all files in subdirectory subdirectory of container which
+     * match fileKinds into resultList
+     */
+    private void listContainer(File container,
+                               RelativeDirectory subdirectory,
+                               Set<JavaFileObject.Kind> fileKinds,
+                               boolean recurse,
+                               ListBuffer<JavaFileObject> resultList) {
+        Archive archive = archives.get(container);
+        if (archive == null) {
+            // archives are not created for directories.
+            if  (fsInfo.isDirectory(container)) {
+                listDirectory(container,
+                              subdirectory,
+                              fileKinds,
+                              recurse,
+                              resultList);
+                return;
+            }
+
+            // Not a directory; either a file or non-existant, create the archive
+            try {
+                archive = openArchive(container);
+            } catch (IOException ex) {
+                log.error("error.reading.file",
+                          container, getMessage(ex));
+                return;
+            }
+        }
+        listArchive(archive,
+                    subdirectory,
+                    fileKinds,
+                    recurse,
+                    resultList);
+    }
+
     private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) {
         JavaFileObject.Kind kind = getKind(s);
         return fileKinds.contains(kind);
@@ -434,95 +468,92 @@
     private static final RelativeDirectory symbolFilePrefix
             = new RelativeDirectory("META-INF/sym/rt.jar/");
 
-    /** Open a new zip file directory.
+    /** Open a new zip file directory, and cache it.
      */
     protected Archive openArchive(File zipFileName) throws IOException {
-        Archive archive = archives.get(zipFileName);
-        if (archive == null) {
-            File origZipFileName = zipFileName;
-            if (!ignoreSymbolFile && paths.isBootClassPathRtJar(zipFileName)) {
-                File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
-                if (new File(file.getName()).equals(new File("jre")))
-                    file = file.getParentFile();
-                // file == ${jdk.home}
-                for (String name : symbolFileLocation)
-                    file = new File(file, name);
-                // file == ${jdk.home}/lib/ct.sym
-                if (file.exists())
-                    zipFileName = file;
+        File origZipFileName = zipFileName;
+        if (!ignoreSymbolFile && paths.isBootClassPathRtJar(zipFileName)) {
+            File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
+            if (new File(file.getName()).equals(new File("jre")))
+                file = file.getParentFile();
+            // file == ${jdk.home}
+            for (String name : symbolFileLocation)
+                file = new File(file, name);
+            // file == ${jdk.home}/lib/ct.sym
+            if (file.exists())
+                zipFileName = file;
+        }
+
+        Archive archive;
+        try {
+
+            ZipFile zdir = null;
+
+            boolean usePreindexedCache = false;
+            String preindexCacheLocation = null;
+
+            if (!useZipFileIndex) {
+                zdir = new ZipFile(zipFileName);
             }
+            else {
+                usePreindexedCache = options.isSet("usezipindex");
+                preindexCacheLocation = options.get("java.io.tmpdir");
+                String optCacheLoc = options.get("cachezipindexdir");
 
-            try {
+                if (optCacheLoc != null && optCacheLoc.length() != 0) {
+                    if (optCacheLoc.startsWith("\"")) {
+                        if (optCacheLoc.endsWith("\"")) {
+                            optCacheLoc = optCacheLoc.substring(1, optCacheLoc.length() - 1);
+                        }
+                        else {
+                            optCacheLoc = optCacheLoc.substring(1);
+                        }
+                    }
 
-                ZipFile zdir = null;
-
-                boolean usePreindexedCache = false;
-                String preindexCacheLocation = null;
-
-                if (!useZipFileIndex) {
-                    zdir = new ZipFile(zipFileName);
-                }
-                else {
-                    usePreindexedCache = options.isSet("usezipindex");
-                    preindexCacheLocation = options.get("java.io.tmpdir");
-                    String optCacheLoc = options.get("cachezipindexdir");
-
-                    if (optCacheLoc != null && optCacheLoc.length() != 0) {
-                        if (optCacheLoc.startsWith("\"")) {
-                            if (optCacheLoc.endsWith("\"")) {
-                                optCacheLoc = optCacheLoc.substring(1, optCacheLoc.length() - 1);
-                            }
-                           else {
-                                optCacheLoc = optCacheLoc.substring(1);
-                            }
-                        }
-
-                        File cacheDir = new File(optCacheLoc);
-                        if (cacheDir.exists() && cacheDir.canWrite()) {
-                            preindexCacheLocation = optCacheLoc;
-                            if (!preindexCacheLocation.endsWith("/") &&
-                                !preindexCacheLocation.endsWith(File.separator)) {
-                                preindexCacheLocation += File.separator;
-                            }
+                    File cacheDir = new File(optCacheLoc);
+                    if (cacheDir.exists() && cacheDir.canWrite()) {
+                        preindexCacheLocation = optCacheLoc;
+                        if (!preindexCacheLocation.endsWith("/") &&
+                            !preindexCacheLocation.endsWith(File.separator)) {
+                            preindexCacheLocation += File.separator;
                         }
                     }
                 }
+            }
 
-                if (origZipFileName == zipFileName) {
-                    if (!useZipFileIndex) {
-                        archive = new ZipArchive(this, zdir);
-                    } else {
-                        archive = new ZipFileIndexArchive(this,
+            if (origZipFileName == zipFileName) {
+                if (!useZipFileIndex) {
+                    archive = new ZipArchive(this, zdir);
+                } else {
+                    archive = new ZipFileIndexArchive(this,
                                 ZipFileIndex.getZipFileIndex(zipFileName,
                                     null,
                                     usePreindexedCache,
                                     preindexCacheLocation,
                                     options.isSet("writezipindexfiles")));
-                    }
+                }
+            } else {
+                if (!useZipFileIndex) {
+                    archive = new SymbolArchive(this, origZipFileName, zdir, symbolFilePrefix);
                 }
                 else {
-                    if (!useZipFileIndex) {
-                        archive = new SymbolArchive(this, origZipFileName, zdir, symbolFilePrefix);
-                    }
-                    else {
-                        archive = new ZipFileIndexArchive(this,
+                    archive = new ZipFileIndexArchive(this,
                                 ZipFileIndex.getZipFileIndex(zipFileName,
                                     symbolFilePrefix,
                                     usePreindexedCache,
                                     preindexCacheLocation,
                                     options.isSet("writezipindexfiles")));
-                    }
                 }
-            } catch (FileNotFoundException ex) {
-                archive = new MissingArchive(zipFileName);
-            } catch (IOException ex) {
-                if (zipFileName.exists())
-                    log.error("error.reading.file", zipFileName, getMessage(ex));
-                archive = new MissingArchive(zipFileName);
             }
+        } catch (FileNotFoundException ex) {
+            archive = new MissingArchive(zipFileName);
+        } catch (IOException ex) {
+            if (zipFileName.exists())
+                log.error("error.reading.file", zipFileName, getMessage(ex));
+            archive = new MissingArchive(zipFileName);
+        }
 
-            archives.put(origZipFileName, archive);
-        }
+        archives.put(origZipFileName, archive);
         return archive;
     }
 
@@ -589,8 +620,7 @@
         ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
 
         for (File directory : path)
-            listDirectory(directory, subdirectory, kinds, recurse, results);
-
+            listContainer(directory, subdirectory, kinds, recurse, results);
         return results.toList();
     }
 
@@ -659,19 +689,22 @@
             return null;
 
         for (File dir: path) {
-            if (dir.isDirectory()) {
-                File f = name.getFile(dir);
-                if (f.exists())
-                    return new RegularFileObject(this, f);
-            } else {
-                Archive a = openArchive(dir);
-                if (a.contains(name)) {
-                    return a.getFileObject(name.dirname(), name.basename());
+            Archive a = archives.get(dir);
+            if (a == null) {
+                if (fsInfo.isDirectory(dir)) {
+                    File f = name.getFile(dir);
+                    if (f.exists())
+                        return new RegularFileObject(this, f);
+                    continue;
                 }
-
+                // Not a directory, create the archive
+                a = openArchive(dir);
+            }
+            // Process the archive
+            if (a.contains(name)) {
+                return a.getFileObject(name.dirname(), name.basename());
             }
         }
-
         return null;
     }
 
@@ -836,8 +869,9 @@
             return false;
         if (!path.equals(uri.getPath())) // implicitly checks for embedded . and ..
             return false;
-        char first = path.charAt(0);
-        return first != '.' && first != '/';
+        if (path.startsWith("/") || path.startsWith("./") || path.startsWith("../"))
+            return false;
+        return true;
     }
 
     // Convenience method
--- a/src/share/classes/com/sun/tools/javac/file/Paths.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/src/share/classes/com/sun/tools/javac/file/Paths.java	Thu Jan 13 15:05:09 2011 -0800
@@ -286,9 +286,8 @@
         }
 
         public void addFile(File file, boolean warn) {
-            File canonFile = fsInfo.getCanonicalFile(file);
-            if (contains(file) || canonicalValues.contains(canonFile)) {
-                /* Discard duplicates and avoid infinite recursion */
+            if (contains(file)) {
+                // discard duplicates
                 return;
             }
 
@@ -298,7 +297,17 @@
                     log.warning(Lint.LintCategory.PATH,
                             "path.element.not.found", file);
                 }
-            } else if (fsInfo.isFile(file)) {
+                super.add(file);
+                return;
+            }
+
+            File canonFile = fsInfo.getCanonicalFile(file);
+            if (canonicalValues.contains(canonFile)) {
+                /* Discard duplicates and avoid infinite recursion */
+                return;
+            }
+
+            if (fsInfo.isFile(file)) {
                 /* File is an ordinary file. */
                 if (!isArchive(file)) {
                     /* Not a recognized extension; open it to see if
@@ -322,11 +331,11 @@
             }
 
             /* Now what we have left is either a directory or a file name
-               confirming to archive naming convention */
+               conforming to archive naming convention */
             super.add(file);
             canonicalValues.add(canonFile);
 
-            if (expandJarClassPaths && fsInfo.exists(file) && fsInfo.isFile(file))
+            if (expandJarClassPaths && fsInfo.isFile(file))
                 addJarClassPath(file, warn);
         }
 
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Jan 13 15:05:09 2011 -0800
@@ -77,6 +77,8 @@
     protected static final Context.Key<ClassReader> classReaderKey =
         new Context.Key<ClassReader>();
 
+    public static final int INITIAL_BUFFER_SIZE = 0x0fff0;
+
     Annotate annotate;
 
     /** Switch: verbose output.
@@ -185,7 +187,7 @@
 
     /** The buffer containing the currently read class file.
      */
-    byte[] buf = new byte[0x0fff0];
+    byte[] buf = new byte[INITIAL_BUFFER_SIZE];
 
     /** The current input pointer.
      */
@@ -2419,8 +2421,14 @@
                 }
             }
         }
+        /*
+         * ensureCapacity will increase the buffer as needed, taking note that
+         * the new buffer will always be greater than the needed and never
+         * exactly equal to the needed size or bp. If equal then the read (above)
+         * will infinitely loop as buf.length - bp == 0.
+         */
         private static byte[] ensureCapacity(byte[] buf, int needed) {
-            if (buf.length < needed) {
+            if (buf.length <= needed) {
                 byte[] old = buf;
                 buf = new byte[Integer.highestOneBit(needed) << 1];
                 System.arraycopy(old, 0, buf, 0, old.length);
--- a/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java	Thu Jan 13 15:05:09 2011 -0800
@@ -376,7 +376,8 @@
                 new SimpleFileVisitor<Path>() {
             @Override
             public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
-                if (SourceVersion.isIdentifier(dir.getName().toString())) // JSR 292?
+                Path name = dir.getName();
+                if (name == null || SourceVersion.isIdentifier(name.toString())) // JSR 292?
                     return FileVisitResult.CONTINUE;
                 else
                     return FileVisitResult.SKIP_SUBTREE;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/6567415/T6567415.java	Thu Jan 13 15:05:09 2011 -0800
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6567415
+ * @summary Test to ensure javac does not go into an infinite loop, while
+ *               reading a classfile of a specific length.
+ * @compile -XDignore.symbol.file T6567415.java
+ * @run main T6567415
+ * @author ksrini
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+
+/*
+ * this test compiles Bar.java into a classfile and enlarges the file to the
+ * magic file length, then use this mutated file on the classpath to compile
+ * Foo.java which references Bar.java and Ka-boom. QED.
+ */
+public class T6567415 {
+    final static String TEST_FILE_NAME = "Bar";
+    final static String TEST_JAVA = TEST_FILE_NAME + ".java";
+    final static String TEST_CLASS = TEST_FILE_NAME + ".class";
+
+    final static String TEST2_FILE_NAME = "Foo";
+    final static String TEST2_JAVA = TEST2_FILE_NAME + ".java";
+
+    /*
+     * the following is the initial buffer length set in ClassReader.java
+     * thus this value needs to change if ClassReader buf length changes.
+     */
+
+    final static int BAD_FILE_LENGTH =
+            com.sun.tools.javac.jvm.ClassReader.INITIAL_BUFFER_SIZE;
+
+    static void createClassFile() throws IOException {
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(TEST_JAVA);
+            PrintStream ps = new PrintStream(fos);
+            ps.println("public class " + TEST_FILE_NAME + " {}");
+        } finally {
+            fos.close();
+        }
+        String cmds[] = {TEST_JAVA};
+        com.sun.tools.javac.Main.compile(cmds);
+    }
+
+    static void enlargeClassFile() throws IOException {
+        File f = new File(TEST_CLASS);
+        if (!f.exists()) {
+            System.out.println("file not found: " + TEST_CLASS);
+            System.exit(1);
+        }
+        File tfile = new File(f.getAbsolutePath() + ".tmp");
+        f.renameTo(tfile);
+
+        RandomAccessFile raf = null;
+        FileChannel wfc = null;
+
+        FileInputStream fis = null;
+        FileChannel rfc = null;
+
+        try {
+            raf =  new RandomAccessFile(f, "rw");
+            wfc = raf.getChannel();
+
+            fis = new FileInputStream(tfile);
+            rfc = fis.getChannel();
+
+            ByteBuffer bb = MappedByteBuffer.allocate(BAD_FILE_LENGTH);
+            rfc.read(bb);
+            bb.rewind();
+            wfc.write(bb);
+            wfc.truncate(BAD_FILE_LENGTH);
+        } finally {
+            wfc.close();
+            raf.close();
+            rfc.close();
+            fis.close();
+        }
+        System.out.println("file length = " + f.length());
+    }
+
+    static void createJavaFile() throws IOException {
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(TEST2_JAVA);
+            PrintStream ps = new PrintStream(fos);
+            ps.println("public class " + TEST2_FILE_NAME +
+                    " {" + TEST_FILE_NAME + " b = new " +
+                    TEST_FILE_NAME  + " ();}");
+        } finally {
+            fos.close();
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        createClassFile();
+        enlargeClassFile();
+        createJavaFile();
+        Thread t = new Thread () {
+            @Override
+            public void run() {
+                String cmds[] = {"-verbose", "-cp", ".", TEST2_JAVA};
+                int ret = com.sun.tools.javac.Main.compile(cmds);
+                System.out.println("test compilation returns: " + ret);
+            }
+        };
+        t.start();
+        t.join(1000*10);
+        System.out.println(t.getState());
+        if (t.isAlive()) {
+            throw new RuntimeException("Error: compilation is looping");
+        }
+    }
+}
--- a/test/tools/javac/diags/examples/TypeParameterOnPolymorphicSignature.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/test/tools/javac/diags/examples/TypeParameterOnPolymorphicSignature.java	Thu Jan 13 15:05:09 2011 -0800
@@ -24,8 +24,10 @@
 // key: compiler.warn.type.parameter.on.polymorphic.signature
 // key: compiler.err.unreported.exception.need.to.catch.or.throw
 
-import java.dyn.InvokeDynamic;
+import java.dyn.MethodHandle;
 
 class TypeParameterOnPolymorphicSignature {
-    { InvokeDynamic.<void>call("",123); }
+    void test(MethodHandle mh) {
+        mh.<void>invokeExact("",123);
+    }
 }
--- a/test/tools/javac/failover/CheckAttributedTree.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/test/tools/javac/failover/CheckAttributedTree.java	Thu Jan 13 15:05:09 2011 -0800
@@ -252,6 +252,13 @@
             error("File " + file + " ignored");
     }
 
+    // See CR:  6982992 Tests CheckAttributedTree.java, JavacTreeScannerTest.java, and SourceTreeeScannerTest.java timeout
+    StringWriter sw = new StringWriter();
+    PrintWriter pw = new PrintWriter(sw);
+    Reporter r = new Reporter(pw);
+    JavacTool tool = JavacTool.create();
+    StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
+
     /**
      * Read a file.
      * @param file the file to be read
@@ -260,12 +267,8 @@
      * @throws TreePosTest.ParseException if any errors occur while parsing the file
      */
     List<Pair<JCCompilationUnit, JCTree>> read(File file) throws IOException, AttributionException {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        Reporter r = new Reporter(pw);
         JavacTool tool = JavacTool.create();
-        Charset cs = (encoding == null ? null : Charset.forName(encoding));
-        StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
+        r.errors = 0;
         Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
         String[] opts = { "-XDshouldStopPolicy=ATTR", "-XDverboseCompilePolicy" };
         JavacTask task = tool.getTask(pw, fm, r, Arrays.asList(opts), null, files);
--- a/test/tools/javac/meth/InvokeDyn.java	Thu Jan 06 20:10:44 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6754038 6979327
- * @summary Generate call sites for method handle
- * @author jrose
- *
- * @library ..
- * @compile -source 7 -target 7 -XDinvokedynamic -XDallowTransitionalJSR292=no InvokeDyn.java
- */
-//No: @run main/othervm -XX:+EnableInvokeDynamic meth.InvokeDyn
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeDyn.java
- * $ javap -c -classpath dist meth.InvokeDyn
- * </code>
- */
-
-package meth;
-
-import java.dyn.*;
-
-public class InvokeDyn {
-    class CS extends CallSite {
-        CS(Object x, Object y, Object z) { throw new RuntimeException(); }
-    }
-    //@BootstrapMethod(CS.class)  //note: requires 6964498
-    void test() throws Throwable {
-        Object x = "hello";
-        Object ojunk; int ijunk;
-        ojunk = InvokeDynamic.greet(x, "world", 123);
-        ojunk = InvokeDynamic.greet(x, "mundus", 456);
-        ojunk = InvokeDynamic.greet(x, "kosmos", 789);
-        ojunk = (String) InvokeDynamic.cogitate(10.11121, 3.14);
-        //InvokeDynamic.#"yow: what I mean to say is, please treat this one specially"(null);
-        ijunk = (int) InvokeDynamic.invoke("goodbye");
-    }
-}
--- a/test/tools/javac/meth/InvokeDynTrans.java	Thu Jan 06 20:10:44 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 6754038 6979327
- * @summary Generate call sites for method handle
- * @author jrose
- *
- * @library ..
- * @compile/fail/ref=InvokeDynTrans.out -Werror -XDrawDiagnostics -source 7 -target 7 InvokeDynTrans.java
- */
-//No: @run main/othervm -XX:+EnableInvokeDynamic meth.InvokeDyn
-
-/*
- * Standalone testing:
- * <code>
- * $ cd $MY_REPO_DIR/langtools
- * $ (cd make; make)
- * $ ./dist/bootstrap/bin/javac -d dist test/tools/javac/meth/InvokeDyn.java
- * $ javap -c -classpath dist meth.InvokeDyn
- * </code>
- */
-
-package meth;
-
-import java.dyn.InvokeDynamic;
-
-public class InvokeDynTrans {
-    void test() throws Throwable {
-        Object x = "hello";
-        InvokeDynamic.greet(x, "world", 123);
-        InvokeDynamic.greet(x, "mundus", 456);
-        InvokeDynamic.greet(x, "kosmos", 789);
-        InvokeDynamic.<String>cogitate(10.11121, 3.14);
-        //InvokeDynamic.<void>#"yow: what I mean to say is, please treat this one specially"(null);
-        InvokeDynamic.<int>invoke("goodbye");
-    }
-}
--- a/test/tools/javac/meth/XlintWarn.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/test/tools/javac/meth/XlintWarn.java	Thu Jan 13 15:05:09 2011 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6999067
+ * @bug 6999067 7010194
  * @summary cast for invokeExact call gets redundant cast to <type> warnings
  * @author mcimadamore
  *
@@ -34,9 +34,7 @@
 
 class XlintWarn {
     void test(MethodHandle mh) throws Throwable {
-        int i1 = (int)mh.invoke();
-        int i2 = (int)mh.invokeExact();
-        int i3 = (int)mh.invokeVarargs();
-        int i4 = (int)InvokeDynamic.test();
+        int i1 = (int)mh.invokeExact();
+        int i2 = (int)mh.invokeVarargs();
     }
 }
--- a/test/tools/javac/nio/compileTest/CompileTest.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/test/tools/javac/nio/compileTest/CompileTest.java	Thu Jan 13 15:05:09 2011 -0800
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6906175 6915476 6915497
+ * @bug 6906175 6915476 6915497 7006564
  * @summary Path-based JavaFileManager
  * @compile -g HelloPathWorld.java
  * @run main CompileTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/filer/TestValidRelativeNames.java	Thu Jan 13 15:05:09 2011 -0800
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6999891
+ * @summary Test valid relative names for Filer.createResource and Filer.getResource
+ * @library ../../lib
+ * @build   JavacTestingAbstractProcessor
+ * @compile TestValidRelativeNames.java
+ * @compile/process -processor TestValidRelativeNames -Amode=create java.lang.Object
+ * @compile/process -processor TestValidRelativeNames -Amode=get    java.lang.Object
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.Diagnostic;
+import javax.tools.StandardLocation;
+
+@SupportedOptions("mode")
+public class TestValidRelativeNames extends JavacTestingAbstractProcessor {
+    enum Kind { READER_WRITER, INPUT_OUTPUT_STREAM };
+
+    static final String[] validRelativeNames = {
+            "foo", "foo.bar", ".foo", ".foo.bar", "foodir/bar", "foodir/.bar"
+    };
+
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver()) {
+            String mode = options.get("mode");
+            for (String relativeBase: validRelativeNames) {
+                for (Kind kind: Kind.values()) {
+                    if (mode.equals("create"))
+                        testCreate(relativeBase, kind);
+                    else
+                        testGet(relativeBase, kind);
+                }
+            }
+        }
+
+        return true;
+    }
+
+    void testCreate(String relativeBase, Kind kind) {
+        String relative = getRelative(relativeBase, kind);
+        System.out.println("test create relative path: " + relative + ", kind: " + kind);
+        try {
+            switch (kind) {
+                case READER_WRITER:
+                    try (Writer writer = filer.createResource(
+                            StandardLocation.CLASS_OUTPUT, "", relative).openWriter()) {
+                        writer.write(relative);
+                    }
+                    break;
+
+                case INPUT_OUTPUT_STREAM:
+                    try (OutputStream out = filer.createResource(
+                            StandardLocation.CLASS_OUTPUT, "", relative).openOutputStream()) {
+                        out.write(relative.getBytes());
+                    }
+                    break;
+            }
+        } catch (Exception e) {
+            messager.printMessage(Diagnostic.Kind.ERROR,
+                    "relative path: " + relative + ", kind: " + kind + ", unexpected exception: " + e);
+        }
+    }
+
+    void testGet(String relativeBase, Kind kind) {
+        String relative = getRelative(relativeBase, kind);
+        System.out.println("test get relative path: " + relative + ", kind: " + kind);
+        try {
+            switch (kind) {
+                case READER_WRITER:
+                    try (Reader reader = new BufferedReader(filer.getResource(
+                            StandardLocation.CLASS_OUTPUT, "", relative).openReader(true))) {
+                        StringBuilder sb = new StringBuilder();
+                        char[] buf = new char[1024];
+                        int n;
+                        while ((n = reader.read(buf, 0, buf.length)) > 0)
+                            sb.append(new String(buf, 0, n));
+                        if (!sb.toString().equals(relative)) {
+                            messager.printMessage(Diagnostic.Kind.ERROR, "unexpected content: " + sb);
+                        }
+                    }
+                    break;
+
+                case INPUT_OUTPUT_STREAM:
+                    try (InputStream in = new DataInputStream(filer.getResource(
+                            StandardLocation.CLASS_OUTPUT, "", relative).openInputStream())) {
+                        StringBuilder sb = new StringBuilder();
+                        byte[] buf = new byte[1024];
+                        int n;
+                        while ((n = in.read(buf, 0, buf.length)) > 0)
+                            sb.append(new String(buf, 0, n));
+                        if (!sb.toString().equals(relative)) {
+                            messager.printMessage(Diagnostic.Kind.ERROR, "unexpected content: " + sb);
+                        }
+                    }
+                    break;
+            }
+        } catch (Exception e) {
+            messager.printMessage(Diagnostic.Kind.ERROR,
+                    "relative path: " + relative + ", kind: " + kind + ", unexpected exception: " + e);
+        }
+    }
+
+    String getRelative(String relativeBase, Kind kind) {
+        String suffix = (kind == Kind.READER_WRITER ? "RW" : "IOS");
+        return relativeBase.replace("foo", "foo" + suffix);
+    }
+}
+
--- a/test/tools/javac/tree/AbstractTreeScannerTest.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/test/tools/javac/tree/AbstractTreeScannerTest.java	Thu Jan 13 15:05:09 2011 -0800
@@ -143,6 +143,13 @@
 
     abstract int test(JCCompilationUnit t);
 
+    // See CR:  6982992 Tests CheckAttributedTree.java, JavacTreeScannerTest.java, and SourceTreeeScannerTest.java timeout
+    StringWriter sw = new StringWriter();
+    PrintWriter pw = new PrintWriter(sw);
+    Reporter r = new Reporter(pw);
+    JavacTool tool = JavacTool.create();
+    StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
+
     /**
      * Read a file.
      * @param file the file to be read
@@ -151,11 +158,8 @@
      * @throws TreePosTest.ParseException if any errors occur while parsing the file
      */
     JCCompilationUnit read(File file) throws IOException, ParseException {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        Reporter r = new Reporter(pw);
         JavacTool tool = JavacTool.create();
-        StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
+        r.errors = 0;
         Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
         JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
         Iterable<? extends CompilationUnitTree> trees = task.parse();
--- a/test/tools/javac/tree/TreePosTest.java	Thu Jan 06 20:10:44 2011 -0800
+++ b/test/tools/javac/tree/TreePosTest.java	Thu Jan 13 15:05:09 2011 -0800
@@ -249,6 +249,13 @@
             error("File " + file + " ignored");
     }
 
+    // See CR:  6982992 Tests CheckAttributedTree.java, JavacTreeScannerTest.java, and SourceTreeeScannerTest.java timeout
+    StringWriter sw = new StringWriter();
+    PrintWriter pw = new PrintWriter(sw);
+    Reporter r = new Reporter(pw);
+    JavacTool tool = JavacTool.create();
+    StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
+
     /**
      * Read a file.
      * @param file the file to be read
@@ -257,12 +264,8 @@
      * @throws TreePosTest.ParseException if any errors occur while parsing the file
      */
     JCCompilationUnit read(File file) throws IOException, ParseException {
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        Reporter r = new Reporter(pw);
         JavacTool tool = JavacTool.create();
-        Charset cs = (encoding == null ? null : Charset.forName(encoding));
-        StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
+        r.errors = 0;
         Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
         JavacTask task = tool.getTask(pw, fm, r, Collections.<String>emptyList(), null, files);
         Iterable<? extends CompilationUnitTree> trees = task.parse();