--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Jun 18 10:24:20 2015 -0700
@@ -4140,7 +4140,12 @@
public void visitAnnotatedType(JCAnnotatedType tree) {
attribAnnotationTypes(tree.annotations, env);
- Type underlyingType = attribType(tree.underlyingType, env);
+ JCExpression underlyingTypeTree = tree.getUnderlyingType();
+ Type underlyingType = attribTree(underlyingTypeTree, env,
+ new ResultInfo(KindSelector.TYP_PCK, Type.noType));
+ if (!chk.checkAnnotableType(underlyingType, tree.annotations, underlyingTypeTree.pos())) {
+ underlyingType = underlyingTypeTree.type = syms.errType;
+ }
Type annotatedType = underlyingType.annotatedType(Annotations.TO_BE_SET);
if (!env.info.isNewClass)
@@ -4631,16 +4636,7 @@
}
} else if (enclTr.hasTag(ANNOTATED_TYPE)) {
JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
- if (enclTy == null || enclTy.hasTag(NONE)) {
- if (at.getAnnotations().size() == 1) {
- log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
- } else {
- ListBuffer<Attribute.Compound> comps = new ListBuffer<>();
- for (JCAnnotation an : at.getAnnotations()) {
- comps.add(an.attribute);
- }
- log.error(at.underlyingType.pos(), "cant.type.annotate.scoping", comps.toList());
- }
+ if (!chk.checkAnnotableType(enclTy, at.getAnnotations(), at.underlyingType.pos())) {
repeat = false;
}
enclTr = at.underlyingType;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Jun 18 10:24:20 2015 -0700
@@ -62,6 +62,8 @@
import static com.sun.tools.javac.code.TypeTag.*;
import static com.sun.tools.javac.code.TypeTag.WILDCARD;
+import static com.sun.tools.javac.resources.CompilerProperties.Errors.CantTypeAnnotateScoping;
+import static com.sun.tools.javac.resources.CompilerProperties.Errors.CantTypeAnnotateScoping1;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
/** Type checking helper class for the attribution phase.
@@ -2691,6 +2693,29 @@
* Check annotations
**************************************************************************/
+ /** Verify that a component of a qualified type name being type annotated
+ * can indeed be legally be annotated. For example, package names and type
+ * names used to access static members cannot be annotated.
+ *
+ * @param typeComponent the component of the qualified name being annotated
+ * @param annotations the annotations
+ * @param pos diagnostic position
+ * @return true if all is swell, false otherwise.
+ */
+ boolean checkAnnotableType(Type typeComponent, List<JCAnnotation> annotations, DiagnosticPosition pos) {
+ if (typeComponent == null || typeComponent.hasTag(PACKAGE) || typeComponent.hasTag(NONE)) {
+ ListBuffer<Symbol> lb = new ListBuffer<>();
+ for (JCAnnotation annotation : annotations) {
+ lb.append(annotation.annotationType.type.tsym);
+ }
+ List<Symbol> symbols = lb.toList();
+ log.error(pos,
+ symbols.size() > 1 ? CantTypeAnnotateScoping(symbols)
+ : CantTypeAnnotateScoping1(symbols.get(0)));
+ return false;
+ }
+ return true;
+ }
/**
* Recursively validate annotations values
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,12 +1,12 @@
/*
* @test /nodynamiccopyright/
- * @bug 8026564
+ * @bug 8026564 8074346
* @summary The parts of a fully-qualified type can't be annotated.
* @author Werner Dietl
- * @ignore 8057679 clarify error messages trying to annotate scoping
* @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
*/
+
import java.lang.annotation.*;
import java.util.List;
@@ -21,6 +21,8 @@
java. @TA lang.Object of3;
List<java. @TA lang.Object> of4;
+ List<@CantAnnotatePackages_TB java.lang.Object> of5; // test that we do reasonable things for missing types.
+
// TODO: also note the order of error messages.
}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.out Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.out Thu Jun 18 10:24:20 2015 -0700
@@ -1,5 +1,7 @@
-CantAnnotatePackages.java:14:13: compiler.err.cant.type.annotate.scoping.1: @TA
-CantAnnotatePackages.java:19:18: compiler.err.cant.type.annotate.scoping.1: @TA
-CantAnnotatePackages.java:20:19: compiler.err.cant.type.annotate.scoping.1: @TA
-CantAnnotatePackages.java:21:24: compiler.err.cant.type.annotate.scoping.1: @TA
-4 errors
+CantAnnotatePackages.java:20:14: compiler.err.cant.type.annotate.scoping.1: TA
+CantAnnotatePackages.java:21:9: compiler.err.cant.type.annotate.scoping.1: TA
+CantAnnotatePackages.java:22:14: compiler.err.cant.type.annotate.scoping.1: TA
+CantAnnotatePackages.java:24:11: compiler.err.cant.resolve.location: kindname.class, CantAnnotatePackages_TB, , , (compiler.misc.location: kindname.class, CantAnnotatePackages, null)
+CantAnnotatePackages.java:24:35: compiler.err.cant.type.annotate.scoping.1: CantAnnotatePackages_TB
+CantAnnotatePackages.java:15:18: compiler.err.cant.type.annotate.scoping.1: @TA
+6 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/T8074346.java Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,18 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8074346
+ * @author sadayapalam
+ * @summary Test that type annotation on a qualified type doesn't cause spurious 'cannot find symbol' errors
+ * @compile/fail/ref=T8074346.out -XDrawDiagnostics T8074346.java
+*/
+
+abstract class T8074346 implements
+ @T8074346_TA @T8074346_TB java.util.Map<@T8074346_TA java.lang.String, java.lang.@T8074346_TA String>,
+ java.util.@T8074346_TA List {
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE)
+@interface T8074346_TA { }
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE)
+@interface T8074346_TB { }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/T8074346.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,3 @@
+T8074346.java:10:35: compiler.err.cant.type.annotate.scoping: T8074346_TA,T8074346_TB
+T8074346.java:10:62: compiler.err.cant.type.annotate.scoping.1: T8074346_TA
+2 errors
\ No newline at end of file
--- a/langtools/test/tools/javac/generics/typeargs/Metharg1.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Metharg1.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,33 +1,10 @@
/*
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 4851039
* @summary explicit type arguments
* @author gafter
*
- * @compile/fail Metharg1.java
+ * @compile/fail/ref=Metharg1.out -XDrawDiagnostics Metharg1.java
*/
// Test type mismatch on type argument for method call
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typeargs/Metharg1.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+Metharg1.java:33:13: compiler.err.cant.apply.symbol: kindname.method, f, K, java.lang.String, kindname.class, T<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer))
+1 error
--- a/langtools/test/tools/javac/generics/typeargs/Metharg2.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Metharg2.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,33 +1,10 @@
/*
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 4851039
* @summary explicit type arguments
* @author gafter
*
- * @compile/fail Metharg2.java
+ * @compile/fail/ref=Metharg2.out -XDrawDiagnostics Metharg2.java
*/
// Test type mismatch on type argument for qualified method call
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typeargs/Metharg2.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+Metharg2.java:39:10: compiler.err.cant.apply.symbol: kindname.method, f, K, java.lang.String, kindname.class, T<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer))
+1 error
--- a/langtools/test/tools/javac/generics/typeargs/Newarg1.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Newarg1.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,33 +1,10 @@
/*
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 4851039
* @summary explicit type arguments
* @author gafter
*
- * @compile/fail Newarg1.java
+ * @compile/fail/ref=Newarg1.out -XDrawDiagnostics Newarg1.java
*/
// Test type mismatch on type argument for constructor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typeargs/Newarg1.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+Newarg1.java:18:9: compiler.err.cant.apply.symbol: kindname.constructor, T, K, java.lang.String, kindname.class, T<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer))
+1 error
--- a/langtools/test/tools/javac/generics/typeargs/Newarg2.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Newarg2.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,33 +1,10 @@
/*
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 4851039
* @summary explicit type arguments
* @author gafter
*
- * @compile/fail Newarg2.java
+ * @compile/fail/ref=Newarg2.out -XDrawDiagnostics Newarg2.java
*/
// Test type mismatch on type argument for inner constructor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typeargs/Newarg2.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+Newarg2.java:19:17: compiler.err.cant.apply.symbol: kindname.constructor, U, B, java.lang.String, kindname.class, T.U<Y>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer))
+1 error
--- a/langtools/test/tools/javac/generics/typeargs/Superarg1.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Superarg1.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,33 +1,10 @@
/*
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 4851039
* @summary explicit type arguments
* @author gafter
*
- * @compile/fail Superarg1.java
+ * @compile/fail/ref=Superarg1.out -XDrawDiagnostics Superarg1.java
*/
// Test type mismatch on type argument for super constructor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typeargs/Superarg1.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+Superarg1.java:16:13: compiler.err.cant.apply.symbol: kindname.constructor, T, A, java.lang.String, kindname.class, T<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer))
+1 error
--- a/langtools/test/tools/javac/generics/typeargs/Superarg2.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/Superarg2.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,33 +1,10 @@
/*
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 4851039
* @summary explicit type arguments
* @author gafter
*
- * @compile/fail Superarg2.java
+ * @compile/fail/ref=Superarg2.out -XDrawDiagnostics Superarg2.java
*/
// Test type mismatch on type argument for inner super constructor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typeargs/Superarg2.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+Superarg2.java:25:14: compiler.err.cant.apply.symbols: kindname.constructor, U, java.lang.String,{(compiler.misc.inapplicable.method: kindname.constructor, T.U, <B>T.U(B), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer))),(compiler.misc.inapplicable.method: kindname.constructor, T.U, T.U(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, int)))}
+1 error
--- a/langtools/test/tools/javac/generics/typeargs/ThisArg.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typeargs/ThisArg.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,33 +1,10 @@
/*
- * 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.
- */
-
-/*
- * @test
+ * @test /nodynamiccopyright/
* @bug 4851039
* @summary explicit type arguments
* @author gafter
*
- * @compile/fail ThisArg.java
+ * @compile/fail/ref=ThisArg.out -XDrawDiagnostics ThisArg.java
*/
// Test type mismatch on type argument for this constructor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typeargs/ThisArg.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+ThisArg.java:19:13: compiler.err.cant.apply.symbols: kindname.constructor, U, java.lang.String,{(compiler.misc.inapplicable.method: kindname.constructor, T.U, <B>T.U(B), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer))),(compiler.misc.inapplicable.method: kindname.constructor, T.U, T.U(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, int)))}
+1 error
--- a/langtools/test/tools/javac/generics/typevars/4856983/T4856983.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, 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
--- a/langtools/test/tools/javac/generics/typevars/4856983/T4856983a.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983a.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,32 +1,9 @@
/*
- * Copyright (c) 2004, 2006, 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
+ * @test /nodynamiccopyright/
* @bug 4856983
* @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
* @author Peter von der Ah\u00e9
- * @compile/fail T4856983a.java
+ * @compile/fail/ref=T4856983a.out -XDrawDiagnostics T4856983a.java
*/
interface I1 { Number m(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983a.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+T4856983a.java:13:6: compiler.err.types.incompatible.diff.ret: I2, I1, m()
+1 error
--- a/langtools/test/tools/javac/generics/typevars/4856983/T4856983b.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983b.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,32 +1,9 @@
/*
- * Copyright (c) 2004, 2006, 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
+ * @test /nodynamiccopyright/
* @bug 4856983
* @summary (crash) mutually f-bounded type vars with multiple bounds may crash javac
* @author Peter von der Ah\u00e9
- * @compile/fail T4856983b.java
+ * @compile/fail/ref=T4856983b.out -XDrawDiagnostics T4856983b.java
*/
interface I1 { Number m(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/4856983/T4856983b.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,2 @@
+T4856983b.java:12:24: compiler.err.types.incompatible.diff.ret: I2, I1, m()
+1 error
--- a/langtools/test/tools/javac/generics/typevars/6182630/T6182630.java Thu Jun 18 01:43:17 2015 -0700
+++ b/langtools/test/tools/javac/generics/typevars/6182630/T6182630.java Thu Jun 18 10:24:20 2015 -0700
@@ -1,39 +1,9 @@
/*
- * Copyright (c) 2004, 2006, 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
+ * @test /nodynamiccopyright/
* @bug 6182630
* @summary Method with parameter bound to raw type avoids unchecked warning
* @author Peter von der Ah\u00e9
- * @compile -Xlint:unchecked T6182630.java
- * @compile/fail -Werror -Xlint:unchecked T6182630.java
- * @compile/fail -Werror -Xlint:unchecked T6182630a.java
- * @compile/fail -Werror -Xlint:unchecked T6182630b.java
- * @compile/fail -Werror -Xlint:unchecked T6182630c.java
- * @compile/fail -Werror -Xlint:unchecked T6182630d.java
- * @compile/fail -Werror -Xlint:unchecked T6182630e.java
- * @compile/fail -Werror -Xlint:unchecked T6182630f.java
+ * @compile/ref=T6182630.out -XDrawDiagnostics -Xlint:unchecked T6182630.java
*/
public class T6182630 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6182630/T6182630.out Thu Jun 18 10:24:20 2015 -0700
@@ -0,0 +1,7 @@
+T6182630.java:16:10: compiler.warn.unchecked.assign.to.var: x, T6182630.Foo
+T6182630.java:17:12: compiler.warn.unchecked.call.mbr.of.raw.type: m(X), T6182630.Foo
+T6182630.java:18:12: compiler.warn.unchecked.call.mbr.of.raw.type: m(X), T6182630.Foo
+T6182630.java:19:10: compiler.warn.unchecked.assign.to.var: x, T6182630.Foo
+T6182630.java:20:12: compiler.warn.unchecked.call.mbr.of.raw.type: m(X), T6182630.Foo
+T6182630.java:21:12: compiler.warn.unchecked.call.mbr.of.raw.type: m(X), T6182630.Foo
+6 warnings
--- a/langtools/test/tools/javac/generics/typevars/6182630/T6182630a.java Thu Jun 18 01:43:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-public class T6182630a {
- static class Foo<X> {
- public X x;
- public void m(X x) { }
- }
- interface Bar {}
- <T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
- t.x = "BAD";
- }
-}
--- a/langtools/test/tools/javac/generics/typevars/6182630/T6182630b.java Thu Jun 18 01:43:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-public class T6182630b {
- static class Foo<X> {
- public X x;
- public void m(X x) { }
- }
- interface Bar {}
- <T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
- t.m("BAD");
- }
-}
--- a/langtools/test/tools/javac/generics/typevars/6182630/T6182630c.java Thu Jun 18 01:43:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-public class T6182630c {
- static class Foo<X> {
- public X x;
- public void m(X x) { }
- }
- interface Bar {}
- <T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
- t.m(t.x);
- }
-}
--- a/langtools/test/tools/javac/generics/typevars/6182630/T6182630d.java Thu Jun 18 01:43:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-public class T6182630d {
- static class Foo<X> {
- public X x;
- public void m(X x) { }
- }
- interface Bar {}
- <T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
- s.x = "BAD";
- }
-}
--- a/langtools/test/tools/javac/generics/typevars/6182630/T6182630e.java Thu Jun 18 01:43:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-public class T6182630e {
- static class Foo<X> {
- public X x;
- public void m(X x) { }
- }
- interface Bar {}
- <T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
- s.m("BAD");
- }
-}
--- a/langtools/test/tools/javac/generics/typevars/6182630/T6182630f.java Thu Jun 18 01:43:17 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-public class T6182630f {
- static class Foo<X> {
- public X x;
- public void m(X x) { }
- }
- interface Bar {}
- <T extends Foo, S extends Foo & Bar> void test1(T t, S s) {
- s.m(s.x);
- }
-}