"},
- // Test for 4664607
- {BUG_ID + FS + "pkg" + FS + "I.html",
- "" + NL +
- "" + NL + ""}
- };
- private static final String[][] NEGATED_TEST = NO_TEST;
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNavagation tester = new TestNavagation();
- run(tester, ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getBugId() {
- return BUG_ID;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getBugName() {
- return getClass().getName();
- }
-}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavagation/pkg/A.java
--- a/test/com/sun/javadoc/testNavagation/pkg/A.java Fri Aug 30 10:17:10 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package pkg;
-
-/**
- * Sample Annotation Type.
- */
-public @interface A {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavagation/pkg/C.java
--- a/test/com/sun/javadoc/testNavagation/pkg/C.java Fri Aug 30 10:17:10 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package pkg;
-
-/**
- * Sample Class.
- */
-public class C {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavagation/pkg/E.java
--- a/test/com/sun/javadoc/testNavagation/pkg/E.java Fri Aug 30 10:17:10 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package pkg;
-
-/**
- * Sample Enum.
- */
-public enum E {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavagation/pkg/I.java
--- a/test/com/sun/javadoc/testNavagation/pkg/I.java Fri Aug 30 10:17:10 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
-package pkg;
-
-/**
- * Sample Interface.
- */
-public interface I {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavigation/TestNavigation.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/TestNavigation.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2003, 2013, 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 4131628 4664607 7025314
+ * @summary Make sure the Next/Prev Class links iterate through all types.
+ * Make sure the navagation is 2 columns, not 3.
+ * @author jamieh
+ * @library ../lib/
+ * @build JavadocTester
+ * @build TestNavigation
+ * @run main TestNavigation
+ */
+
+public class TestNavigation extends JavadocTester {
+
+ //Test information.
+ private static final String BUG_ID = "4131628-4664607";
+
+ //Javadoc arguments.
+ private static final String[] ARGS = new String[] {
+ "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+ };
+
+ //Input for string search tests.
+ private static final String[][] TEST = {
+ {BUG_ID + FS + "pkg" + FS + "A.html", "
"},
+ // Test for 4664607
+ {BUG_ID + FS + "pkg" + FS + "I.html",
+ "" + NL +
+ "" + NL + ""}
+ };
+ private static final String[][] NEGATED_TEST = NO_TEST;
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) {
+ TestNavigation tester = new TestNavigation();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavigation/pkg/A.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/A.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, 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.
+ */
+
+package pkg;
+
+/**
+ * Sample Annotation Type.
+ */
+public @interface A {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavigation/pkg/C.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/C.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, 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.
+ */
+
+package pkg;
+
+/**
+ * Sample Class.
+ */
+public class C {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavigation/pkg/E.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/E.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, 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.
+ */
+
+package pkg;
+
+/**
+ * Sample Enum.
+ */
+public enum E {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/com/sun/javadoc/testNavigation/pkg/I.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNavigation/pkg/I.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2003, 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.
+ */
+
+package pkg;
+
+/**
+ * Sample Interface.
+ */
+public interface I {}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/doclint/html/ListTagsTest.java
--- a/test/tools/doclint/html/ListTagsTest.java Fri Aug 30 10:17:10 2013 +0100
+++ b/test/tools/doclint/html/ListTagsTest.java Fri Sep 06 10:05:08 2013 +0100
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 8006251 8013405
+ * @bug 8006251 8013405 8022173
* @summary test list tags
* @library ..
* @build DocLintTester
@@ -15,6 +15,7 @@
*
abc
*
bad
*
bad
+ *
bad
*
abc
*/
public void supportedTags() { }
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/doclint/html/OtherTagsTest.java
--- a/test/tools/doclint/html/OtherTagsTest.java Fri Aug 30 10:17:10 2013 +0100
+++ b/test/tools/doclint/html/OtherTagsTest.java Fri Sep 06 10:05:08 2013 +0100
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 8006251
+ * @bug 8006251 8022173
* @summary test other tags
* @library ..
* @build DocLintTester
@@ -14,6 +14,7 @@
*
*
*
+ *
*
*
*
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/doclint/html/OtherTagsTest.out
--- a/test/tools/doclint/html/OtherTagsTest.out Fri Aug 30 10:17:10 2013 +0100
+++ b/test/tools/doclint/html/OtherTagsTest.out Fri Sep 06 10:05:08 2013 +0100
@@ -10,19 +10,19 @@
OtherTagsTest.java:16: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:17: error: element not allowed in documentation comments:
+OtherTagsTest.java:18: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:18: error: element not allowed in documentation comments:
+OtherTagsTest.java:19: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:19: error: element not allowed in documentation comments:
+OtherTagsTest.java:20: error: element not allowed in documentation comments:
*
^
-OtherTagsTest.java:20: error: element not allowed in documentation comments:
^
-OtherTagsTest.java:21: error: element not allowed in documentation comments:
+OtherTagsTest.java:22: error: element not allowed in documentation comments:
*
^
9 errors
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/doclint/html/TableTagsTest.java
--- a/test/tools/doclint/html/TableTagsTest.java Fri Aug 30 10:17:10 2013 +0100
+++ b/test/tools/doclint/html/TableTagsTest.java Fri Sep 06 10:05:08 2013 +0100
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8006251
+ * @bug 8006251 8022173
* @summary test table tags
* @library ..
* @build DocLintTester
@@ -39,6 +39,7 @@
*
*
*
+ *
*/
public void supportedTags() { }
}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/javac/7118412/ShadowingTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7118412/ShadowingTest.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2013, 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 7118412
+ * @summary Shadowing of type-variables vs. member types
+ */
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class ShadowingTest {
+
+ // We generate a method "test" that tries to call T.. This controls whether
+ // "test" is static or not.
+ private enum MethodContext {
+ STATIC("static "),
+ INSTANCE("");
+
+ public final String methodcontext;
+
+ MethodContext(final String methodcontext) {
+ this.methodcontext = methodcontext;
+ }
+ }
+
+ // These control whether or not a type parameter, method type
+ // parameter, or inner class get declared (and in the case of
+ // inner classes, whether it's static or not.
+
+ private enum MethodTypeParameterDecl {
+ NO(""),
+ YES(" ");
+
+ public final String tyvar;
+
+ MethodTypeParameterDecl(final String tyvar) {
+ this.tyvar = tyvar;
+ }
+ }
+
+ private enum InsideDef {
+ NONE(""),
+ STATIC("static class T { public void inner() {} }\n"),
+ INSTANCE("class T { public void inner() {} }\n");
+
+ public final String instancedef;
+
+ InsideDef(final String instancedef) {
+ this.instancedef = instancedef;
+ }
+ }
+
+ private enum TypeParameterDecl {
+ NO(""),
+ YES("");
+
+ public final String tyvar;
+
+ TypeParameterDecl(final String tyvar) {
+ this.tyvar = tyvar;
+ }
+ }
+
+ // Represents what method we try to call. This is a way of
+ // checking which T we're seeing.
+ private enum MethodCall {
+ // Method type variables extend Number, so we have intValue
+ METHOD_TYPEVAR("intValue"),
+ // The inner class declaration has a method called "inner"
+ INNER_CLASS("inner"),
+ // The class type variables extend Collection, so we call iterator
+ TYPEVAR("iterator"),
+ // The outer class declaration has a method called "outer"
+ OUTER_CLASS("outer");
+
+ public final String methodcall;
+
+ MethodCall(final String methodcall) {
+ this.methodcall = methodcall;
+ }
+
+ }
+
+ public boolean succeeds(final MethodCall call,
+ final MethodTypeParameterDecl mtyvar,
+ final MethodContext ctx,
+ final InsideDef inside,
+ final TypeParameterDecl tyvar) {
+ switch(call) {
+ // We want to resolve to the method type variable
+ case METHOD_TYPEVAR: switch(mtyvar) {
+ // If the method type variable exists, then T will
+ // resolve to it, and we'll have intValue.
+ case YES: return true;
+ // Otherwise, this cannot succeed.
+ default: return false;
+ }
+ // We want to resolve to the inner class
+ case INNER_CLASS: switch(mtyvar) {
+ // The method type parameter will shadow the inner
+ // class, so there can't be one.
+ case NO: switch(ctx) {
+ // If we're not static, then either one should succeed.
+ case INSTANCE: switch(inside) {
+ case INSTANCE:
+ case STATIC:
+ return true;
+ default: return false;
+ }
+ case STATIC: switch(inside) {
+ // If we are static, and the inner class is
+ // static, then we also succeed, because we
+ // can't see the type variable.
+ case STATIC: return true;
+ case INSTANCE: switch(tyvar) {
+ // If we're calling from a non-static
+ // context, there can't be a class type
+ // variable, because that will shadow the
+ // static inner class definition.
+ case NO: return true;
+ default: return false;
+ }
+ // If the inner class isn't declared, we can't
+ // see it.
+ default: return false;
+ }
+ // Can't get here.
+ default: return false;
+ }
+ default: return false;
+ }
+ // We want to resolve to the class type parameter
+ case TYPEVAR: switch(mtyvar) {
+ // We can't have a method type parameter, as that would
+ // shadow the class type parameter
+ case NO: switch(ctx) {
+ case INSTANCE: switch(inside) {
+ // We have to be in an instance context. If
+ // we're static, we can't see the type
+ // variable.
+ case NONE: switch(tyvar) {
+ // Obviously, the type parameter has to be declared.
+ case YES: return true;
+ default: return false;
+ }
+ default: return false;
+ }
+ default: return false;
+ }
+ default: return false;
+ }
+ // We want to resolve to the outer class
+ case OUTER_CLASS: switch(mtyvar) {
+ case NO: switch(inside) {
+ case NONE: switch(tyvar) {
+ // Basically, nothing else can be declared, or
+ // else we can't see it. Even if our context
+ // is static, the compiler will complain if
+ // non-static T's exist, because they will
+ // shadow the outer class.
+ case NO: return true;
+ default: return false;
+ }
+ default: return false;
+ }
+ default: return false;
+ }
+ }
+ return false;
+ }
+
+ private static final File classesdir = new File("7118412");
+
+ private int errors = 0;
+
+ private int dirnum = 0;
+
+ private void doTest(final MethodTypeParameterDecl mtyvar,
+ final TypeParameterDecl tyvar,
+ final InsideDef insidedef, final MethodContext ctx,
+ final MethodCall call)
+ throws IOException {
+ final String content = "import java.util.Collection;\n" +
+ "class Test" + tyvar.tyvar + " {\n" +
+ " " + insidedef.instancedef +
+ " " + ctx.methodcontext + mtyvar.tyvar + "void test(T t) { t." +
+ call.methodcall + "(); }\n" +
+ "}\n" +
+ "class T { void outer() {} }\n";
+ final File dir = new File(classesdir, "" + dirnum);
+ final File Test_java = writeFile(dir, "Test.java", content);
+ dirnum++;
+ if(succeeds(call, mtyvar, ctx, insidedef, tyvar)) {
+ if(!assert_compile_succeed(Test_java))
+ System.err.println("Failed file:\n" + content);
+ }
+ else {
+ if(!assert_compile_fail(Test_java))
+ System.err.println("Failed file:\n" + content);
+ }
+ }
+
+ private void run() throws Exception {
+ classesdir.mkdir();
+ for(MethodTypeParameterDecl mtyvar : MethodTypeParameterDecl.values())
+ for(TypeParameterDecl tyvar : TypeParameterDecl.values())
+ for(InsideDef insidedef : InsideDef.values())
+ for(MethodContext ctx : MethodContext.values())
+ for(MethodCall methodcall : MethodCall.values())
+ doTest(mtyvar, tyvar, insidedef, ctx, methodcall);
+ if (errors != 0)
+ throw new Exception("ShadowingTest test failed with " +
+ errors + " errors.");
+ }
+
+ private boolean assert_compile_fail(final File file) {
+ final String filename = file.getPath();
+ final String[] args = { filename };
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ final int rc = com.sun.tools.javac.Main.compile(args, pw);
+ pw.close();
+ if (rc == 0) {
+ System.err.println("Compilation of " + file.getName() +
+ " didn't fail as expected.");
+ errors++;
+ return false;
+ } else return true;
+ }
+
+ private boolean assert_compile_succeed(final File file) {
+ final String filename = file.getPath();
+ final String[] args = { filename };
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ final int rc = com.sun.tools.javac.Main.compile(args, pw);
+ pw.close();
+ if (rc != 0) {
+ System.err.println("Compilation of " + file.getName() +
+ " didn't succeed as expected. Output:");
+ System.err.println(sw.toString());
+ errors++;
+ return false;
+ } else return true;
+ }
+
+ private File writeFile(final File dir,
+ final String path,
+ final String body) throws IOException {
+ final File f = new File(dir, path);
+ f.getParentFile().mkdirs();
+ final FileWriter out = new FileWriter(f);
+ out.write(body);
+ out.close();
+ return f;
+ }
+
+ public static void main(String... args) throws Exception {
+ new ShadowingTest().run();
+ }
+
+}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/javac/8015701/AnonymousParameters.java
--- a/test/tools/javac/8015701/AnonymousParameters.java Fri Aug 30 10:17:10 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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 8015701
- * @summary javac should generate method parameters correctly.
- * @compile -parameters AnonymousParameters.java
- * @run main AnonymousParameters
- */
-import java.lang.Class;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Parameter;
-import java.util.concurrent.Callable;
-
-public class AnonymousParameters {
-
- String[] names = {
- "this$0",
- "val$message"
- };
-
- public static void main(String... args) throws Exception {
- new AnonymousParameters().run();
- }
-
- void run() throws Exception {
- Class> cls = new ParameterNames().makeInner("hello").getClass();
- Constructor> ctor = cls.getDeclaredConstructors()[0];
- Parameter[] params = ctor.getParameters();
-
- if(params.length == 2) {
- for(int i = 0; i < 2; i++) {
- System.err.println("Testing parameter " + params[i].getName());
- if(!params[i].getName().equals(names[i]))
- error("Expected parameter name " + names[i] +
- " got " + params[i].getName());
- }
- } else
- error("Expected 2 parameters");
-
- if(0 != errors)
- throw new Exception("MethodParameters test failed with " +
- errors + " errors");
- }
-
- void error(String msg) {
- System.err.println("Error: " + msg);
- errors++;
- }
-
- int errors;
-}
-
-class ParameterNames {
-
- public Callable makeInner(final String message) {
- return new Callable() {
- public String call() throws Exception {
- return message;
- }
- };
- }
-
- public static void main(String... args) throws Exception {
- ParameterNames test = new ParameterNames();
- System.out.println(test.makeInner("Hello").call());
- }
-}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/javac/MethodParameters/CaptureTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/CaptureTest.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2012, 2013, 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 8015701
+ * @summary Test method parameter attribute generation with captured locals.
+ * @compile -parameters CaptureTest.java
+ * @run main CaptureTest
+ */
+import java.lang.Class;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Parameter;
+import java.lang.reflect.Modifier;
+import java.util.List;
+import java.util.ArrayList;
+
+public class CaptureTest {
+
+ private static final int SYNTHETIC = 0x1000;
+ private static final int MANDATED = 0x8000;
+
+ public static void main(String... args) throws Exception {
+ new CaptureTest().run();
+ }
+
+
+ private void run() throws Exception {
+ final Encloser pn = new Encloser();
+
+ /* Cases covered here:
+ *
+ * - Local class
+ * - Inner class
+ * - Anonymous class
+ * - Anonymous class extending a local
+ * - Anonymous class extending an inner
+ */
+ pn.makeLocal("hello").check();
+ pn.makeInner("hello").check();
+ pn.makeAnon("hello").check();
+ pn.makeAnonExtendsLocal("hello").check();
+ pn.makeAnonExtendsInner("hello").check();
+
+ if (0 != errors)
+ throw new Exception("MethodParameters test failed with " +
+ errors + " errors");
+ }
+
+ private void error(final String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+
+ abstract class Tester {
+
+ public Tester(final int param) {}
+
+ protected abstract String[] names();
+ protected abstract int[] modifiers();
+ protected abstract Class[] types();
+
+ public void check() {
+ final Class> cls = this.getClass();
+ final Constructor> ctor = cls.getDeclaredConstructors()[0];
+ final Parameter[] params = ctor.getParameters();
+ final String[] names = names();
+ final int[] modifiers = modifiers();
+ final Class[] types = types();
+
+ System.err.println("Testing class " + cls);
+
+ if (params.length == names.length) {
+ for (int i = 0; i < names.length; i++) {
+ System.err.println("Testing parameter " + params[i].getName());
+ if (!params[i].getName().equals(names[i]))
+ error("Expected parameter name " + names[i] +
+ " got " + params[i].getName());
+ if (params[i].getModifiers() != modifiers[i])
+ error("Expected parameter modifiers " +
+ modifiers[i] + " got " +
+ params[i].getModifiers());
+ if (!params[i].getType().equals(types[i]))
+ error("Expected parameter type " + types[i] +
+ " got " + params[i].getType());
+ }
+ } else
+ error("Expected " + names.length + " parameters");
+
+ }
+
+ }
+
+ class Encloser {
+ private class InnerTester extends Tester {
+ public InnerTester(final int innerparam) {
+ super(innerparam);
+ }
+
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "innerparam"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | SYNTHETIC,
+ Modifier.FINAL
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class
+ };
+ }
+ }
+
+ public Tester makeInner(final String message) {
+ return new InnerTester(2);
+ }
+
+ public Tester makeLocal(final String message) {
+ class LocalTester extends Tester {
+ public LocalTester(final int localparam) {
+ super(localparam);
+ }
+
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "localparam",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ public String message() {
+ return message;
+ }
+ }
+
+ return new LocalTester(2);
+ }
+
+ public Tester makeAnonExtendsLocal(final String message) {
+ abstract class LocalTester extends Tester {
+ public LocalTester(final int localparam) {
+ super(localparam);
+ }
+
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "localparam",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ }
+
+ return new LocalTester(2) {
+ public String message() {
+ return message;
+ }
+ };
+ }
+
+ public Tester makeAnonExtendsInner(final String message) {
+ return new InnerTester(2) {
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "innerparam",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ public String message() {
+ return message;
+ }
+ };
+ }
+
+ public Tester makeAnon(final String message) {
+ return new Tester(2) {
+ protected String[] names() {
+ return new String[] {
+ "this$1",
+ "param",
+ "val$message"
+ };
+ }
+
+ protected int[] modifiers() {
+ return new int[] {
+ Modifier.FINAL | MANDATED,
+ Modifier.FINAL,
+ Modifier.FINAL | SYNTHETIC
+ };
+ }
+
+ protected Class[] types() {
+ return new Class[] {
+ Encloser.class,
+ int.class,
+ String.class
+ };
+ }
+
+ public String message() {
+ return message;
+ }
+ };
+ }
+ }
+}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2013, 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 8022316
+ * @summary Generic throws, overriding and method reference
+ * @compile/fail/ref=CompilerErrorGenericThrowPlusMethodRefTest.out -XDrawDiagnostics CompilerErrorGenericThrowPlusMethodRefTest.java
+ */
+
+@SuppressWarnings("unchecked")
+public class CompilerErrorGenericThrowPlusMethodRefTest {
+ interface SAM11 {
+ public void foo() throws E ;
+ }
+
+ interface SAM12 extends SAM11{
+ @Override
+ public void foo() throws Throwable;
+ }
+
+ public void boo() throws RuntimeException {}
+
+ static void test1() {
+ try {
+ SAM12 s2 = new CompilerErrorGenericThrowPlusMethodRefTest()::boo;
+ s2.foo();
+ } catch(Throwable ex) {}
+ }
+
+ static void test2() {
+ SAM11 s1 = null;
+ s1.foo();
+ s1.foo();
+ }
+
+ interface SAM21 {
+ void m(E arg) throws E;
+ }
+
+ interface SAM22 {
+ void m(F arg) throws F;
+ }
+
+ interface SAM23 extends SAM21, SAM22 {}
+
+ public void bar(E e) throws E {}
+
+ static void test3(E e) {
+ try {
+ SAM23 s2 = new CompilerErrorGenericThrowPlusMethodRefTest()::bar;
+ s2.m(e);
+ } catch(Exception ex) {}
+ }
+
+}
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8022316/CompilerErrorGenericThrowPlusMethodRefTest.out Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,2 @@
+CompilerErrorGenericThrowPlusMethodRefTest.java:55:26: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
+1 error
diff -r a8f0c3583a86 -r 6250a7f0aba6 test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java Fri Sep 06 10:05:08 2013 +0100
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2013, 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 8023112
+ * @summary Mixing up the method type argument with the class type for method
+ * reference ClassType::new
+ * @compile SkipLazyConstantCreationForMethodRefTest.java
+ */
+
+public class SkipLazyConstantCreationForMethodRefTest {
+ SkipLazyConstantCreationForMethodRefTest(int a, boolean b) {}
+ SkipLazyConstantCreationForMethodRefTest() {}
+}
+
+class SubClass extends SkipLazyConstantCreationForMethodRefTest {
+ SubClass(int a, boolean b) {}
+}
+
+interface SAM {
+ SubClass m(int a, boolean b);
+}
+
+interface Tester1 {
+ SAM s11 = SubClass::