Fri, 31 Jan 2014 10:46:23 +0000
Merge
1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Jan 31 00:14:57 2014 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Jan 31 10:46:23 2014 +0000 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -4653,10 +4653,19 @@ 1.11 1.12 private void initTypeIfNeeded(JCTree that) { 1.13 if (that.type == null) { 1.14 - that.type = syms.unknownType; 1.15 + if (that.hasTag(METHODDEF)) { 1.16 + that.type = dummyMethodType(); 1.17 + } else { 1.18 + that.type = syms.unknownType; 1.19 + } 1.20 } 1.21 } 1.22 1.23 + private Type dummyMethodType() { 1.24 + return new MethodType(List.<Type>nil(), syms.unknownType, 1.25 + List.<Type>nil(), syms.methodClass); 1.26 + } 1.27 + 1.28 @Override 1.29 public void scan(JCTree tree) { 1.30 if (tree == null) return; 1.31 @@ -4712,7 +4721,8 @@ 1.32 @Override 1.33 public void visitNewClass(JCNewClass that) { 1.34 if (that.constructor == null) { 1.35 - that.constructor = new MethodSymbol(0, names.init, syms.unknownType, syms.noSymbol); 1.36 + that.constructor = new MethodSymbol(0, names.init, 1.37 + dummyMethodType(), syms.noSymbol); 1.38 } 1.39 if (that.constructorType == null) { 1.40 that.constructorType = syms.unknownType; 1.41 @@ -4722,22 +4732,28 @@ 1.42 1.43 @Override 1.44 public void visitAssignop(JCAssignOp that) { 1.45 - if (that.operator == null) 1.46 - that.operator = new OperatorSymbol(names.empty, syms.unknownType, -1, syms.noSymbol); 1.47 + if (that.operator == null) { 1.48 + that.operator = new OperatorSymbol(names.empty, dummyMethodType(), 1.49 + -1, syms.noSymbol); 1.50 + } 1.51 super.visitAssignop(that); 1.52 } 1.53 1.54 @Override 1.55 public void visitBinary(JCBinary that) { 1.56 - if (that.operator == null) 1.57 - that.operator = new OperatorSymbol(names.empty, syms.unknownType, -1, syms.noSymbol); 1.58 + if (that.operator == null) { 1.59 + that.operator = new OperatorSymbol(names.empty, dummyMethodType(), 1.60 + -1, syms.noSymbol); 1.61 + } 1.62 super.visitBinary(that); 1.63 } 1.64 1.65 @Override 1.66 public void visitUnary(JCUnary that) { 1.67 - if (that.operator == null) 1.68 - that.operator = new OperatorSymbol(names.empty, syms.unknownType, -1, syms.noSymbol); 1.69 + if (that.operator == null) { 1.70 + that.operator = new OperatorSymbol(names.empty, dummyMethodType(), 1.71 + -1, syms.noSymbol); 1.72 + } 1.73 super.visitUnary(that); 1.74 } 1.75 1.76 @@ -4753,7 +4769,8 @@ 1.77 public void visitReference(JCMemberReference that) { 1.78 super.visitReference(that); 1.79 if (that.sym == null) { 1.80 - that.sym = new MethodSymbol(0, names.empty, syms.unknownType, syms.noSymbol); 1.81 + that.sym = new MethodSymbol(0, names.empty, dummyMethodType(), 1.82 + syms.noSymbol); 1.83 } 1.84 if (that.targets == null) { 1.85 that.targets = List.nil();
2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Jan 31 00:14:57 2014 +0000 2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Jan 31 10:46:23 2014 +0000 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -2779,7 +2779,7 @@ 2.11 validateDocumented(t.tsym, s, pos); 2.12 validateInherited(t.tsym, s, pos); 2.13 validateTarget(t.tsym, s, pos); 2.14 - validateDefault(t.tsym, s, pos); 2.15 + validateDefault(t.tsym, pos); 2.16 } 2.17 2.18 private void validateValue(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) { 2.19 @@ -2898,7 +2898,9 @@ 2.20 2.21 2.22 /** Checks that s is a subset of t, with respect to ElementType 2.23 - * semantics, specifically {ANNOTATION_TYPE} is a subset of {TYPE} 2.24 + * semantics, specifically {ANNOTATION_TYPE} is a subset of {TYPE}, 2.25 + * and {TYPE_USE} covers the set {ANNOTATION_TYPE, TYPE, TYPE_USE, 2.26 + * TYPE_PARAMETER}. 2.27 */ 2.28 private boolean isTargetSubsetOf(Set<Name> s, Set<Name> t) { 2.29 // Check that all elements in s are present in t 2.30 @@ -2911,6 +2913,12 @@ 2.31 } else if (n1 == names.TYPE && n2 == names.ANNOTATION_TYPE) { 2.32 currentElementOk = true; 2.33 break; 2.34 + } else if (n1 == names.TYPE_USE && 2.35 + (n2 == names.TYPE || 2.36 + n2 == names.ANNOTATION_TYPE || 2.37 + n2 == names.TYPE_PARAMETER)) { 2.38 + currentElementOk = true; 2.39 + break; 2.40 } 2.41 } 2.42 if (!currentElementOk) 2.43 @@ -2919,7 +2927,7 @@ 2.44 return true; 2.45 } 2.46 2.47 - private void validateDefault(Symbol container, Symbol contained, DiagnosticPosition pos) { 2.48 + private void validateDefault(Symbol container, DiagnosticPosition pos) { 2.49 // validate that all other elements of containing type has defaults 2.50 Scope scope = container.members(); 2.51 for(Symbol elm : scope.getElements()) {
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Jan 31 00:14:57 2014 +0000 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Jan 31 10:46:23 2014 +0000 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -1461,9 +1461,19 @@ 3.11 this.names = names; 3.12 } 3.13 3.14 + private boolean isInitialConstructor = false; 3.15 + 3.16 @Override 3.17 protected void markDead(JCTree tree) { 3.18 - inits.inclRange(returnadr, nextadr); 3.19 + if (!isInitialConstructor) { 3.20 + inits.inclRange(returnadr, nextadr); 3.21 + } else { 3.22 + for (int address = returnadr; address < nextadr; address++) { 3.23 + if (!(isFinalUninitializedStaticField(vardecls[address].sym))) { 3.24 + inits.incl(address); 3.25 + } 3.26 + } 3.27 + } 3.28 uninits.inclRange(returnadr, nextadr); 3.29 } 3.30 3.31 @@ -1476,8 +1486,17 @@ 3.32 return 3.33 sym.pos >= startPos && 3.34 ((sym.owner.kind == MTH || 3.35 - ((sym.flags() & (FINAL | HASINIT | PARAMETER)) == FINAL && 3.36 - classDef.sym.isEnclosedBy((ClassSymbol)sym.owner)))); 3.37 + isFinalUninitializedField(sym))); 3.38 + } 3.39 + 3.40 + boolean isFinalUninitializedField(VarSymbol sym) { 3.41 + return sym.owner.kind == TYP && 3.42 + ((sym.flags() & (FINAL | HASINIT | PARAMETER)) == FINAL && 3.43 + classDef.sym.isEnclosedBy((ClassSymbol)sym.owner)); 3.44 + } 3.45 + 3.46 + boolean isFinalUninitializedStaticField(VarSymbol sym) { 3.47 + return isFinalUninitializedField(sym) && sym.isStatic(); 3.48 } 3.49 3.50 /** Initialize new trackable variable by setting its address field 3.51 @@ -1731,10 +1750,9 @@ 3.52 int returnadrPrev = returnadr; 3.53 3.54 Assert.check(pendingExits.isEmpty()); 3.55 - 3.56 + boolean lastInitialConstructor = isInitialConstructor; 3.57 try { 3.58 - boolean isInitialConstructor = 3.59 - TreeInfo.isInitialConstructor(tree); 3.60 + isInitialConstructor = TreeInfo.isInitialConstructor(tree); 3.61 3.62 if (!isInitialConstructor) { 3.63 firstadr = nextadr; 3.64 @@ -1789,6 +1807,7 @@ 3.65 nextadr = nextadrPrev; 3.66 firstadr = firstadrPrev; 3.67 returnadr = returnadrPrev; 3.68 + isInitialConstructor = lastInitialConstructor; 3.69 } 3.70 } 3.71
4.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Jan 31 00:14:57 2014 +0000 4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Jan 31 10:46:23 2014 +0000 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -96,6 +96,9 @@ 4.11 /** dump statistics about lambda code generation */ 4.12 private boolean dumpLambdaToMethodStats; 4.13 4.14 + /** force serializable representation, for stress testing **/ 4.15 + private final boolean forceSerializable; 4.16 + 4.17 /** Flag for alternate metafactories indicating the lambda object is intended to be serializable */ 4.18 public static final int FLAG_SERIALIZABLE = 1 << 0; 4.19 4.20 @@ -131,6 +134,7 @@ 4.21 Options options = Options.instance(context); 4.22 dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats"); 4.23 attr = Attr.instance(context); 4.24 + forceSerializable = options.isSet("forceSerializable"); 4.25 } 4.26 // </editor-fold> 4.27 4.28 @@ -1694,6 +1698,9 @@ 4.29 4.30 /** does this functional expression require serialization support? */ 4.31 boolean isSerializable() { 4.32 + if (forceSerializable) { 4.33 + return true; 4.34 + } 4.35 for (Type target : tree.targets) { 4.36 if (types.asSuper(target, syms.serializableType.tsym) != null) { 4.37 return true;
5.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Fri Jan 31 00:14:57 2014 +0000 5.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Fri Jan 31 10:46:23 2014 +0000 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -26,11 +26,8 @@ 5.11 package com.sun.tools.javac.processing; 5.12 5.13 import java.lang.annotation.Annotation; 5.14 -import com.sun.tools.javac.tree.JCTree.*; 5.15 import javax.annotation.processing.*; 5.16 import javax.lang.model.element.*; 5.17 -import javax.lang.model.type.DeclaredType; 5.18 -import javax.lang.model.type.TypeMirror; 5.19 import javax.lang.model.util.*; 5.20 import java.util.*; 5.21 5.22 @@ -114,58 +111,48 @@ 5.23 */ 5.24 public Set<? extends Element> getElementsAnnotatedWith(TypeElement a) { 5.25 Set<Element> result = Collections.emptySet(); 5.26 - Types typeUtil = processingEnv.getTypeUtils(); 5.27 if (a.getKind() != ElementKind.ANNOTATION_TYPE) 5.28 throw new IllegalArgumentException(NOT_AN_ANNOTATION_TYPE + a); 5.29 5.30 - DeclaredType annotationTypeElement; 5.31 - TypeMirror tm = a.asType(); 5.32 - if ( tm instanceof DeclaredType ) 5.33 - annotationTypeElement = (DeclaredType) a.asType(); 5.34 - else 5.35 - throw new AssertionError("Bad implementation type for " + tm); 5.36 - 5.37 - ElementScanner8<Set<Element>, DeclaredType> scanner = 5.38 - new AnnotationSetScanner(result, typeUtil); 5.39 + ElementScanner8<Set<Element>, TypeElement> scanner = 5.40 + new AnnotationSetScanner(result); 5.41 5.42 for (Element element : rootElements) 5.43 - result = scanner.scan(element, annotationTypeElement); 5.44 + result = scanner.scan(element, a); 5.45 5.46 return result; 5.47 } 5.48 5.49 // Could be written as a local class inside getElementsAnnotatedWith 5.50 private class AnnotationSetScanner extends 5.51 - ElementScanner8<Set<Element>, DeclaredType> { 5.52 + ElementScanner8<Set<Element>, TypeElement> { 5.53 // Insertion-order preserving set 5.54 Set<Element> annotatedElements = new LinkedHashSet<Element>(); 5.55 - Types typeUtil; 5.56 5.57 - AnnotationSetScanner(Set<Element> defaultSet, Types typeUtil) { 5.58 + AnnotationSetScanner(Set<Element> defaultSet) { 5.59 super(defaultSet); 5.60 - this.typeUtil = typeUtil; 5.61 } 5.62 5.63 @Override 5.64 - public Set<Element> visitType(TypeElement e, DeclaredType p) { 5.65 + public Set<Element> visitType(TypeElement e, TypeElement p) { 5.66 // Type parameters are not considered to be enclosed by a type 5.67 scan(e.getTypeParameters(), p); 5.68 return scan(e.getEnclosedElements(), p); 5.69 } 5.70 5.71 @Override 5.72 - public Set<Element> visitExecutable(ExecutableElement e, DeclaredType p) { 5.73 + public Set<Element> visitExecutable(ExecutableElement e, TypeElement p) { 5.74 // Type parameters are not considered to be enclosed by an executable 5.75 scan(e.getTypeParameters(), p); 5.76 return scan(e.getEnclosedElements(), p); 5.77 } 5.78 5.79 @Override 5.80 - public Set<Element> scan(Element e, DeclaredType p) { 5.81 + public Set<Element> scan(Element e, TypeElement p) { 5.82 java.util.List<? extends AnnotationMirror> annotationMirrors = 5.83 processingEnv.getElementUtils().getAllAnnotationMirrors(e); 5.84 for (AnnotationMirror annotationMirror : annotationMirrors) { 5.85 - if (typeUtil.isSameType(annotationMirror.getAnnotationType(), p)) 5.86 + if (p.equals(annotationMirror.getAnnotationType().asElement())) 5.87 annotatedElements.add(e); 5.88 } 5.89 e.accept(this, p);
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.java Fri Jan 31 10:46:23 2014 +0000 6.3 @@ -0,0 +1,22 @@ 6.4 +/* 6.5 + * @test /nodynamiccopyright/ 6.6 + * @bug 8030816 6.7 + * @summary javac can't compile program with lambda expression 6.8 + * @compile/fail/ref=CrashLambdaExpressionWithNonAccessibleIdTest.out -XDrawDiagnostics CrashLambdaExpressionWithNonAccessibleIdTest.java 6.9 + */ 6.10 + 6.11 +/* This test must make sure that javac won't crash when compiling lambda 6.12 + * containing an anonymous innerclass based on an unresolvable type. 6.13 + */ 6.14 +public class CrashLambdaExpressionWithNonAccessibleIdTest { 6.15 + void m() { 6.16 + m1(()-> { 6.17 + new A(){ 6.18 + public void m11() {} 6.19 + }; 6.20 + }); 6.21 + 6.22 + } 6.23 + 6.24 + void m1(Runnable r) {} 6.25 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out Fri Jan 31 10:46:23 2014 +0000 7.3 @@ -0,0 +1,3 @@ 7.4 +CrashLambdaExpressionWithNonAccessibleIdTest.java:15:35: compiler.err.missing.ret.stmt 7.5 +CrashLambdaExpressionWithNonAccessibleIdTest.java:14:17: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, CrashLambdaExpressionWithNonAccessibleIdTest, null) 7.6 +2 errors
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/8029017/TypeUseTarget.java Fri Jan 31 10:46:23 2014 +0000 8.3 @@ -0,0 +1,129 @@ 8.4 +/* 8.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 + * or visit www.oracle.com if you need additional information or have any 8.24 + * questions. 8.25 + */ 8.26 + 8.27 +/** 8.28 + * @test 8.29 + * @bug 8029017 8.30 + * @summary sanity testing of ElementType validation for repeating annotations 8.31 + * @compile TypeUseTarget.java 8.32 + */ 8.33 + 8.34 +import java.lang.annotation.*; 8.35 + 8.36 +public class TypeUseTarget {} 8.37 + 8.38 + 8.39 +// Case 1: 8.40 +@Target({ 8.41 + ElementType.TYPE_USE, 8.42 +}) 8.43 +@Repeatable(Case1Container.class) 8.44 +@interface Case1 {} 8.45 + 8.46 +@Target({ 8.47 + ElementType.ANNOTATION_TYPE, 8.48 + ElementType.TYPE, 8.49 + ElementType.TYPE_USE, 8.50 + ElementType.TYPE_PARAMETER, 8.51 +}) 8.52 +@interface Case1Container { 8.53 + Case1[] value(); 8.54 +} 8.55 + 8.56 + 8.57 +// Case 2: 8.58 +@Target({ 8.59 + ElementType.TYPE_USE, 8.60 +}) 8.61 +@Repeatable(Case2Container.class) 8.62 +@interface Case2 {} 8.63 + 8.64 +@Target({ 8.65 + ElementType.ANNOTATION_TYPE, 8.66 + ElementType.TYPE, 8.67 + ElementType.TYPE_USE, 8.68 +}) 8.69 +@interface Case2Container { 8.70 + Case2[] value(); 8.71 +} 8.72 + 8.73 + 8.74 +// Case 3: 8.75 +@Target({ 8.76 + ElementType.TYPE_USE, 8.77 +}) 8.78 +@Repeatable(Case3Container.class) 8.79 +@interface Case3 {} 8.80 + 8.81 +@Target({ 8.82 + ElementType.ANNOTATION_TYPE, 8.83 + ElementType.TYPE, 8.84 +}) 8.85 +@interface Case3Container { 8.86 + Case3[] value(); 8.87 +} 8.88 + 8.89 + 8.90 +// Case 4: 8.91 +@Target({ 8.92 + ElementType.TYPE_USE, 8.93 +}) 8.94 +@Repeatable(Case4Container.class) 8.95 +@interface Case4 {} 8.96 + 8.97 +@Target({ 8.98 + ElementType.ANNOTATION_TYPE, 8.99 +}) 8.100 +@interface Case4Container { 8.101 + Case4[] value(); 8.102 +} 8.103 + 8.104 + 8.105 +// Case 5: 8.106 +@Target({ 8.107 + ElementType.TYPE_USE, 8.108 +}) 8.109 +@Repeatable(Case5Container.class) 8.110 +@interface Case5 {} 8.111 + 8.112 +@Target({ 8.113 + ElementType.TYPE, 8.114 +}) 8.115 +@interface Case5Container { 8.116 + Case5[] value(); 8.117 +} 8.118 + 8.119 + 8.120 +// Case 6: 8.121 +@Target({ 8.122 + ElementType.TYPE_USE, 8.123 +}) 8.124 +@Repeatable(Case6Container.class) 8.125 +@interface Case6 {} 8.126 + 8.127 +@Target({ 8.128 + ElementType.TYPE_PARAMETER, 8.129 +}) 8.130 +@interface Case6Container { 8.131 + Case6[] value(); 8.132 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/8029017/TypeUseTargetNeg.java Fri Jan 31 10:46:23 2014 +0000 9.3 @@ -0,0 +1,100 @@ 9.4 +/** 9.5 + * @test /nodynamiccopyright/ 9.6 + * @bug 8029017 9.7 + * @summary sanity testing of ElementType validation for repeating annotations 9.8 + * @compile/fail/ref=TypeUseTargetNeg.out -XDrawDiagnostics TypeUseTargetNeg.java 9.9 + */ 9.10 + 9.11 +import java.lang.annotation.*; 9.12 + 9.13 +public class TypeUseTargetNeg {} 9.14 + 9.15 +// Case 1: 9.16 +@Target({ 9.17 + ElementType.TYPE_USE, 9.18 +}) 9.19 +@Repeatable(FooContainer.class) 9.20 +@interface Foo {} 9.21 + 9.22 +@Target({ 9.23 + ElementType.ANNOTATION_TYPE, 9.24 + ElementType.TYPE, 9.25 + ElementType.TYPE_USE, 9.26 + ElementType.TYPE_PARAMETER, 9.27 + ElementType.FIELD, 9.28 + 9.29 +}) 9.30 +@interface FooContainer { 9.31 + Foo[] value(); 9.32 +} 9.33 + 9.34 + 9.35 +// Case 2: 9.36 +@Target({ 9.37 + ElementType.TYPE_USE, 9.38 +}) 9.39 +@Repeatable(BarContainer.class) 9.40 +@interface Bar {} 9.41 + 9.42 +@Target({ 9.43 + ElementType.ANNOTATION_TYPE, 9.44 + ElementType.TYPE, 9.45 + ElementType.TYPE_USE, 9.46 + ElementType.METHOD, 9.47 +}) 9.48 +@interface BarContainer { 9.49 + Bar[] value(); 9.50 +} 9.51 + 9.52 + 9.53 +// Case 3: 9.54 +@Target({ 9.55 + ElementType.TYPE_USE, 9.56 +}) 9.57 +@Repeatable(BazContainer.class) 9.58 +@interface Baz {} 9.59 + 9.60 +@Target({ 9.61 + ElementType.ANNOTATION_TYPE, 9.62 + ElementType.TYPE, 9.63 + ElementType.PARAMETER, 9.64 +}) 9.65 +@interface BazContainer { 9.66 + Baz[] value(); 9.67 +} 9.68 + 9.69 + 9.70 +// Case 4: 9.71 +@Target({ 9.72 + ElementType.TYPE_USE, 9.73 +}) 9.74 +@Repeatable(QuxContainer.class) 9.75 +@interface Qux {} 9.76 + 9.77 +@interface QuxContainer { 9.78 + Qux[] value(); 9.79 +} 9.80 + 9.81 + 9.82 +// Case 5: 9.83 +@Target({}) 9.84 +@Repeatable(QuuxContainer.class) 9.85 +@interface Quux {} 9.86 + 9.87 +@Target({ 9.88 + ElementType.TYPE_PARAMETER, 9.89 +}) 9.90 +@interface QuuxContainer { 9.91 + Quux[] value(); 9.92 +} 9.93 + 9.94 +// Case 6: 9.95 +@Repeatable(QuuuxContainer.class) 9.96 +@interface Quuux {} 9.97 + 9.98 +@Target({ 9.99 + ElementType.TYPE_USE, 9.100 +}) 9.101 +@interface QuuuxContainer { 9.102 + Quuux[] value(); 9.103 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/8029017/TypeUseTargetNeg.out Fri Jan 31 10:46:23 2014 +0000 10.3 @@ -0,0 +1,7 @@ 10.4 +TypeUseTargetNeg.java:16:1: compiler.err.invalid.repeatable.annotation.incompatible.target: FooContainer, Foo 10.5 +TypeUseTargetNeg.java:36:1: compiler.err.invalid.repeatable.annotation.incompatible.target: BarContainer, Bar 10.6 +TypeUseTargetNeg.java:54:1: compiler.err.invalid.repeatable.annotation.incompatible.target: BazContainer, Baz 10.7 +TypeUseTargetNeg.java:71:1: compiler.err.invalid.repeatable.annotation.incompatible.target: QuxContainer, Qux 10.8 +TypeUseTargetNeg.java:81:1: compiler.err.invalid.repeatable.annotation.incompatible.target: QuuxContainer, Quux 10.9 +TypeUseTargetNeg.java:92:1: compiler.err.invalid.repeatable.annotation.incompatible.target: QuuuxContainer, Quuux 10.10 +6 errors
11.1 --- a/test/tools/javac/annotations/repeatingAnnotations/combo/TargetAnnoCombo.java Fri Jan 31 00:14:57 2014 +0000 11.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/combo/TargetAnnoCombo.java Fri Jan 31 10:46:23 2014 +0000 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -23,7 +23,7 @@ 11.11 11.12 /* 11.13 * @test 11.14 - * @bug 7151010 8006547 8007766 11.15 + * @bug 7151010 8006547 8007766 8029017 11.16 * @summary Default test cases for running combinations for Target values 11.17 * @build Helper 11.18 * @run main TargetAnnoCombo 11.19 @@ -145,11 +145,19 @@ 11.20 11.21 Set<ElementType> tempBaseSet = EnumSet.noneOf(ElementType.class); 11.22 tempBaseSet.addAll(baseAnnotations); 11.23 + 11.24 // If BaseAnno has TYPE, then ANNOTATION_TYPE is allowed by default. 11.25 if (baseAnnotations.contains(TYPE)) { 11.26 tempBaseSet.add(ANNOTATION_TYPE); 11.27 } 11.28 11.29 + // If BaseAnno has TYPE_USE, then add the extra allowed types 11.30 + if (baseAnnotations.contains(TYPE_USE)) { 11.31 + tempBaseSet.add(ANNOTATION_TYPE); 11.32 + tempBaseSet.add(TYPE); 11.33 + tempBaseSet.add(TYPE_PARAMETER); 11.34 + } 11.35 + 11.36 // If containerAnno has no @Target, only valid case if baseAnnoTarget has 11.37 // all targets defined else invalid set. 11.38 if (containerAnnotations == null) {
12.1 --- a/test/tools/javac/api/TestJavacTaskScanner.java Fri Jan 31 00:14:57 2014 +0000 12.2 +++ b/test/tools/javac/api/TestJavacTaskScanner.java Fri Jan 31 10:46:23 2014 +0000 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -23,7 +23,7 @@ 12.11 12.12 /* 12.13 * @test 12.14 - * @bug 4813736 12.15 + * @bug 4813736 8013256 12.16 * @summary Additional functionality test of task and JSR 269 12.17 * @author Peter von der Ah\u00e9 12.18 * @library ./lib
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/tools/javac/flow/T8030218/CompileTimeErrorForNonAssignedStaticFieldTest.java Fri Jan 31 10:46:23 2014 +0000 13.3 @@ -0,0 +1,29 @@ 13.4 +/* 13.5 + * @test /nodynamiccopyright/ 13.6 + * @bug 8030218 13.7 + * @summary javac, compile time error isn't shown when final static field is not assigned, follow-up 13.8 + * @compile/fail/ref=CompileTimeErrorForNonAssignedStaticFieldTest.out -XDrawDiagnostics CompileTimeErrorForNonAssignedStaticFieldTest.java 13.9 + */ 13.10 + 13.11 +public class CompileTimeErrorForNonAssignedStaticFieldTest { 13.12 + private final static int i; 13.13 + 13.14 + public CompileTimeErrorForNonAssignedStaticFieldTest() 13.15 + throws InstantiationException { 13.16 + throw new InstantiationException("Can't instantiate"); 13.17 + } 13.18 + 13.19 + static class Inner { 13.20 + private final int j; 13.21 + public Inner(int x) 13.22 + throws InstantiationException { 13.23 + if (x == 0) { 13.24 + throw new InstantiationException("Can't instantiate"); 13.25 + } else { 13.26 + j = 1; 13.27 + } 13.28 + System.out.println(j); 13.29 + } 13.30 + } 13.31 + 13.32 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/tools/javac/flow/T8030218/CompileTimeErrorForNonAssignedStaticFieldTest.out Fri Jan 31 10:46:23 2014 +0000 14.3 @@ -0,0 +1,2 @@ 14.4 +CompileTimeErrorForNonAssignedStaticFieldTest.java:14:5: compiler.err.var.might.not.have.been.initialized: i 14.5 +1 error
15.1 --- a/test/tools/javac/lambda/InnerConstructor.java Fri Jan 31 00:14:57 2014 +0000 15.2 +++ b/test/tools/javac/lambda/InnerConstructor.java Fri Jan 31 10:46:23 2014 +0000 15.3 @@ -1,5 +1,5 @@ 15.4 /* 15.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 15.6 + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. 15.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 * 15.9 * This code is free software; you can redistribute it and/or modify it 15.10 @@ -23,7 +23,7 @@ 15.11 15.12 /* 15.13 * @test 15.14 - * @bug 8003280 15.15 + * @bug 8003280 8003306 15.16 * @summary Add lambda tests 15.17 * Regression test JDK-8003306 inner class constructor in lambda 15.18 * @author Robert Field
16.1 --- a/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java Fri Jan 31 00:14:57 2014 +0000 16.2 +++ b/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java Fri Jan 31 10:46:23 2014 +0000 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 16.6 + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -23,7 +23,7 @@ 16.11 16.12 /* 16.13 * @test 16.14 - * @bug 8002099 16.15 + * @bug 8002099 8010822 16.16 * @summary Add support for intersection types in cast expression 16.17 */ 16.18
17.1 --- a/test/tools/javac/lambda/separate/Test.java Fri Jan 31 00:14:57 2014 +0000 17.2 +++ b/test/tools/javac/lambda/separate/Test.java Fri Jan 31 10:46:23 2014 +0000 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -23,6 +23,7 @@ 17.11 17.12 /* 17.13 * @test 17.14 + * @bug 8008708 17.15 * @compile Foo.java 17.16 * @compile Test.java 17.17 */
18.1 --- a/test/tools/javac/processing/environment/round/BuriedAnnotations.java Fri Jan 31 00:14:57 2014 +0000 18.2 +++ b/test/tools/javac/processing/environment/round/BuriedAnnotations.java Fri Jan 31 10:46:23 2014 +0000 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -22,7 +22,7 @@ 18.11 */ 18.12 18.13 /** 18.14 - * Class to hold annotations for ElementsAnnotatedWithTest. 18.15 + * Class to hold annotations for TestElementsAnnotatedWith. 18.16 */ 18.17 18.18 @AnnotatedElementInfo(annotationName="java.lang.SuppressWarnings",
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/test/tools/javac/processing/environment/round/ErroneousAnnotations.java Fri Jan 31 10:46:23 2014 +0000 19.3 @@ -0,0 +1,12 @@ 19.4 +/** /nodynamiccopyright/ 19.5 + * Class to hold annotations for TestElementsAnnotatedWith. 19.6 + */ 19.7 + 19.8 +@AnnotatedElementInfo(annotationName="java.lang.SuppressWarnings", 19.9 + expectedSize=0, 19.10 + names={}) 19.11 +@Undefined 19.12 +public class ErroneousAnnotations { 19.13 + @Undefined 19.14 + private void foo() {return;} 19.15 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/processing/environment/round/ErroneousAnnotations.out Fri Jan 31 10:46:23 2014 +0000 20.3 @@ -0,0 +1,4 @@ 20.4 +ErroneousAnnotations.java:8:2: compiler.err.cant.resolve: kindname.class, Undefined, , 20.5 +ErroneousAnnotations.java:10:6: compiler.err.cant.resolve.location: kindname.class, Undefined, , , (compiler.misc.location: kindname.class, ErroneousAnnotations, null) 20.6 +2 errors 20.7 +Results: []
21.1 --- a/test/tools/javac/processing/environment/round/Part1.java Fri Jan 31 00:14:57 2014 +0000 21.2 +++ b/test/tools/javac/processing/environment/round/Part1.java Fri Jan 31 10:46:23 2014 +0000 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 21.6 + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -22,7 +22,7 @@ 21.11 */ 21.12 21.13 /** 21.14 - * Class to hold annotations for ElementsAnnotatedWithTest. 21.15 + * Class to hold annotations for TestElementsAnnotatedWith. 21.16 */ 21.17 21.18 @AnnotatedElementInfo(annotationName="java.lang.SuppressWarnings",
22.1 --- a/test/tools/javac/processing/environment/round/Part2.java Fri Jan 31 00:14:57 2014 +0000 22.2 +++ b/test/tools/javac/processing/environment/round/Part2.java Fri Jan 31 10:46:23 2014 +0000 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 22.6 + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -22,7 +22,7 @@ 22.11 */ 22.12 22.13 /** 22.14 - * Class to hold annotations for ElementsAnnotatedWithTest. 22.15 + * Class to hold annotations for TestElementsAnnotatedWith. 22.16 */ 22.17 @SuppressWarnings("") 22.18 public class Part2 {
23.1 --- a/test/tools/javac/processing/environment/round/SurfaceAnnotations.java Fri Jan 31 00:14:57 2014 +0000 23.2 +++ b/test/tools/javac/processing/environment/round/SurfaceAnnotations.java Fri Jan 31 10:46:23 2014 +0000 23.3 @@ -1,5 +1,5 @@ 23.4 /* 23.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. 23.6 + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. 23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 * 23.9 * This code is free software; you can redistribute it and/or modify it 23.10 @@ -22,7 +22,7 @@ 23.11 */ 23.12 23.13 /** 23.14 - * Class to hold annotations for ElementsAnnotatedWithTest. 23.15 + * Class to hold annotations for TestElementsAnnotatedWith. 23.16 */ 23.17 23.18 @AnnotatedElementInfo(annotationName="java.lang.SuppressWarnings",
24.1 --- a/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Fri Jan 31 00:14:57 2014 +0000 24.2 +++ b/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Fri Jan 31 10:46:23 2014 +0000 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -23,7 +23,7 @@ 24.11 24.12 /* 24.13 * @test 24.14 - * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 24.15 + * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 8030049 24.16 * @summary Tests that getElementsAnnotatedWith works properly. 24.17 * @author Joseph D. Darcy 24.18 * @library /tools/javac/lib 24.19 @@ -37,23 +37,18 @@ 24.20 * @compile -processor TestElementsAnnotatedWith -proc:only C2.java 24.21 * @compile -processor TestElementsAnnotatedWith -proc:only Foo.java 24.22 * @compile -processor TestElementsAnnotatedWith -proc:only TypeParameterAnnotations.java 24.23 + * @compile/fail/ref=ErroneousAnnotations.out -processor TestElementsAnnotatedWith -proc:only -XDrawDiagnostics ErroneousAnnotations.java 24.24 * @compile Foo.java 24.25 * @compile/process -processor TestElementsAnnotatedWith -proc:only Foo 24.26 */ 24.27 24.28 import java.lang.annotation.Annotation; 24.29 -import java.io.*; 24.30 import java.util.Collections; 24.31 import java.util.Set; 24.32 import java.util.HashSet; 24.33 -import java.util.List; 24.34 -import java.util.ArrayList; 24.35 import java.util.Arrays; 24.36 import javax.annotation.processing.*; 24.37 -import javax.tools.*; 24.38 -import javax.lang.model.SourceVersion; 24.39 import javax.lang.model.element.*; 24.40 -import javax.lang.model.util.*; 24.41 import static javax.lang.model.util.ElementFilter.*; 24.42 24.43 /**
25.1 --- a/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java Fri Jan 31 00:14:57 2014 +0000 25.2 +++ b/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java Fri Jan 31 10:46:23 2014 +0000 25.3 @@ -1,5 +1,5 @@ 25.4 /* 25.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 25.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.8 * 25.9 * This code is free software; you can redistribute it and/or modify it 25.10 @@ -22,7 +22,7 @@ 25.11 */ 25.12 25.13 /** 25.14 - * Class to hold annotations for ElementsAnnotatedWithTest. 25.15 + * Class to hold annotations for TestElementsAnnotatedWith. 25.16 */ 25.17 25.18 @AnnotatedElementInfo(annotationName="TpAnno",
26.1 --- a/test/tools/javac/resolve/ResolveHarness.java Fri Jan 31 00:14:57 2014 +0000 26.2 +++ b/test/tools/javac/resolve/ResolveHarness.java Fri Jan 31 10:46:23 2014 +0000 26.3 @@ -1,5 +1,5 @@ 26.4 /* 26.5 - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 26.6 + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. 26.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.8 * 26.9 * This code is free software; you can redistribute it and/or modify it 26.10 @@ -23,7 +23,7 @@ 26.11 26.12 /* 26.13 * @test 26.14 - * @bug 7098660 26.15 + * @bug 7098660 8014649 26.16 * @summary Write better overload resolution/inference tests 26.17 * @library /tools/javac/lib 26.18 * @build JavacTestingAbstractProcessor ResolveHarness