Merge
authorlana
Thu, 09 Oct 2014 12:17:46 -0700
changeset 26994 906669fe9f2d
parent 26989 596cfb39ca29 (current diff)
parent 26993 513b2cae81c3 (diff)
child 26995 18b8d8859b1a
Merge
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/AttrWithDeps.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/JavaCompilerWithDeps.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/ResolveWithDeps.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacErrorHandler.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Oct 09 12:17:46 2014 -0700
@@ -3159,14 +3159,6 @@
         result = checkId(tree, env1.enclClass.sym.type, sym, env, resultInfo);
     }
 
-    /** Report dependencies.
-     * @param from The enclosing class sym
-     * @param to   The found identifier that the class depends on.
-     */
-    public void reportDependence(Symbol from, Symbol to) {
-        // Override if you want to collect the reported dependencies.
-    }
-
     public void visitSelect(JCFieldAccess tree) {
         // Determine the expected kind of the qualifier expression.
         int skind = 0;
@@ -3299,10 +3291,6 @@
 
         env.info.selectSuper = selectSuperPrev;
         result = checkId(tree, site, sym, env, resultInfo);
-
-        if ((tree.sym.kind & TYP) != 0) {
-            reportDependence(env.enclClass.sym, tree.sym);
-        }
     }
     //where
         /** Determine symbol referenced by a Select expression,
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Oct 09 12:17:46 2014 -0700
@@ -825,6 +825,10 @@
             if (rcvr == null) return null;
             JCExpression rcvrExpr = make.Ident(rcvr);
             Type rcvrType = tree.sym.enclClass().type;
+            if (rcvrType == syms.arrayClass.type) {
+                // Map the receiver type to the actually type, not just "array"
+                rcvrType = tree.getQualifierExpression().type;
+            }
             if (!rcvr.type.tsym.isSubClass(rcvrType.tsym, types)) {
                 rcvrExpr = make.TypeCast(make.Type(rcvrType), rcvrExpr).setType(rcvrType);
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Oct 09 12:17:46 2014 -0700
@@ -2083,9 +2083,6 @@
 
         if ((kind & TYP) != 0) {
             sym = findType(env, name);
-            if (sym.kind==TYP) {
-                 reportDependence(env.enclClass.sym, sym);
-            }
             if (sym.exists()) return sym;
             else if (sym.kind < bestSoFar.kind) bestSoFar = sym;
         }
@@ -2094,14 +2091,6 @@
         else return bestSoFar;
     }
 
-    /** Report dependencies.
-     * @param from The enclosing class sym
-     * @param to   The found identifier that the class depends on.
-     */
-    public void reportDependence(Symbol from, Symbol to) {
-        // Override if you want to collect the reported dependencies.
-    }
-
     /** Find an identifier in a package which matches a specified kind set.
      *  @param env       The current environment.
      *  @param name      The identifier's name.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Oct 09 12:17:46 2014 -0700
@@ -1228,12 +1228,6 @@
                 attr.postAttr(env.tree);
             }
             compileStates.put(env, CompileState.ATTR);
-            if (rootClasses != null && rootClasses.contains(env.enclClass)) {
-                // This was a class that was explicitly supplied for compilation.
-                // If we want to capture the public api of this class,
-                // then now is a good time to do it.
-                reportPublicApi(env.enclClass.sym);
-            }
         }
         finally {
             log.useSource(prev);
@@ -1242,14 +1236,6 @@
         return env;
     }
 
-    /** Report the public api of a class that was supplied explicitly for compilation,
-     *  for example on the command line to javac.
-     * @param sym The symbol of the class.
-     */
-    public void reportPublicApi(ClassSymbol sym) {
-       // Override to collect the reported public api.
-    }
-
     /**
      * Perform dataflow checks on attributed parse trees.
      * These include checks for definite assignment and unreachable statements.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Oct 09 12:17:46 2014 -0700
@@ -2271,9 +2271,11 @@
     }
 
     /*
-     * This method parses a statement treating it as a block, relaxing the
-     * JLS restrictions, allows us to parse more faulty code, doing so
-     * enables us to provide better and accurate diagnostics to the user.
+     * Parse a Statement (JLS 14.5). As an enhancement to improve error recovery,
+     * this method will also recognize variable and class declarations (which are
+     * not legal for a Statement) by delegating the parsing to BlockStatement (JLS 14.2).
+     * If any illegal declarations are found, they will be wrapped in an erroneous tree,
+     * and an error will be produced by this method.
      */
     JCStatement parseStatementAsBlock() {
         int pos = token.pos;
@@ -2302,6 +2304,8 @@
         }
     }
 
