Merge
authorlana
Thu, 03 Mar 2016 12:48:19 -0800
changeset 36275 7d18ec07fde4
parent 36266 6e85578e6e9c (current diff)
parent 36274 28fabde8c8ed (diff)
child 36276 37bd10863a8a
Merge
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Mar 03 12:48:19 2016 -0800
@@ -2001,10 +2001,11 @@
             }
         }
 
+        final boolean explicitOverride = m.attribute(syms.overrideType.tsym) != null;
         // Check if this method must override a super method due to being annotated with @Override
         // or by virtue of being a member of a diamond inferred anonymous class. Latter case is to
         // be treated "as if as they were annotated" with @Override.
-        boolean mustOverride = m.attribute(syms.overrideType.tsym) != null ||
+        boolean mustOverride = explicitOverride ||
                 (env.info.isAnonymousDiamond && !m.isConstructor() && !m.isPrivate());
         if (mustOverride && !isOverrider(m)) {
             DiagnosticPosition pos = tree.pos();
@@ -2014,7 +2015,9 @@
                     break;
                 }
             }
-            log.error(pos, "method.does.not.override.superclass");
+            log.error(pos,
+                      explicitOverride ? Errors.MethodDoesNotOverrideSuperclass :
+                                Errors.AnonymousDiamondMethodDoesNotOverrideSuperclass(Fragments.DiamondAnonymousMethodsImplicitlyOverride));
         }
     }
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Mar 03 12:48:19 2016 -0800
@@ -80,6 +80,11 @@
      */
     private final Type methodType;
 
+    /**
+     * Are we presently traversing a let expression ? Yes if depth != 0
+     */
+    private int letExprDepth;
+
     public static Gen instance(Context context) {
         Gen instance = context.get(genKey);
         if (instance == null)
@@ -1006,8 +1011,10 @@
         if (tree.init != null) {
             checkStringConstant(tree.init.pos(), v.getConstValue());
             if (v.getConstValue() == null || varDebugInfo) {
+                Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
                 genExpr(tree.init, v.erasure(types)).load();
                 items.makeLocalItem(v).store();
+                Assert.check(letExprDepth != 0 || code.state.stacksize == 0);
             }
         }
         checkDimension(tree.pos(), v.type);
@@ -1062,12 +1069,14 @@
                 CondItem c;
                 if (cond != null) {
                     code.statBegin(cond.pos);
+                    Assert.check(code.state.stacksize == 0);
                     c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER);
                 } else {
                     c = items.makeCondItem(goto_);
                 }
                 Chain loopDone = c.jumpFalse();
                 code.resolve(c.trueJumps);
+                Assert.check(code.state.stacksize == 0);
                 genStat(body, loopEnv, CRT_STATEMENT | CRT_FLOW_TARGET);
                 code.resolve(loopEnv.info.cont);
                 genStats(step, loopEnv);
@@ -1080,11 +1089,13 @@
                 CondItem c;
                 if (cond != null) {
                     code.statBegin(cond.pos);
+                    Assert.check(code.state.stacksize == 0);
                     c = genCond(TreeInfo.skipParens(cond), CRT_FLOW_CONTROLLER);
                 } else {
                     c = items.makeCondItem(goto_);
                 }
                 code.resolve(c.jumpTrue(), startpc);
+                Assert.check(code.state.stacksize == 0);
                 code.resolve(c.falseJumps);
             }
             Chain exit = loopEnv.info.exit;
@@ -1112,6 +1123,7 @@
         int limit = code.nextreg;
         Assert.check(!tree.selector.type.hasTag(CLASS));
         int startpcCrt = genCrt ? code.curCP() : 0;