+    /**This method parses a statement appearing inside a block.
+     */
     List<JCStatement> blockStatement() {
         //todo: skip to anchor on error(?)
         int pos = token.pos;
@@ -2311,7 +2315,8 @@
         case LBRACE: case IF: case FOR: case WHILE: case DO: case TRY:
         case SWITCH: case SYNCHRONIZED: case RETURN: case THROW: case BREAK:
         case CONTINUE: case SEMI: case ELSE: case FINALLY: case CATCH:
-            return List.of(parseStatement());
+        case ASSERT:
+            return List.of(parseSimpleStatement());
         case MONKEYS_AT:
         case FINAL: {
             Comment dc = token.comment(CommentStyle.JAVADOC);
@@ -2343,14 +2348,12 @@
             error(token.pos, "local.enum");
             dc = token.comment(CommentStyle.JAVADOC);
             return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
-        case ASSERT:
-            return List.of(parseStatement());
         default:
             Token prevToken = token;
             JCExpression t = term(EXPR | TYPE);
             if (token.kind == COLON && t.hasTag(IDENT)) {
                 nextToken();
-                JCStatement stat = parseStatement();
+                JCStatement stat = parseStatementAsBlock();
                 return List.<JCStatement>of(F.at(pos).Labelled(prevToken.name(), stat));
             } else if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
                 pos = token.pos;
@@ -2389,10 +2392,8 @@
      *     | CONTINUE [Ident] ";"
      *     | ASSERT Expression [ ":" Expression ] ";"
      *     | ";"
-     *     | ExpressionStatement
-     *     | Ident ":" Statement
      */
-    public JCStatement parseStatement() {
+    JCStatement parseSimpleStatement() {
         int pos = token.pos;
         switch (token.kind) {
         case LBRACE:
@@ -2542,24 +2543,17 @@
             JCAssert t = toP(F.at(pos).Assert(assertion, message));
             return t;
         }
-        case ENUM:
         default:
-            Token prevToken = token;
-            JCExpression expr = parseExpression();
-            if (token.kind == COLON && expr.hasTag(IDENT)) {
-                nextToken();
-                JCStatement stat = parseStatement();
-                return F.at(pos).Labelled(prevToken.name(), stat);
-            } else {
-                // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon
-                expr = checkExprStat(expr);
-                accept(SEMI);
-                JCExpressionStatement stat = toP(F.at(pos).Exec(expr));
-                return stat;
-            }
+            Assert.error();
+            return null;
         }
     }
 
+    @Override
+    public JCStatement parseStatement() {
+        return parseStatementAsBlock();
+    }
+
     private JCStatement doRecover(int startPos, ErrorRecoveryAction action, String key) {
         int errPos = S.errPos();
         JCTree stm = action.doRecover(this);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Util.java	Thu Oct 09 12:17:46 2014 -0700
@@ -26,6 +26,8 @@
 package com.sun.tools.sjavac;
 
 import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -173,6 +175,20 @@
         return null;
     }
 
+    public static <E> Set<E> union(Set<? extends E> s1,
+                                   Set<? extends E> s2) {
+        Set<E> union = new HashSet<>();
+        union.addAll(s1);
+        union.addAll(s2);
+        return union;
+    }
+
+    public static String getStackTrace(Throwable t) {
+        StringWriter sw = new StringWriter();
+        t.printStackTrace(new PrintWriter(sw));
+        return sw.toString();
+    }
+
     // TODO: Remove when refactoring from java.io.File to java.nio.file.Path.
     public static File pathToFile(Path path) {
         return path == null ? null : path.toFile();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java	Thu Oct 09 12:17:46 2014 -0700
@@ -172,7 +172,7 @@
         } catch (IOException | ClassNotFoundException ex) {
             Log.error("Exception caught: " + ex);
             result = new CompilationResult(CompilationResult.ERROR_FATAL);
-            result.stderr = ex.getMessage();
+            result.stderr = Util.getStackTrace(ex);
         }
         return result;
     }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/AttrWithDeps.java	Thu Oct 09 11:24:21 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2014 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package com.sun.tools.sjavac.comp;
-
-import com.sun.tools.javac.comp.Attr;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.code.Symbol;
-
-/** Subclass to Attr that overrides reportDepedence.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class AttrWithDeps extends Attr {
-
-    /** The dependency database
-     */
-    protected Dependencies deps;
-
-    protected AttrWithDeps(Context context) {
-        super(context);
-        deps = Dependencies.instance(context);
-    }
-
-    public static void preRegister(Context context) {
-        context.put(attrKey, new Context.Factory<Attr>() {
-            public Attr make(Context c) {
-                Attr instance = new AttrWithDeps(c);
-                c.put(Attr.class, instance);
-                return instance;
-            }
-        });
-    }
-
-    /** Collect dependencies in the enclosing class
-     * @param from The enclosing class sym
-     * @param to   The enclosing classes references this sym.
-     * */
-    @Override
-    public void reportDependence(Symbol from, Symbol to) {
-        // Capture dependencies between the packages.
-        deps.collect(from.packge().fullname, to.packge().fullname);
-    }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/JavaCompilerWithDeps.java	Thu Oct 09 11:24:21 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package com.sun.tools.sjavac.comp;
-
-import java.util.StringTokenizer;
-
-import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-
-/** Subclass to Resolve that overrides collect.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class JavaCompilerWithDeps extends JavaCompiler {
-
-    /** The dependency database
-     */
-    protected Dependencies deps;
-    protected SjavacErrorHandler errorHandler;
-
-    public JavaCompilerWithDeps(Context context, SjavacErrorHandler eh) {
-        super(context);
-        deps = Dependencies.instance(context);
-        errorHandler = eh;
-        needRootClasses = true;
-    }
-
-    public static void preRegister(Context context, final SjavacErrorHandler eh) {
-        context.put(compilerKey, new Context.Factory<JavaCompiler>() {
-            public JavaCompiler make(Context c) {
-                JavaCompiler instance = new JavaCompilerWithDeps(c, eh);
-                c.put(JavaCompiler.class, instance);
-                return instance;
-            }
-        });
-    }
-
-    /** Collect the public apis of classes supplied explicitly for compilation.
-     * @param sym The class to visit.
-     */
-    @Override
-    public void reportPublicApi(ClassSymbol sym) {
-        // The next test will catch when source files are located in the wrong directory!
-        // This ought to be moved into javac as a new warning, or perhaps as part
-        // of the auxiliary class warning.
-
-        // For example if sun.swing.BeanInfoUtils
-        // is in fact stored in: /mybuild/jdk/gensrc/javax/swing/beaninfo/BeanInfoUtils.java
-
-        // We do not need to test that BeanInfoUtils is stored in a file named BeanInfoUtils
-        // since this is checked earlier.
-        if (sym.sourcefile != null) {
-            // Rewrite sun.swing.BeanInfoUtils into /sun/swing/
-            StringBuilder pathb = new StringBuilder();
-            StringTokenizer qn = new StringTokenizer(sym.packge().toString(), ".");
-            boolean first = true;
-            while (qn.hasMoreTokens()) {
-                String o = qn.nextToken();
-                pathb.append("/");
-                pathb.append(o);
-                first = false;
-            }
-            pathb.append("/");
-            String path = pathb.toString();
-
-            // Now cut the uri to be: file:///mybuild/jdk/gensrc/javax/swing/beaninfo/
-            String p = sym.sourcefile.toUri().getPath();
-            // Do not use File.separatorChar here, a URI always uses slashes /.
-            int i = p.lastIndexOf("/");
-            String pp = p.substring(0,i+1);
-
-            // Now check if the truncated uri ends with the path. (It does not == failure!)
-            if (path.length() > 0 && !path.equals("/unnamed package/") && !pp.endsWith(path)) {
-                errorHandler.logError("Error: The source file "+sym.sourcefile.getName()+
-                                        " is located in the wrong package directory, because it contains the class "+
-                                        sym.getQualifiedName());
-            }
-        }
-        deps.visitPubapi(sym);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PathAndPackageVerifier.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package com.sun.tools.sjavac.comp;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.tools.JavaFileObject;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
+import com.sun.tools.javac.tree.JCTree.JCIdent;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+import com.sun.tools.javac.util.Name;
+
+public class PathAndPackageVerifier implements TaskListener {
+
+    // Stores the set of compilation units whose source file path does not
+    // match the package declaration.
+    Set<CompilationUnitTree> misplacedCompilationUnits = new HashSet<>();
+
+    @Override
+    @DefinedBy(Api.COMPILER_TREE)
+    public void started(TaskEvent e) {
+    }
+
+    @Override
+    @DefinedBy(Api.COMPILER_TREE)
+    public void finished(TaskEvent e) {
+        if (e.getKind() != TaskEvent.Kind.ANALYZE)
+            return;
+
+        CompilationUnitTree cu = e.getCompilationUnit();
+        if (cu == null)
+            return;
+
+        JavaFileObject jfo = cu.getSourceFile();
+        if (jfo == null)
+            return; // No source file -> package doesn't matter
+
+        JCTree pkg = (JCTree) cu.getPackageName();
+        if (pkg == null)
+            return; // Default package. See JDK-8048144.
+
+        Path dir = Paths.get(jfo.toUri()).normalize().getParent();
+        if (!checkPathAndPackage(dir, pkg))
+            misplacedCompilationUnits.add(cu);
+    }
+
+    /* Returns true if dir matches pkgName.
+     *
+     * Examples:
+     *     (a/b/c, a.b.c) gives true
+     *     (i/j/k, i.x.k) gives false
+     *
+     * Currently (x/a/b/c, a.b.c) also gives true. See JDK-8059598.
+     */
+    private boolean checkPathAndPackage(Path dir, JCTree pkgName) {
+        Iterator<String> pathIter = new ParentIterator(dir);
+        Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName);
+        while (pathIter.hasNext() && pkgIter.hasNext()) {
+            if (!pathIter.next().equals(pkgIter.next()))
+                return false;
+        }
+        return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */
+    }
+
+    public Set<CompilationUnitTree> getMisplacedCompilationUnits() {
+        return misplacedCompilationUnits;
+    }
+
+    /* Iterates over the names of the parents of the given path:
+     * Example: dir1/dir2/dir3  results in  dir3 -> dir2 -> dir1
+     */
+    private static class ParentIterator implements Iterator<String> {
+        Path next;
+        ParentIterator(Path initial) {
+            next = initial;
+        }
+        @Override
+        public boolean hasNext() {
+            return next != null;
+        }
+        @Override
+        public String next() {
+            String tmp = next.getFileName().toString();
+            next = next.getParent();
+            return tmp;
+        }
+    }
+
+    /* Iterates over the names of the enclosing packages:
+     * Example: pkg1.pkg2.pkg3  results in  pkg3 -> pkg2 -> pkg1
+     */
+    private static class EnclosingPkgIterator implements Iterator<String> {
+        JCTree next;
+        EnclosingPkgIterator(JCTree initial) {
+            next = initial;
+        }
+        @Override
+        public boolean hasNext() {
+            return next != null;
+        }
+        @Override
+        public String next() {
+            Name name;
+            if (next instanceof JCIdent) {
+                name = ((JCIdent) next).name;
+                next = null;
+            } else {
+                JCFieldAccess fa = (JCFieldAccess) next;
+                name = fa.name;
+                next = fa.selected;
+            }
+            return name.toString();
+        }
+    }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/ResolveWithDeps.java	Thu Oct 09 11:24:21 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package com.sun.tools.sjavac.comp;
-
-import com.sun.tools.javac.comp.Resolve;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.code.Symbol;
-
-/** Subclass to Resolve that overrides collect.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public class ResolveWithDeps extends Resolve {
-
-    /** The dependency database
-     */
-    protected Dependencies deps;
-
-    protected ResolveWithDeps(Context context) {
-        super(context);
-        deps = Dependencies.instance(context);
-    }
-
-    public static void preRegister(Context context) {
-        context.put(resolveKey, new Context.Factory<Resolve>() {
-            public Resolve make(Context c) {
-                Resolve instance = new ResolveWithDeps(c);
-                c.put(Resolve.class, instance);
-                return instance;
-            }
-        });
-    }
-    /** Collect dependencies in the enclosing class
-     * @param from The enclosing class sym
-     * @param to   The enclosing classes references this sym.
-     * */
-    @Override
-    public void reportDependence(Symbol from, Symbol to) {
-        // Capture dependencies between the packages.
-        deps.collect(from.packge().fullname, to.packge().fullname);
-    }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacErrorHandler.java	Thu Oct 09 11:24:21 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2014, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-
-package com.sun.tools.sjavac.comp;
-
-/**
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public interface SjavacErrorHandler {
-    void logError(String msg);
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Thu Oct 09 12:17:46 2014 -0700
@@ -28,20 +28,25 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.net.URI;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
 
-import javax.tools.JavaCompiler.CompilationTask;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 
+import com.sun.source.tree.CompilationUnitTree;
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Options;
+import com.sun.tools.sjavac.Util;
+import com.sun.tools.sjavac.comp.dependencies.DependencyCollector;
+import com.sun.tools.sjavac.comp.dependencies.PublicApiCollector;
 import com.sun.tools.sjavac.server.CompilationResult;
 import com.sun.tools.sjavac.server.Sjavac;
 import com.sun.tools.sjavac.server.SysInfo;
@@ -70,20 +75,10 @@
                                      List<File> explicitSources,
                                      Set<URI> sourcesToCompile,
                                      Set<URI> visibleSources) {
-        final AtomicBoolean forcedExit = new AtomicBoolean();
-
         JavacTool compiler = JavacTool.create();
         StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
         SmartFileManager smartFileManager = new SmartFileManager(fileManager);
         Context context = new Context();
-        ResolveWithDeps.preRegister(context);
-        AttrWithDeps.preRegister(context);
-        JavaCompilerWithDeps.preRegister(context, new SjavacErrorHandler() {
-            @Override
-            public void logError(String msg) {
-                forcedExit.set(true);
-            }
-        });
 
         // Now setup the actual compilation....
         CompilationResult compilationResult = new CompilationResult(0);
@@ -101,13 +96,16 @@
         for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(sourcesToCompileFiles)) {
             compilationUnits.append(i);
         }
-        forcedExit.set(false);
+
         // Create a new logger.
         StringWriter stdoutLog = new StringWriter();
         StringWriter stderrLog = new StringWriter();
         PrintWriter stdout = new PrintWriter(stdoutLog);
         PrintWriter stderr = new PrintWriter(stderrLog);
         com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK;
+        DependencyCollector depsCollector = new DependencyCollector();
+        PublicApiCollector pubApiCollector = new PublicApiCollector();
+        PathAndPackageVerifier papVerifier = new PathAndPackageVerifier();
         try {
             if (compilationUnits.size() > 0) {
                 smartFileManager.setVisibleSources(visibleSources);
@@ -115,32 +113,51 @@
                 smartFileManager.setLog(stdout);
 
                 // Do the compilation!
-                CompilationTask task = compiler.getTask(stderr,
-                                                        smartFileManager,
-                                                        null,
-                                                        Arrays.asList(args),
-                                                        null,
-                                                        compilationUnits,
-                                                        context);
+                JavacTaskImpl task =
+                        (JavacTaskImpl) compiler.getTask(stderr,
+                                                         smartFileManager,
+                                                         null,
+                                                         Arrays.asList(args),
+                                                         null,
+                                                         compilationUnits,
+                                                         context);
                 smartFileManager.setSymbolFileEnabled(!Options.instance(context).isSet("ignore.symbol.file"));
-                rc = ((JavacTaskImpl) task).doCall();
+                task.addTaskListener(depsCollector);
+                task.addTaskListener(pubApiCollector);
+                task.addTaskListener(papVerifier);
+                rc = task.doCall();
                 smartFileManager.flush();
             }
         } catch (Exception e) {
-            stderrLog.append(e.getMessage());
-            forcedExit.set(true);
+            stderrLog.append(Util.getStackTrace(e));
+            rc = com.sun.tools.javac.main.Main.Result.ERROR;
         }
 
         compilationResult.packageArtifacts = smartFileManager.getPackageArtifacts();
 
         Dependencies deps = Dependencies.instance(context);
+        for (PackageSymbol from : depsCollector.getSourcePackages()) {
+            for (PackageSymbol to : depsCollector.getDependenciesForPkg(from))
+                deps.collect(from.fullname, to.fullname);
+        }
+
+        for (ClassSymbol cs : pubApiCollector.getClassSymbols())
+            deps.visitPubapi(cs);
+
+        if (papVerifier.getMisplacedCompilationUnits().size() > 0) {
+            for (CompilationUnitTree cu : papVerifier.getMisplacedCompilationUnits()) {
+                System.err.println("Misplaced compilation unit.");
+                System.err.println("    Directory: " + Paths.get(cu.getSourceFile().toUri()).getParent());
+                System.err.println("    Package:   " + cu.getPackageName());
+            }
+            rc = com.sun.tools.javac.main.Main.Result.ERROR;
+        }
+
         compilationResult.packageDependencies = deps.getDependencies();
         compilationResult.packagePubapis = deps.getPubapis();
-
         compilationResult.stdout = stdoutLog.toString();
         compilationResult.stderr = stderrLog.toString();
-
-        compilationResult.returnCode = rc.exitCode == 0 && forcedExit.get() ? -1 : rc.exitCode;
+        compilationResult.returnCode = rc.exitCode;
 
         return compilationResult;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/dependencies/Dependency.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package com.sun.tools.sjavac.comp.dependencies;
+
+import java.util.Set;
+
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+
+interface Dependency {
+    Set<PackageSymbol> getPackages();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/dependencies/DependencyCollector.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package com.sun.tools.sjavac.comp.dependencies;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+import com.sun.tools.sjavac.Util;
+
+public class DependencyCollector implements TaskListener {
+
+    Map<PackageSymbol, Set<PackageSymbol>> collectedDependencies = new HashMap<>();
+
+    @Override
+    @DefinedBy(Api.COMPILER_TREE)
+    public void started(TaskEvent e) {
+    }
+
+    @Override
+    @DefinedBy(Api.COMPILER_TREE)
+    public void finished(TaskEvent e) {
+        if (e.getKind() == TaskEvent.Kind.ANALYZE) {
+            JCCompilationUnit cu = (JCCompilationUnit) e.getCompilationUnit();
+            PackageSymbol thisPkg = cu.packge;
+            if (thisPkg == null) {
+                // Compilation unit in default package. See JDK-8048144.
+                return;
+            }
+            DependencyScanner ds = new DependencyScanner();
+            cu.accept(ds);
+            Set<PackageSymbol> pkgDeps = ds.getResult()
+                                           .stream()
+                                           .flatMap(dep -> dep.getPackages().stream())
+                                           .collect(Collectors.toSet());
+            collectedDependencies.merge(thisPkg, pkgDeps, Util::union);
+        }
+    }
+
+    public Set<PackageSymbol> getSourcePackages() {
+        return collectedDependencies.keySet();
+    }
+
+    public Set<PackageSymbol> getDependenciesForPkg(PackageSymbol ps) {
+        return collectedDependencies.get(ps);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/dependencies/DependencyScanner.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package com.sun.tools.sjavac.comp.dependencies;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.TypeTag;
+import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
+import com.sun.tools.javac.tree.JCTree.JCIdent;
+import com.sun.tools.javac.tree.TreeScanner;
+
+class DependencyScanner extends TreeScanner {
+
+    public final Set<Dependency> dependencies = new HashSet<>();
+
+    private boolean isValidDependency(Type t) {
+        if (t == null || t.isPrimitiveOrVoid() || t.isErroneous())
+            return false;
+        TypeTag tag = t.getTag();
+        return tag != TypeTag.PACKAGE
+            && tag != TypeTag.METHOD
+            && tag != TypeTag.ARRAY
+            && tag != TypeTag.TYPEVAR;
+    }
+
+    @Override
+    public void visitIdent(JCIdent tree) {
+        if (isValidDependency(tree.type))
+            dependencies.add(new TypeAndSupertypesDependency(tree.type.tsym));
+        super.visitIdent(tree);
+    }
+
+    @Override
+    public void visitSelect(JCFieldAccess tree) {
+        if (tree.getIdentifier().contentEquals("*")) {
+            Symbol sym = tree.selected instanceof JCIdent ? ((JCIdent) tree.selected).sym
+                                                          : ((JCFieldAccess) tree.selected).sym;
+            if (sym instanceof ClassSymbol) {
+                ClassSymbol clsSym = (ClassSymbol) sym;
+                dependencies.add(new TypeAndSupertypesDependency(clsSym.type.tsym));
+            } else {
+                dependencies.add(new PackageDependency((PackageSymbol) sym));
+            }
+        } else if (tree.type != null && tree.type.hasTag(TypeTag.METHOD)) {  // Method call? Depend on the result (even though we never access it elsewhere)
+            Type retType = tree.type.getReturnType();
+            if (isValidDependency(retType))
+                dependencies.add(new TypeAndSupertypesDependency(retType.tsym));
+        } else if (isValidDependency(tree.type)) {
+            dependencies.add(new TypeAndSupertypesDependency(tree.type.tsym));
+        }
+        super.visitSelect(tree);
+    }
+
+    public Set<Dependency> getResult() {
+        return dependencies;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/dependencies/PackageDependency.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package com.sun.tools.sjavac.comp.dependencies;
+
+import java.util.Collections;
+import java.util.Set;
+
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+
+public class PackageDependency implements Dependency {
+    PackageSymbol ps;
+    public PackageDependency(PackageSymbol ps) {
+        this.ps = ps;
+    }
+    @Override
+    public Set<PackageSymbol> getPackages() {
+        return Collections.singleton(ps);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/dependencies/PublicApiCollector.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package com.sun.tools.sjavac.comp.dependencies;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.sun.source.tree.Tree;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
+public class PublicApiCollector implements TaskListener {
+
+    final Set<ClassSymbol> classSymbols = new HashSet<>();
+
+    @Override
+    @DefinedBy(Api.COMPILER_TREE)
+    public void started(TaskEvent e) {
+    }
+
+    @Override
+    @DefinedBy(Api.COMPILER_TREE)
+    public void finished(TaskEvent e) {
+        if (e.getKind() == TaskEvent.Kind.ANALYZE) {
+            for (Tree t : e.getCompilationUnit().getTypeDecls()) {
+                if (t instanceof JCClassDecl)  // Can also be a JCSkip
+                    classSymbols.add(((JCClassDecl) t).sym);
+            }
+        }
+    }
+
+    public Set<ClassSymbol> getClassSymbols() {
+        return classSymbols;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/dependencies/TypeAndSupertypesDependency.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package com.sun.tools.sjavac.comp.dependencies;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.code.Symbol.TypeSymbol;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Type;
+
+
+public class TypeAndSupertypesDependency implements Dependency {
+
+    protected TypeSymbol type;
+
+    public TypeAndSupertypesDependency(TypeSymbol type) {
+        this.type = Objects.requireNonNull(type);
+    }
+
+    private Set<TypeSymbol> allSupertypes(TypeSymbol t) {
+        if (t == null)
+            return Collections.emptySet();
+        Set<TypeSymbol> result = new HashSet<>();
+        result.add(t);
+        if (t instanceof ClassSymbol) {
+            ClassSymbol cs = (ClassSymbol) t;
+            result.addAll(allSupertypes(cs.getSuperclass().tsym));
+            for (Type it : cs.getInterfaces())
+                result.addAll(allSupertypes(it.tsym));
+        }
+        return result;
+    }
+
+    @Override
+    public Set<PackageSymbol> getPackages() {
+        if (type.kind == Kinds.ERR)
+            return Collections.emptySet();
+        if (type instanceof ClassSymbol) {
+            return allSupertypes(type).stream()
+                                      .map(TypeSymbol::packge)
+                                      .collect(Collectors.toSet());
+        }
+        throw new AssertionError("Could not get package name for " + type);
+    }
+}
+
--- a/langtools/test/tools/javac/LabeledDeclaration.java	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/test/tools/javac/LabeledDeclaration.java	Thu Oct 09 12:17:46 2014 -0700
@@ -1,6 +1,6 @@
 /*
  * @test  /nodynamiccopyright/
- * @bug 4039843
+ * @bug 4039843 8057652
  * @summary The compiler should not allow labeled declarations.
  * @author turnidge
  *
--- a/langtools/test/tools/javac/LabeledDeclaration.out	Thu Oct 09 11:24:21 2014 -0700
+++ b/langtools/test/tools/javac/LabeledDeclaration.out	Thu Oct 09 12:17:46 2014 -0700
@@ -1,3 +1,2 @@
-LabeledDeclaration.java:12:14: compiler.err.dot.class.expected
-LabeledDeclaration.java:12:10: compiler.err.not.stmt
-2 errors
+LabeledDeclaration.java:12:14: compiler.err.variable.not.allowed
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MethodReferenceArrayClone.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, 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 8056051
+ * @summary int[]::clone causes "java.lang.NoClassDefFoundError: Array"
+ * @run main MethodReferenceArrayClone
+ */
+
+import java.util.Arrays;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class MethodReferenceArrayClone {
+    public static void main(String[] args) {
+        int[] intArgs = new int[] {1, 2, 3, 4, 5};
+        checkInt("int[]::clone", int[]::clone, intArgs);
+        checkInt("a -> a.clone()", a -> a.clone(), intArgs);
+        checkInt("intArgs::clone", intArgs::clone, intArgs);
+
+        String[] stringArgs = new String[] {"hi", "de", "ho"};
+        checkString("String[]::clone", String[]::clone, stringArgs);
+        checkString("a -> a.clone()", a -> a.clone(), stringArgs);
+        checkString("args::clone", stringArgs::clone, stringArgs);
+    }
+
+    private static void checkInt(String label, Supplier<int[]> s, int[] expected) {
+        if (!Arrays.equals(s.get(), expected)) {
+            throw new RuntimeException("Unexpected value " + label + ": " + Arrays.toString(s.get()));
+        }
+    }
+
+    private static void checkInt(String label, Function<int[], int[]> f, int[] a) {
+        checkInt(label, () -> f.apply(a), a);
+    }
+
+    private static void checkString(String label, Supplier<String[]> s, String[] expected) {
+        if (!Arrays.equals(s.get(), expected)) {
+            throw new RuntimeException("Unexpected value " + label + ": " + Arrays.toString(s.get()));
+        }
+    }
+
+    private static void checkString(String label, Function<String[], String[]> f, String[] a) {
+        checkString(label, () -> f.apply(a), a);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/DependencyCollection.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8056258 8048609
+ * @summary Ensures that the DependencyCollector covers various cases.
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper DependencyCollection
+ */
+
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.sjavac.comp.SmartFileManager;
+import com.sun.tools.sjavac.comp.dependencies.DependencyCollector;
+
+public class DependencyCollection {
+
+    public static void main(String[] args) {
+        Path src = Paths.get(ToolBox.testSrc, "test-input", "src");
+
+        JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fileManager = javac.getStandardFileManager(null, null, null);
+        SmartFileManager smartFileManager = new SmartFileManager(fileManager);
+        smartFileManager.setSymbolFileEnabled(false);
+        Iterable<? extends JavaFileObject> fileObjects =
+                fileManager.getJavaFileObjectsFromFiles(Arrays.asList(src.resolve("pkg/Test.java").toFile()));
+        JavacTaskImpl task = (JavacTaskImpl) javac.getTask(new PrintWriter(System.out),
+                                                           smartFileManager,
+                                                           null,
+                                                           Arrays.asList("-d", "classes",
+                                                                         "-sourcepath", src.toAbsolutePath().toString()),
+                                                           null,
+                                                           fileObjects);
+        DependencyCollector depsCollector = new DependencyCollector();
+        task.addTaskListener(depsCollector);
+        task.doCall();
+
+        // Find pkg symbol
+        PackageSymbol pkg = findPkgSymbolWithName(depsCollector.getSourcePackages(), "pkg");
+        Set<PackageSymbol> foundDependencies = depsCollector.getDependenciesForPkg(pkg);
+
+        // Print dependencies
+        System.out.println("Found dependencies:");
+        foundDependencies.stream()
+                         .sorted(Comparator.comparing(DependencyCollection::extractNumber))
+                         .forEach(p -> System.out.println("    " + p));
+
+        // Check result
+        Set<Integer> found = foundDependencies.stream()
+                                              .map(DependencyCollection::extractNumber)
+                                              .collect(Collectors.toSet());
+        found.remove(-1); // Dependencies with no number (java.lang etc)
+        Set<Integer> expected = new HashSet<>();
+        for (int i = 2; i <= 30; i++) {
+            if (i == 15) continue;  // Case 15 correspond to the type of a throw-away return value.
+            expected.add(i);
+        }
+
+        Set<Integer> missing = new HashSet<>(expected);
+        missing.removeAll(found);
+        if (missing.size() > 0) {
+            System.out.println("Missing dependencies:");
+            missing.forEach(i -> System.out.println("    Dependency " + i));
+        }
+
+        Set<Integer> unexpected = new HashSet<>(found);
+        unexpected.removeAll(expected);
+        if (unexpected.size() > 0) {
+            System.out.println("Unexpected dependencies found:");
+            unexpected.forEach(i -> System.out.println("    Dependency " + i));
+        }
+
+        if (missing.size() > 0 || unexpected.size() > 0)
+            throw new AssertionError("Missing and/or unexpected dependencies found.");
+    }
+
+    private static PackageSymbol findPkgSymbolWithName(Set<PackageSymbol> syms, String name) {
+        for (PackageSymbol ps : syms)
+            if (ps.fullname.toString().equals("pkg"))
+                return ps;
+        throw new AssertionError("Could not find package named \"pkg\".");
+    }
+
+    public static int extractNumber(PackageSymbol p) {
+        Matcher m = Pattern.compile("\\d+").matcher(p.fullname.toString());
+        if (!m.find())
+            return -1;
+        return Integer.parseInt(m.group());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/IncCompInheritance.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8056258
+ * @summary Analysis of public API does not take super classes into account
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper IncCompInheritance
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class IncCompInheritance extends SjavacBase {
+    public static void main(String... args) throws Exception {
+
+        Path root = Paths.get(IncCompInheritance.class.getSimpleName() + "Test");
+        Path src = root.resolve("src");
+        Path classes = root.resolve("classes");
+
+        // Prep source files: A <- B <- C
+        String a = "package pkga; public class A { public void m() {} }";
+        String b = "package pkgb; public class B extends pkga.A {}";
+        String c = "package pkgc; public class C extends pkgb.B {{ new pkgb.B().m(); }}";
+        toolbox.writeFile(src.resolve("pkga/A.java"), a);
+        toolbox.writeFile(src.resolve("pkgb/B.java"), b);
+        toolbox.writeFile(src.resolve("pkgc/C.java"), c);
+
+        // Initial compile (should succeed)
+        String server = "--server:portfile=testserver,background=false";
+        int rc1 = compile(server, "-d", classes, src);
+        if (rc1 != 0)
+            throw new AssertionError("Compilation failed unexpectedly");
+
+        // Remove method A.m
+        String aModified = "package pkga; public class A { }";
+        toolbox.writeFile(src.resolve("pkga/A.java"), aModified);
+
+        // Incremental compile (C should now be recompiled even though it
+        // depends on A only through inheritance via B).
+        // Since A.m is removed, this should fail.
+        int rc2 = compile(server, "-d", classes, src);
+        if (rc2 == 0)
+            throw new AssertionError("Compilation succeeded unexpectedly");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/PackagePathMismatch.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8059349
+ * @summary This test makes sure file paths matches package declarations
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper PackagePathMismatch
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class PackagePathMismatch extends SjavacBase {
+    public static void main(String... args) throws Exception {
+
+        Path root = Paths.get(PackagePathMismatch.class.getSimpleName() + "Test");
+        Path src = root.resolve("src");
+        Path classes = root.resolve("classes");
+
+        toolbox.writeFile(src.resolve("a/x/c/Test.java"),
+                          "package a.b.c; class Test { }");
+
+        // Compile should fail since package a.b.c does not match path a/x/c.
+        String server = "--server:portfile=testserver,background=false";
+        int rc1 = compile(server, "-d", classes, src);
+        if (rc1 == 0)
+            throw new AssertionError("Compilation succeeded unexpectedly");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/SjavacBase.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+public class SjavacBase {
+
+    protected final static ToolBox toolbox = new ToolBox();
+
+    /**
+     * Utility method for invoking sjavac. Method accepts Objects as arguments
+     * (which are turned into Strings through Object::toString) to allow clients
+     * to pass for instance Path objects.
+     */
+    public static int compile(Object... args) throws ReflectiveOperationException {
+        // Use reflection to avoid a compile-time dependency on sjavac Main
+        System.err.println("compile: " + Arrays.toString(args));
+        Class<?> c = Class.forName("com.sun.tools.sjavac.Main");
+        Method m = c.getDeclaredMethod("go", String[].class);
+        String[] strArgs = new String[args.length];
+        for (int i = 0; i < args.length; i++)
+            strArgs[i] = args[i].toString();
+        int rc = (Integer) m.invoke(null, (Object) strArgs);
+        return rc;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/nondependency/pkg26/Cls26.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package nondependency.pkg26;
+
+public class Cls26 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg/Test.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+// Use fully qualified names to avoid accidentally capturing dependencies in import statements.
+
+package pkg;
+
+import pkg2.*;                                          // pkg2 as a whole
+import pkg3.Cls3;                                       // pkg3.Cls3
+import pkg25.Cls25;                                     // pkg25.Cls25
+import nondependency.pkg26.Cls26;                       // pkg26.Cls26 (but not nondependency)
+import pkg28.Cls28.Inner28;                             // pkg29.Cls28, pkg29.Cls28.Inner28
+import static pkg29.Cls29.Inner29;                      // pkg29.Cls29, pkg29.Cls29.Inner29
+import static pkg30.Cls30.*;                            // pkg30.Cls30 as a whole
+
+@pkg5.Anno5                                             // pkg5.Anno5
+public class Test<S extends pkg23.Cls23>                // pkg23.Cls23
+        extends pkg4.Cls4/*extends pkg11.Cls11*/<pkg6.Cls6/*extends pkg12.Cls12*/>   // pkg4.Cls4, pkg11.Cls11, pkg6.Cls6, pkg12.Cls12
+        implements pkg7.Cls7, pkg8.Cls8<pkg9.Cls9> {    // pkg7.Cls7, pkg8.Cls8, pkg9.Cls9
+
+    pkg27.Cls27 cls27[][][] = new pkg27.Cls27[0][0][0]; // pkg27.Cls27
+
+    pkg2.Cls2 cls2;
+    pkg19.Cls19 f19;                                    // pkg19.Cls19
+
+    public static void main(String[] args) {            // java.lang.String
+        pkg10.Cls10 o = new pkg10.Cls10();              // pkg10.Cls10
+
+        o.getCls13().getCls14().getCls15();             // pkg13.Cls13, pkg14.Cls14, pkg15.Cls15
+        pkg23.Cls23.f24 = null;                         // pkg23.Cls23, pkg24.Cls24
+    }
+
+    static pkg16.Cls16 m1(pkg17.Cls17 o) {              // pkg16.Cls16, pkg17.Cls17
+        return null;
+    }
+
+    public <T extends pkg18.Cls18> void m2() {          // pkg18.Cls18
+    }
+
+    public <T> T m3() {
+        T t;
+        t = null;
+        return t;
+    }
+
+    @pkg20.Anno20(pkg21.Cls21.class)                    // pkg20.Anno20, pkg21.Cls21
+    private void m3(@pkg22.Anno22 String s) {           // pkg22.Anno22
+        Runnable r = () -> { System.out.println("hello"); };
+    }
+
+    private void m4() throws Cls25 {                    // pkg25.Cls25
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg10/Cls10.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg10;
+public class Cls10 {
+    public pkg13.Cls13 getCls13() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg11/Cls11.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg11; public class Cls11 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg12/Cls12.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg12; public class Cls12 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg13/Cls13.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg13;
+public class Cls13 {
+    public pkg14.Cls14 getCls14() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg14/Cls14.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg14;
+public class Cls14 {
+    public int[] getCls15() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg15/Cls15.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg15; public class Cls15 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg16/Cls16.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg16; public class Cls16 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg17/Cls17.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg17; public class Cls17 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg18/Cls18.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg18; public class Cls18 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg19/Cls19.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg19; public class Cls19 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg2/Cls2.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg2; public class Cls2 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg20/Anno20.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg20;
+public @interface Anno20 {
+    Class<?> value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg21/Cls21.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg21; public class Cls21 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg22/Anno22.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg22;
+public @interface Anno22 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg23/Cls23.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg23;
+public class Cls23 {
+    public static pkg24.Cls24 f24;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg24/Cls24.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg24; public class Cls24 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg25/Cls25.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg25;
+
+public class Cls25 extends Throwable {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg27/Cls27.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg27;
+public class Cls27 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg28/Cls28.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg28;
+public class Cls28 {
+    public static class Inner28 {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg29/Cls29.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg29;
+public class Cls29 {
+    public static class Inner29 {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg3/Cls3.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg3; public class Cls3 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg30/Cls30.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg30;
+
+public class Cls30 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg4/Cls4.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg4;
+public class Cls4<T> extends pkg11.Cls11 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg5/Anno5.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg5;
+public @interface Anno5 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg6/Cls6.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg6;
+public class Cls6 extends pkg12.Cls12 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg7/Cls7.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg7;
+public interface Cls7 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg8/Cls8.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg8;
+public interface Cls8<T> {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/test-input/src/pkg9/Cls9.java	Thu Oct 09 12:17:46 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package pkg9; public class Cls9 { }