+        Assert.check(code.state.stacksize == 0);
         Item sel = genExpr(tree.selector, syms.intType);
         List<JCCase> cases = tree.cases;
         if (cases.isEmpty()) {
@@ -1280,6 +1292,7 @@
         int limit = code.nextreg;
         // Generate code to evaluate lock and save in temporary variable.
         final LocalItem lockVar = makeTemp(syms.objectType);
+        Assert.check(code.state.stacksize == 0);
         genExpr(tree.lock, tree.lock.type).load().duplicate();
         lockVar.store();
 
@@ -1526,9 +1539,11 @@
     public void visitIf(JCIf tree) {
         int limit = code.nextreg;
         Chain thenExit = null;
+        Assert.check(code.state.stacksize == 0);
         CondItem c = genCond(TreeInfo.skipParens(tree.cond),
                              CRT_FLOW_CONTROLLER);
         Chain elseChain = c.jumpFalse();
+        Assert.check(code.state.stacksize == 0);
         if (!c.isFalse()) {
             code.resolve(c.trueJumps);
             genStat(tree.thenpart, env, CRT_STATEMENT | CRT_FLOW_TARGET);
@@ -1542,6 +1557,7 @@
         }
         code.resolve(thenExit);
         code.endScopes(limit);
+        Assert.check(code.state.stacksize == 0);
     }
 
     public void visitExec(JCExpressionStatement tree) {
@@ -1555,7 +1571,9 @@
                 ((JCUnary) e).setTag(PREDEC);
                 break;
         }
+        Assert.check(code.state.stacksize == 0);
         genExpr(tree.expr, tree.expr.type).drop();
+        Assert.check(code.state.stacksize == 0);
     }
 
     public void visitBreak(JCBreak tree) {
@@ -1581,6 +1599,7 @@
          */
         int tmpPos = code.pendingStatPos;
         if (tree.expr != null) {
+            Assert.check(code.state.stacksize == 0);
             Item r = genExpr(tree.expr, pt).load();
             if (hasFinally(env.enclMethod, env)) {
                 r = makeTemp(pt);
@@ -1600,8 +1619,10 @@
     }
 
     public void visitThrow(JCThrow tree) {
+        Assert.check(code.state.stacksize == 0);
         genExpr(tree.expr, tree.expr.type).load();
         code.emitop0(athrow);
+        Assert.check(code.state.stacksize == 0);
     }
 
 /* ************************************************************************
@@ -2101,10 +2122,12 @@
     }
 
     public void visitLetExpr(LetExpr tree) {
+        letExprDepth++;
         int limit = code.nextreg;
         genStats(tree.defs, env);
         result = genExpr(tree.expr, tree.expr.type).load();
         code.endScopes(limit);
+        letExprDepth--;
     }
 
     private void generateReferencesToPrunedTree(ClassSymbol classSymbol, Pool pool) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Mar 03 12:48:19 2016 -0800
@@ -214,6 +214,11 @@
     Unexpected @FunctionalInterface annotation\n\
     {0}
 
+# 0: message segment
+compiler.err.anonymous.diamond.method.does.not.override.superclass=\
+    method does not override or implement a method from a supertype\n\
+    {0}
+
 # 0: symbol
 compiler.misc.not.a.functional.intf=\
     {0} is not a functional interface
@@ -1196,6 +1201,9 @@
 ## miscellaneous strings
 ##
 
+compiler.misc.diamond.anonymous.methods.implicitly.override=\
+    (due to <>, every non-private method declared in this anonymous class must override or implement a method from a supertype)
+
 compiler.misc.source.unavailable=\
     (source unavailable)
 
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java	Thu Mar 03 12:48:19 2016 -0800
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.io.Writer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
@@ -81,6 +80,10 @@
         if (!validateOptions(options))
             return RC_FATAL;
 
+        if (srcDstOverlap(options.getSources(), options.getDestDir())) {
+            return RC_FATAL;
+        }
+
         if (!createIfMissing(options.getDestDir()))
             return RC_FATAL;
 
@@ -330,6 +333,22 @@
 
     }
 
+    private static boolean srcDstOverlap(List<SourceLocation> locs, Path dest) {
+        for (SourceLocation loc : locs) {
+            if (isOverlapping(loc.getPath(), dest)) {
+                Log.error("Source location " + loc.getPath() + " overlaps with destination " + dest);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static boolean isOverlapping(Path p1, Path p2) {
+        p1 = p1.toAbsolutePath().normalize();
+        p2 = p2.toAbsolutePath().normalize();
+        return p1.startsWith(p2) || p2.startsWith(p1);
+    }
+
     private static boolean createIfMissing(Path dir) {
 
         if (Files.isDirectory(dir))
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Mar 03 12:48:19 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -96,6 +96,7 @@
     protected void generateFrameFile() throws IOException {
         Content frame = getFrameDetails();
         HtmlTree body = new HtmlTree(HtmlTag.BODY);
+        body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
         if (configuration.allowTag(HtmlTag.MAIN)) {
             HtmlTree main = HtmlTree.MAIN(frame);
             body.addContent(main);
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Mar 03 12:48:19 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -423,6 +423,10 @@
                 "            }" + DocletConstants.NL +
                 "        }" + DocletConstants.NL +
                 "        return true;" + DocletConstants.NL +
+                "    }" + DocletConstants.NL +
+                "    function loadFrames() {" + DocletConstants.NL +
+                "        if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
+                "             top.classFrame.location = top.targetPage;" + DocletConstants.NL +
                 "    }" + DocletConstants.NL;
         RawHtml scriptContent = new RawHtml(scriptCode);
         script.addContent(scriptContent);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java	Thu Mar 03 12:48:19 2016 -0800
@@ -27,6 +27,7 @@
 
 import java.io.*;
 
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
@@ -102,6 +103,7 @@
     protected void generateFrameFile() throws IOException {
         Content frame = getFrameDetails();
         HtmlTree body = new HtmlTree(HtmlTag.BODY);
+        body.addAttr(HtmlAttr.ONLOAD, "loadFrames()");
         if (configuration.allowTag(HtmlTag.MAIN)) {
             HtmlTree main = HtmlTree.MAIN(frame);
             body.addContent(main);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java	Thu Mar 03 12:48:19 2016 -0800
@@ -401,6 +401,10 @@
                 "            }" + DocletConstants.NL +
                 "        }" + DocletConstants.NL +
                 "        return true;" + DocletConstants.NL +
+                "    }" + DocletConstants.NL +
+                "    function loadFrames() {" + DocletConstants.NL +
+                "        if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
+                "             top.classFrame.location = top.targetPage;" + DocletConstants.NL +
                 "    }" + DocletConstants.NL;
         RawHtml scriptContent = new RawHtml(scriptCode);
         script.addContent(scriptContent);
--- a/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java	Thu Mar 03 12:48:19 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8072945 8081854 8141492
+ * @bug 8072945 8081854 8141492 8148985
  * @summary Test the version of HTML generated by the javadoc tool.
  * @author bpatel
  * @library ../lib
@@ -688,7 +688,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML>",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<main role=\"main\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
@@ -1599,7 +1599,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
                 + "<div class=\"leftTop\">\n"
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Thu Mar 03 12:48:19 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, 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
@@ -100,8 +100,15 @@
                 + "        }\n"
                 + "        return true;\n"
                 + "    }\n"
+                + "    function loadFrames() {\n"
+                + "        if (targetPage != \"\" && targetPage != \"undefined\")\n"
+                + "             top.classFrame.location = top.targetPage;\n"
+                + "    }\n"
                 + "</script>");
 
+        checkOutput("index.html", true,
+                "<body onload=\"loadFrames()\"");
+
         //Make sure title javascript only runs if is-external is not true
         checkOutput("pkg/C.html", true,
                 "    try {\n"
--- a/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java	Thu Mar 03 12:48:19 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8072945 8081854 8141492
+ * @bug 8072945 8081854 8141492 8148985
  * @summary Test the version of HTML generated by the javadoc tool.
  * @author bpatel
  * @library ../lib
@@ -599,7 +599,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML>",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<main role=\"main\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
@@ -1391,7 +1391,7 @@
         checkOutput("index.html", true,
                 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" title=\"Style\">",
-                "<body>\n"
+                "<body onload=\"loadFrames()\">\n"
                 + "<div class=\"mainContainer\">\n"
                 + "<div class=\"leftContainer\">\n"
                 + "<div class=\"leftTop\">\n"
--- a/langtools/test/jdk/javadoc/doclet/testIncluded/TestIncluded.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testIncluded/TestIncluded.java	Thu Mar 03 12:48:19 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8149468
+ * @bug      8149842
  * @summary  Verify that non included classes are not inspected.
  * @library  ../lib
  * @modules  jdk.javadoc/jdk.javadoc.internal.tool
--- a/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/test/jdk/javadoc/doclet/testJavascript/TestJavascript.java	Thu Mar 03 12:48:19 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756
+ * @bug      4665566 4855876 7025314 8012375 8015997 8016328 8024756 8148985
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib
@@ -100,8 +100,15 @@
                 + "        }\n"
                 + "        return true;\n"
                 + "    }\n"
+                + "    function loadFrames() {\n"
+                + "        if (targetPage != \"\" && targetPage != \"undefined\")\n"
+                + "             top.classFrame.location = top.targetPage;\n"
+                + "    }\n"
                 + "</script>");
 
+        checkOutput("index.html", true,
+                "<body onload=\"loadFrames()\"");
+
         //Make sure title javascript only runs if is-external is not true
         checkOutput("pkg/C.html", true,
                 "    try {\n"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DiamondMethodDoesNotOverride.java	Thu Mar 03 12:48:19 2016 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+// key: compiler.err.anonymous.diamond.method.does.not.override.superclass
+// key: compiler.misc.diamond.anonymous.methods.implicitly.override
+
+class X {
+    interface  Foo<T> {
+        void g(T t);
+    }
+    void m() {
+      Foo<String> fs = new Foo<>() {
+          public void g(String s) { }
+          void someMethod() { }
+      };
+   }
+}
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg15.java	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg15.java	Thu Mar 03 12:48:19 2016 -0800
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8062373
+ * @bug 8062373 8151018
  *
  * @summary  Test that javac complains when a <> inferred class contains a public method that does override a supertype method.
  * @author sadayapalam
--- a/langtools/test/tools/javac/generics/diamond/neg/Neg15.out	Thu Mar 03 12:26:01 2016 -0800
+++ b/langtools/test/tools/javac/generics/diamond/neg/Neg15.out	Thu Mar 03 12:48:19 2016 -0800
@@ -1,4 +1,4 @@
-Neg15.java:48:28: compiler.err.method.does.not.override.superclass
-Neg15.java:52:21: compiler.err.method.does.not.override.superclass
-Neg15.java:56:31: compiler.err.method.does.not.override.superclass
+Neg15.java:48:28: compiler.err.anonymous.diamond.method.does.not.override.superclass: (compiler.misc.diamond.anonymous.methods.implicitly.override)
+Neg15.java:52:21: compiler.err.anonymous.diamond.method.does.not.override.superclass: (compiler.misc.diamond.anonymous.methods.implicitly.override)
+Neg15.java:56:31: compiler.err.anonymous.diamond.method.does.not.override.superclass: (compiler.misc.diamond.anonymous.methods.implicitly.override)
 3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/sjavac/OverlappingSrcDst.java	Thu Mar 03 12:48:19 2016 -0800
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2016, 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
+ * @summary Make sure sjavac doesn't allow overlapping source and destination
+ *          directories.
+ * @bug 8061320
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.file
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.sjavac
+ * @build Wrapper ToolBox
+ * @run main Wrapper OverlappingSrcDst
+ */
+
+import java.io.File;
+import java.nio.file.Paths;
+
+public class OverlappingSrcDst extends SJavacTester {
+    public static void main(String... args) {
+        new OverlappingSrcDst().run();
+    }
+
+    public void run() {
+        String abs = ToolBox.currDir.toAbsolutePath().toString();
+
+        // Relative vs relative
+        test("dir", "dir", false);
+        test("dir", "dir/dst", false);
+        test("dir/src", "dir", false);
+        test("src", "dst", true);
+
+        // Absolute vs absolute
+        test(abs + "/dir", abs + "/dir", false);
+        test(abs + "/dir", abs + "/dir/dst", false);
+        test(abs + "/dir/src", abs + "/dir", false);
+        test(abs + "/src", abs + "/dst", true);
+
+        // Absolute vs relative
+        test(abs + "/dir", "dir", false);
+        test(abs + "/dir", "dir/dst", false);
+        test(abs + "/dir/src", "dir", false);
+        test(abs + "/src", "dst", true);
+
+        // Relative vs absolute
+        test("dir", abs + "/dir", false);
+        test("dir", abs + "/dir/dst", false);
+        test("dir/src", abs + "/dir", false);
+        test("src", abs + "/dst", true);
+    }
+
+    private void test(String srcDir, String dstDir, boolean shouldSucceed) {
+        boolean succeeded = testCompilation(srcDir, dstDir);
+        if (shouldSucceed != succeeded) {
+            throw new AssertionError(
+                    String.format("Test failed for "
+                                          + "srcDir=\"%s\", "
+                                          + "dstDir=\"%s\". "
+                                          + "Compilation was expected to %s but %s.",
+                                  srcDir,
+                                  dstDir,
+                                  shouldSucceed ? "succeed" : "fail",
+                                  succeeded ? "succeeded" : "failed"));
+        }
+    }
+
+    private boolean testCompilation(String srcDir, String dstDir) {
+        try {
+            srcDir = srcDir.replace('/', File.separatorChar);
+            dstDir = dstDir.replace('/', File.separatorChar);
+            tb.writeFile(Paths.get(srcDir, "pkg", "A.java"), "package pkg; class A {}");
+            compile("--state-dir=state", "-src", srcDir, "-d", dstDir);
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+}