Wed, 17 Apr 2013 21:50:43 -0700
Merge
1.1 --- a/src/share/classes/com/sun/javadoc/ExecutableMemberDoc.java Tue Apr 16 15:00:49 2013 -0700 1.2 +++ b/src/share/classes/com/sun/javadoc/ExecutableMemberDoc.java Wed Apr 17 21:50:43 2013 -0700 1.3 @@ -88,13 +88,12 @@ 1.4 Parameter[] parameters(); 1.5 1.6 /** 1.7 - * Get the receiver annotations of this executable element. 1.8 - * Return an empty array if there are none. 1.9 + * Get the receiver type of this executable element. 1.10 * 1.11 - * @return the receiver annotations of this executable element. 1.12 + * @return the receiver type of this executable element. 1.13 * @since 1.8 1.14 */ 1.15 - AnnotationDesc[] receiverAnnotations(); 1.16 + Type receiverType(); 1.17 1.18 /** 1.19 * Return the throws tags in this method.
2.1 --- a/src/share/classes/com/sun/javadoc/Type.java Tue Apr 16 15:00:49 2013 -0700 2.2 +++ b/src/share/classes/com/sun/javadoc/Type.java Wed Apr 17 21:50:43 2013 -0700 2.3 @@ -160,4 +160,13 @@ 2.4 * @since 1.5 2.5 */ 2.6 AnnotationTypeDoc asAnnotationTypeDoc(); 2.7 + 2.8 + /** 2.9 + * If this type is an array type, return the element type of the 2.10 + * array. Otherwise, return null. 2.11 + * 2.12 + * @return a <code>Type</code> representing the element type or null. 2.13 + * @since 1.8 2.14 + */ 2.15 + Type getElementType(); 2.16 }
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Tue Apr 16 15:00:49 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Wed Apr 17 21:50:43 2013 -0700 3.3 @@ -139,12 +139,24 @@ 3.4 } 3.5 } 3.6 3.7 - protected void addReceiverAnnotations(ExecutableMemberDoc member, 3.8 - Content tree) { 3.9 - if (member.receiverAnnotations().length > 0) { 3.10 - tree.addContent(writer.getSpace()); 3.11 - writer.addReceiverAnnotationInfo(member, tree); 3.12 - } 3.13 + /** 3.14 + * Add the receiver annotations information. 3.15 + * 3.16 + * @param member the member to write receiver annotations for. 3.17 + * @param rcvrType the receiver type. 3.18 + * @param descList list of annotation description. 3.19 + * @param tree the content tree to which the information will be added. 3.20 + */ 3.21 + protected void addReceiverAnnotations(ExecutableMemberDoc member, Type rcvrType, 3.22 + AnnotationDesc[] descList, Content tree) { 3.23 + writer.addReceiverAnnotationInfo(member, descList, tree); 3.24 + tree.addContent(writer.getSpace()); 3.25 + tree.addContent(rcvrType.typeName()); 3.26 + LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, 3.27 + LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, rcvrType); 3.28 + tree.addContent(new RawHtml(writer.getTypeParameterLinks(linkInfo))); 3.29 + tree.addContent(writer.getSpace()); 3.30 + tree.addContent("this"); 3.31 } 3.32 3.33 3.34 @@ -168,14 +180,24 @@ 3.35 protected void addParameters(ExecutableMemberDoc member, 3.36 boolean includeAnnotations, Content htmltree) { 3.37 htmltree.addContent("("); 3.38 + String sep = ""; 3.39 Parameter[] params = member.parameters(); 3.40 String indent = makeSpace(writer.displayLength); 3.41 if (configuration.linksource) { 3.42 //add spaces to offset indentation changes caused by link. 3.43 indent+= makeSpace(member.name().length()); 3.44 } 3.45 + Type rcvrType = member.receiverType(); 3.46 + if (includeAnnotations && rcvrType instanceof AnnotatedType) { 3.47 + AnnotationDesc[] descList = rcvrType.asAnnotatedType().annotations(); 3.48 + if (descList.length > 0) { 3.49 + addReceiverAnnotations(member, rcvrType, descList, htmltree); 3.50 + sep = "," + DocletConstants.NL + indent; 3.51 + } 3.52 + } 3.53 int paramstart; 3.54 for (paramstart = 0; paramstart < params.length; paramstart++) { 3.55 + htmltree.addContent(sep); 3.56 Parameter param = params[paramstart]; 3.57 if (!param.name().startsWith("this$")) { 3.58 if (includeAnnotations) {
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Tue Apr 16 15:00:49 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Wed Apr 17 21:50:43 2013 -0700 4.3 @@ -137,7 +137,6 @@ 4.4 addName(constructor.name(), pre); 4.5 } 4.6 addParameters(constructor, pre); 4.7 - writer.addReceiverAnnotationInfo(constructor, pre); 4.8 addExceptions(constructor, pre); 4.9 return pre; 4.10 }
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue Apr 16 15:00:49 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Apr 17 21:50:43 2013 -0700 5.3 @@ -1860,11 +1860,13 @@ 5.4 * Add the annotation types of the executable receiver. 5.5 * 5.6 * @param method the executable to write the receiver annotations for. 5.7 + * @param descList list of annotation description. 5.8 * @param htmltree the documentation tree to which the annotation info will be 5.9 * added 5.10 */ 5.11 - public void addReceiverAnnotationInfo(ExecutableMemberDoc method, Content htmltree) { 5.12 - addAnnotationInfo(method, method.receiverAnnotations(), htmltree); 5.13 + public void addReceiverAnnotationInfo(ExecutableMemberDoc method, AnnotationDesc[] descList, 5.14 + Content htmltree) { 5.15 + addAnnotationInfo(0, method, descList, false, htmltree); 5.16 } 5.17 5.18 /** 5.19 @@ -1915,13 +1917,16 @@ 5.20 private boolean addAnnotationInfo(int indent, Doc doc, 5.21 AnnotationDesc[] descList, boolean lineBreak, Content htmltree) { 5.22 List<String> annotations = getAnnotations(indent, descList, lineBreak); 5.23 + String sep =""; 5.24 if (annotations.size() == 0) { 5.25 return false; 5.26 } 5.27 Content annotationContent; 5.28 for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) { 5.29 + htmltree.addContent(sep); 5.30 annotationContent = new RawHtml(iter.next()); 5.31 htmltree.addContent(annotationContent); 5.32 + sep = " "; 5.33 } 5.34 return true; 5.35 }
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Tue Apr 16 15:00:49 2013 -0700 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java Wed Apr 17 21:50:43 2013 -0700 6.3 @@ -157,9 +157,9 @@ 6.4 if (!isFirst) { 6.5 linkInfo.displayLength += 1; 6.6 output.append(" "); 6.7 - isFirst = false; 6.8 } 6.9 output.append(anno); 6.10 + isFirst = false; 6.11 } 6.12 if (!annos.isEmpty()) { 6.13 linkInfo.displayLength += 1;
7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkOutputImpl.java Tue Apr 16 15:00:49 2013 -0700 7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkOutputImpl.java Wed Apr 17 21:50:43 2013 -0700 7.3 @@ -63,6 +63,13 @@ 7.4 /** 7.5 * {@inheritDoc} 7.6 */ 7.7 + public void insert(int offset, Object o) { 7.8 + output.insert(offset, o.toString()); 7.9 + } 7.10 + 7.11 + /** 7.12 + * {@inheritDoc} 7.13 + */ 7.14 public String toString() { 7.15 return output.toString(); 7.16 }
8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Tue Apr 16 15:00:49 2013 -0700 8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Wed Apr 17 21:50:43 2013 -0700 8.3 @@ -130,7 +130,6 @@ 8.4 addName(method.name(), pre); 8.5 } 8.6 addParameters(method, pre); 8.7 - addReceiverAnnotations(method, pre); 8.8 addExceptions(method, pre); 8.9 return pre; 8.10 }
9.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java Tue Apr 16 15:00:49 2013 -0700 9.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java Wed Apr 17 21:50:43 2013 -0700 9.3 @@ -61,7 +61,7 @@ 9.4 //Just a primitive. 9.5 linkInfo.displayLength += type.typeName().length(); 9.6 linkOutput.append(type.typeName()); 9.7 - } else if (type.asAnnotatedType() != null) { 9.8 + } else if (type.asAnnotatedType() != null && type.dimension().length() == 0) { 9.9 linkOutput.append(getTypeAnnotationLinks(linkInfo)); 9.10 linkInfo.type = type.asAnnotatedType().underlyingType(); 9.11 linkOutput.append(getLinkOutput(linkInfo)); 9.12 @@ -141,8 +141,21 @@ 9.13 linkInfo.displayLength += 3; 9.14 linkOutput.append("..."); 9.15 } else { 9.16 - linkInfo.displayLength += type.dimension().length(); 9.17 - linkOutput.append(type.dimension()); 9.18 + while (type != null && type.dimension().length() > 0) { 9.19 + linkInfo.displayLength += type.dimension().length(); 9.20 + if (type.asAnnotatedType() != null) { 9.21 + linkInfo.type = type; 9.22 + linkOutput.append(" "); 9.23 + linkOutput.append(getTypeAnnotationLinks(linkInfo)); 9.24 + linkOutput.append("[]"); 9.25 + type = type.asAnnotatedType().underlyingType().getElementType(); 9.26 + } else { 9.27 + linkOutput.append("[]"); 9.28 + type = type.getElementType(); 9.29 + } 9.30 + } 9.31 + linkInfo.type = type; 9.32 + linkOutput.insert(0, getTypeAnnotationLinks(linkInfo)); 9.33 } 9.34 return linkOutput; 9.35 } else if (linkInfo.classDoc != null) {
10.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkOutput.java Tue Apr 16 15:00:49 2013 -0700 10.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkOutput.java Wed Apr 17 21:50:43 2013 -0700 10.3 @@ -44,4 +44,12 @@ 10.4 * @param o the object to append. 10.5 */ 10.6 public void append(Object o); 10.7 + 10.8 + /** 10.9 + * Insert the given object into the output sequence. 10.10 + * 10.11 + * @param offset the offset. 10.12 + * @param o the object to be inserted. 10.13 + */ 10.14 + public void insert(int offset, Object o); 10.15 }
11.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue Apr 16 15:00:49 2013 -0700 11.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed Apr 17 21:50:43 2013 -0700 11.3 @@ -454,8 +454,7 @@ 11.4 } 11.5 11.6 public Set<Modifier> getModifiers() { 11.7 - long flags = flags(); 11.8 - return Flags.asModifierSet((flags & DEFAULT) != 0 ? flags & ~ABSTRACT : flags); 11.9 + return Flags.asModifierSet(flags()); 11.10 } 11.11 11.12 public Name getSimpleName() { 11.13 @@ -496,10 +495,11 @@ 11.14 return List.nil(); 11.15 } 11.16 11.17 - public List<TypeSymbol> getTypeParameters() { 11.18 - ListBuffer<TypeSymbol> l = ListBuffer.lb(); 11.19 + public List<TypeVariableSymbol> getTypeParameters() { 11.20 + ListBuffer<TypeVariableSymbol> l = ListBuffer.lb(); 11.21 for (Type t : type.getTypeArguments()) { 11.22 - l.append(t.tsym); 11.23 + Assert.check(t.tsym.getKind() == ElementKind.TYPE_PARAMETER); 11.24 + l.append((TypeVariableSymbol)t.tsym); 11.25 } 11.26 return l.toList(); 11.27 } 11.28 @@ -546,19 +546,12 @@ 11.29 } 11.30 } 11.31 11.32 - /** A class for type symbols. Type variables are represented by instances 11.33 - * of this class, classes and packages by instances of subclasses. 11.34 + /** A base class for Symbols representing types. 11.35 */ 11.36 - public static class TypeSymbol 11.37 - extends Symbol implements TypeParameterElement { 11.38 - // Implements TypeParameterElement because type parameters don't 11.39 - // have their own TypeSymbol subclass. 11.40 - // TODO: type parameters should have their own TypeSymbol subclass 11.41 - 11.42 - public TypeSymbol(long flags, Name name, Type type, Symbol owner) { 11.43 - super(TYP, flags, name, type, owner); 11.44 + public static abstract class TypeSymbol extends Symbol { 11.45 + public TypeSymbol(int kind, long flags, Name name, Type type, Symbol owner) { 11.46 + super(kind, flags, name, type, owner); 11.47 } 11.48 - 11.49 /** form a fully qualified name from a name and an owner 11.50 */ 11.51 static public Name formFullName(Name name, Symbol owner) { 11.52 @@ -610,11 +603,7 @@ 11.53 return this.type.hasTag(TYPEVAR); 11.54 } 11.55 11.56 - // For type params; overridden in subclasses. 11.57 - public ElementKind getKind() { 11.58 - return ElementKind.TYPE_PARAMETER; 11.59 - } 11.60 - 11.61 + @Override 11.62 public java.util.List<Symbol> getEnclosedElements() { 11.63 List<Symbol> list = List.nil(); 11.64 if (kind == TYP && type.hasTag(TYPEVAR)) { 11.65 @@ -627,23 +616,31 @@ 11.66 return list; 11.67 } 11.68 11.69 - // For type params. 11.70 - // Perhaps not needed if getEnclosingElement can be spec'ed 11.71 - // to do the same thing. 11.72 - // TODO: getGenericElement() might not be needed 11.73 + @Override 11.74 + public <R, P> R accept(Symbol.Visitor<R, P> v, P p) { 11.75 + return v.visitTypeSymbol(this, p); 11.76 + } 11.77 + } 11.78 + 11.79 + /** 11.80 + * Type variables are represented by instances of this class. 11.81 + */ 11.82 + public static class TypeVariableSymbol 11.83 + extends TypeSymbol implements TypeParameterElement { 11.84 + 11.85 + public TypeVariableSymbol(long flags, Name name, Type type, Symbol owner) { 11.86 + super(TYP, flags, name, type, owner); 11.87 + } 11.88 + 11.89 + public ElementKind getKind() { 11.90 + return ElementKind.TYPE_PARAMETER; 11.91 + } 11.92 + 11.93 + @Override 11.94 public Symbol getGenericElement() { 11.95 return owner; 11.96 } 11.97 11.98 - public <R, P> R accept(ElementVisitor<R, P> v, P p) { 11.99 - Assert.check(type.hasTag(TYPEVAR)); // else override will be invoked 11.100 - return v.visitTypeParameter(this, p); 11.101 - } 11.102 - 11.103 - public <R, P> R accept(Symbol.Visitor<R, P> v, P p) { 11.104 - return v.visitTypeSymbol(this, p); 11.105 - } 11.106 - 11.107 public List<Type> getBounds() { 11.108 TypeVar t = (TypeVar)type; 11.109 Type bound = t.getUpperBound(); 11.110 @@ -658,6 +655,11 @@ 11.111 return ct.interfaces_field; 11.112 } 11.113 } 11.114 + 11.115 + @Override 11.116 + public <R, P> R accept(ElementVisitor<R, P> v, P p) { 11.117 + return v.visitTypeParameter(this, p); 11.118 + } 11.119 } 11.120 11.121 /** A class for package symbols 11.122 @@ -670,8 +672,7 @@ 11.123 public ClassSymbol package_info; // see bug 6443073 11.124 11.125 public PackageSymbol(Name name, Type type, Symbol owner) { 11.126 - super(0, name, type, owner); 11.127 - this.kind = PCK; 11.128 + super(PCK, 0, name, type, owner); 11.129 this.members_field = null; 11.130 this.fullname = formFullName(name, owner); 11.131 } 11.132 @@ -783,7 +784,7 @@ 11.133 public Pool pool; 11.134 11.135 public ClassSymbol(long flags, Name name, Type type, Symbol owner) { 11.136 - super(flags, name, type, owner); 11.137 + super(TYP, flags, name, type, owner); 11.138 this.members_field = null; 11.139 this.fullname = formFullName(name, owner); 11.140 this.flatname = formFlatName(name, owner); 11.141 @@ -1126,6 +1127,12 @@ 11.142 return m; 11.143 } 11.144 11.145 + @Override 11.146 + public Set<Modifier> getModifiers() { 11.147 + long flags = flags(); 11.148 + return Flags.asModifierSet((flags & DEFAULT) != 0 ? flags & ~ABSTRACT : flags); 11.149 + } 11.150 + 11.151 /** The Java source which this symbol represents. 11.152 */ 11.153 public String toString() {
12.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java Tue Apr 16 15:00:49 2013 -0700 12.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Apr 17 21:50:43 2013 -0700 12.3 @@ -404,12 +404,11 @@ 12.4 return messages.getLocalizedString("compiler.misc.unnamed.package"); 12.5 } 12.6 }; 12.7 - noSymbol = new TypeSymbol(0, names.empty, Type.noType, rootPackage) { 12.8 + noSymbol = new TypeSymbol(Kinds.NIL, 0, names.empty, Type.noType, rootPackage) { 12.9 public <R, P> R accept(ElementVisitor<R, P> v, P p) { 12.10 return v.visitUnknown(this, p); 12.11 } 12.12 }; 12.13 - noSymbol.kind = Kinds.NIL; 12.14 12.15 // create the error symbols 12.16 errSymbol = new ClassSymbol(PUBLIC|STATIC|ACYCLIC, names.any, null, rootPackage);
13.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java Tue Apr 16 15:00:49 2013 -0700 13.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Wed Apr 17 21:50:43 2013 -0700 13.3 @@ -1145,7 +1145,7 @@ 13.4 13.5 public TypeVar(Name name, Symbol owner, Type lower) { 13.6 super(TYPEVAR, null); 13.7 - tsym = new TypeSymbol(0, name, this, owner); 13.8 + tsym = new TypeVariableSymbol(0, name, this, owner); 13.9 this.lower = lower; 13.10 } 13.11
14.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Tue Apr 16 15:00:49 2013 -0700 14.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Wed Apr 17 21:50:43 2013 -0700 14.3 @@ -589,7 +589,7 @@ 14.4 CapturedType capVar = (CapturedType)capturedTypeargs.head; 14.5 //use declared bound if it doesn't depend on formal type-args 14.6 bound = capVar.bound.containsAny(capturedSite.getTypeArguments()) ? 14.7 - syms.objectType : capVar.bound; 14.8 + wt.type : capVar.bound; 14.9 break; 14.10 default: 14.11 bound = wt.type;
15.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Apr 16 15:00:49 2013 -0700 15.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Apr 17 21:50:43 2013 -0700 15.3 @@ -148,6 +148,7 @@ 15.4 varInfo = new ResultInfo(VAR, Type.noType); 15.5 unknownExprInfo = new ResultInfo(VAL, Type.noType); 15.6 unknownTypeInfo = new ResultInfo(TYP, Type.noType); 15.7 + unknownTypeExprInfo = new ResultInfo(Kinds.TYP | Kinds.VAL, Type.noType); 15.8 recoveryInfo = new RecoveryInfo(deferredAttr.emptyDeferredAttrContext); 15.9 } 15.10 15.11 @@ -559,6 +560,7 @@ 15.12 final ResultInfo varInfo; 15.13 final ResultInfo unknownExprInfo; 15.14 final ResultInfo unknownTypeInfo; 15.15 + final ResultInfo unknownTypeExprInfo; 15.16 final ResultInfo recoveryInfo; 15.17 15.18 Type pt() { 15.19 @@ -667,7 +669,7 @@ 15.20 List<Type> attribArgs(List<JCExpression> trees, Env<AttrContext> env) { 15.21 ListBuffer<Type> argtypes = new ListBuffer<Type>(); 15.22 for (JCExpression arg : trees) { 15.23 - Type argtype = allowPoly && TreeInfo.isPoly(arg, env.tree) ? 15.24 + Type argtype = allowPoly && deferredAttr.isDeferred(env, arg) ? 15.25 deferredAttr.new DeferredType(arg, env) : 15.26 chk.checkNonVoid(arg, attribExpr(arg, env, Infer.anyPoly)); 15.27 argtypes.append(argtype); 15.28 @@ -2455,20 +2457,24 @@ 15.29 argtypes.append(param.vartype.type) : 15.30 argtypes.append(syms.errType); 15.31 } 15.32 - return new MethodType(argtypes, Type.recoveryType, List.<Type>nil(), syms.methodClass); 15.33 + return new MethodType(argtypes, Type.recoveryType, 15.34 + List.of(syms.throwableType), syms.methodClass); 15.35 case REFERENCE: 15.36 - return new MethodType(List.<Type>nil(), Type.recoveryType, List.<Type>nil(), syms.methodClass); 15.37 + return new MethodType(List.<Type>nil(), Type.recoveryType, 15.38 + List.of(syms.throwableType), syms.methodClass); 15.39 default: 15.40 Assert.error("Cannot get here!"); 15.41 } 15.42 return null; 15.43 } 15.44 15.45 - private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env, final InferenceContext inferenceContext, final Type... ts) { 15.46 + private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env, 15.47 + final InferenceContext inferenceContext, final Type... ts) { 15.48 checkAccessibleTypes(pos, env, inferenceContext, List.from(ts)); 15.49 } 15.50 15.51 - private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env, final InferenceContext inferenceContext, final List<Type> ts) { 15.52 + private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env, 15.53 + final InferenceContext inferenceContext, final List<Type> ts) { 15.54 if (inferenceContext.free(ts)) { 15.55 inferenceContext.addFreeTypeListener(ts, new FreeTypeListener() { 15.56 @Override 15.57 @@ -2985,7 +2991,8 @@ 15.58 Env<AttrContext> localEnv = env.dup(tree); 15.59 //should we propagate the target type? 15.60 final ResultInfo castInfo; 15.61 - final boolean isPoly = TreeInfo.isPoly(tree.expr, tree); 15.62 + JCExpression expr = TreeInfo.skipParens(tree.expr); 15.63 + boolean isPoly = expr.hasTag(LAMBDA) || expr.hasTag(REFERENCE); 15.64 if (isPoly) { 15.65 //expression is a poly - we need to propagate target type info 15.66 castInfo = new ResultInfo(VAL, clazztype, new Check.NestedCheckContext(resultInfo.checkContext) {
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/src/share/classes/com/sun/tools/javac/comp/CompileStates.java Wed Apr 17 21:50:43 2013 -0700 16.3 @@ -0,0 +1,92 @@ 16.4 +/* 16.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. Oracle designates this 16.11 + * particular file as subject to the "Classpath" exception as provided 16.12 + * by Oracle in the LICENSE file that accompanied this code. 16.13 + * 16.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.17 + * version 2 for more details (a copy is included in the LICENSE file that 16.18 + * accompanied this code). 16.19 + * 16.20 + * You should have received a copy of the GNU General Public License version 16.21 + * 2 along with this work; if not, write to the Free Software Foundation, 16.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.23 + * 16.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.25 + * or visit www.oracle.com if you need additional information or have any 16.26 + * questions. 16.27 + */ 16.28 + 16.29 +package com.sun.tools.javac.comp; 16.30 + 16.31 +import java.util.HashMap; 16.32 + 16.33 +import com.sun.tools.javac.util.Context; 16.34 + 16.35 +/** Partial map to record which compiler phases have been executed 16.36 + * for each compilation unit. Used for ATTR and FLOW phases. 16.37 + * 16.38 + * <p><b>This is NOT part of any supported API. 16.39 + * If you write code that depends on this, you do so at your own risk. 16.40 + * This code and its internal interfaces are subject to change or 16.41 + * deletion without notice.</b> 16.42 + */ 16.43 +public class CompileStates extends HashMap<Env<AttrContext>, CompileStates.CompileState> { 16.44 + /** The context key for the compile states. */ 16.45 + protected static final Context.Key<CompileStates> compileStatesKey = 16.46 + new Context.Key<CompileStates>(); 16.47 + 16.48 + /** Get the CompileStates instance for this context. */ 16.49 + public static CompileStates instance(Context context) { 16.50 + CompileStates instance = context.get(compileStatesKey); 16.51 + if (instance == null) { 16.52 + instance = new CompileStates(context); 16.53 + } 16.54 + return instance; 16.55 + } 16.56 + 16.57 + /** Ordered list of compiler phases for each compilation unit. */ 16.58 + public enum CompileState { 16.59 + INIT(0), 16.60 + PARSE(1), 16.61 + ENTER(2), 16.62 + PROCESS(3), 16.63 + ATTR(4), 16.64 + FLOW(5), 16.65 + TRANSTYPES(6), 16.66 + UNLAMBDA(7), 16.67 + LOWER(8), 16.68 + GENERATE(9); 16.69 + 16.70 + CompileState(int value) { 16.71 + this.value = value; 16.72 + } 16.73 + public boolean isAfter(CompileState other) { 16.74 + return value > other.value; 16.75 + } 16.76 + public static CompileState max(CompileState a, CompileState b) { 16.77 + return a.value > b.value ? a : b; 16.78 + } 16.79 + private final int value; 16.80 + }; 16.81 + 16.82 + private static final long serialVersionUID = 1812267524140424433L; 16.83 + 16.84 + protected Context context; 16.85 + 16.86 + public CompileStates(Context context) { 16.87 + this.context = context; 16.88 + context.put(compileStatesKey, this); 16.89 + } 16.90 + 16.91 + public boolean isDone(Env<AttrContext> env, CompileState cs) { 16.92 + CompileState ecs = get(env); 16.93 + return (ecs != null) && !cs.isAfter(ecs); 16.94 + } 16.95 +}
17.1 --- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Tue Apr 16 15:00:49 2013 -0700 17.2 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Wed Apr 17 21:50:43 2013 -0700 17.3 @@ -800,4 +800,219 @@ 17.4 } 17.5 } 17.6 } 17.7 + 17.8 + /** 17.9 + * Does the argument expression {@code expr} need speculative type-checking? 17.10 + */ 17.11 + boolean isDeferred(Env<AttrContext> env, JCExpression expr) { 17.12 + DeferredChecker dc = new DeferredChecker(env); 17.13 + dc.scan(expr); 17.14 + return dc.result.isPoly(); 17.15 + } 17.16 + 17.17 + /** 17.18 + * The kind of an argument expression. This is used by the analysis that 17.19 + * determines as to whether speculative attribution is necessary. 17.20 + */ 17.21 + enum ArgumentExpressionKind { 17.22 + 17.23 + /** kind that denotes poly argument expression */ 17.24 + POLY, 17.25 + /** kind that denotes a standalone expression */ 17.26 + NO_POLY, 17.27 + /** kind that denotes a primitive/boxed standalone expression */ 17.28 + PRIMITIVE; 17.29 + 17.30 + /** 17.31 + * Does this kind denote a poly argument expression 17.32 + */ 17.33 + public final boolean isPoly() { 17.34 + return this == POLY; 17.35 + } 17.36 + 17.37 + /** 17.38 + * Does this kind denote a primitive standalone expression 17.39 + */ 17.40 + public final boolean isPrimitive() { 17.41 + return this == PRIMITIVE; 17.42 + } 17.43 + 17.44 + /** 17.45 + * Compute the kind of a standalone expression of a given type 17.46 + */ 17.47 + static ArgumentExpressionKind standaloneKind(Type type, Types types) { 17.48 + return types.unboxedTypeOrType(type).isPrimitive() ? 17.49 + ArgumentExpressionKind.PRIMITIVE : 17.50 + ArgumentExpressionKind.NO_POLY; 17.51 + } 17.52 + 17.53 + /** 17.54 + * Compute the kind of a method argument expression given its symbol 17.55 + */ 17.56 + static ArgumentExpressionKind methodKind(Symbol sym, Types types) { 17.57 + Type restype = sym.type.getReturnType(); 17.58 + if (sym.type.hasTag(FORALL) && 17.59 + restype.containsAny(((ForAll)sym.type).tvars)) { 17.60 + return ArgumentExpressionKind.POLY; 17.61 + } else { 17.62 + return ArgumentExpressionKind.standaloneKind(restype, types); 17.63 + } 17.64 + } 17.65 + } 17.66 + 17.67 + /** 17.68 + * Tree scanner used for checking as to whether an argument expression 17.69 + * requires speculative attribution 17.70 + */ 17.71 + final class DeferredChecker extends FilterScanner { 17.72 + 17.73 + Env<AttrContext> env; 17.74 + ArgumentExpressionKind result; 17.75 + 17.76 + public DeferredChecker(Env<AttrContext> env) { 17.77 + super(deferredCheckerTags); 17.78 + this.env = env; 17.79 + } 17.80 + 17.81 + @Override 17.82 + public void visitLambda(JCLambda tree) { 17.83 + //a lambda is always a poly expression 17.84 + result = ArgumentExpressionKind.POLY; 17.85 + } 17.86 + 17.87 + @Override 17.88 + public void visitReference(JCMemberReference tree) { 17.89 + //a method reference is always a poly expression 17.90 + result = ArgumentExpressionKind.POLY; 17.91 + } 17.92 + 17.93 + @Override 17.94 + public void visitTypeCast(JCTypeCast tree) { 17.95 + //a cast is always a standalone expression 17.96 + result = ArgumentExpressionKind.NO_POLY; 17.97 + } 17.98 + 17.99 + @Override 17.100 + public void visitConditional(JCConditional tree) { 17.101 + scan(tree.truepart); 17.102 + if (!result.isPrimitive()) { 17.103 + result = ArgumentExpressionKind.POLY; 17.104 + return; 17.105 + } 17.106 + scan(tree.falsepart); 17.107 + result = reduce(ArgumentExpressionKind.PRIMITIVE); 17.108 + } 17.109 + 17.110 + @Override 17.111 + public void visitNewClass(JCNewClass tree) { 17.112 + result = (TreeInfo.isDiamond(tree) || attr.findDiamonds) ? 17.113 + ArgumentExpressionKind.POLY : ArgumentExpressionKind.NO_POLY; 17.114 + } 17.115 + 17.116 + @Override 17.117 + public void visitApply(JCMethodInvocation tree) { 17.118 + Name name = TreeInfo.name(tree.meth); 17.119 + 17.120 + //fast path 17.121 + if (tree.typeargs.nonEmpty() || 17.122 + name == name.table.names._this || 17.123 + name == name.table.names._super) { 17.124 + result = ArgumentExpressionKind.NO_POLY; 17.125 + return; 17.126 + } 17.127 + 17.128 + //slow path 17.129 + final JCExpression rec = tree.meth.hasTag(SELECT) ? 17.130 + ((JCFieldAccess)tree.meth).selected : 17.131 + null; 17.132 + 17.133 + if (rec != null && !isSimpleReceiver(rec)) { 17.134 + //give up if receiver is too complex (to cut down analysis time) 17.135 + result = ArgumentExpressionKind.POLY; 17.136 + return; 17.137 + } 17.138 + 17.139 + Type site = rec != null ? 17.140 + attribSpeculative(rec, env, attr.unknownTypeExprInfo).type : 17.141 + env.enclClass.sym.type; 17.142 + 17.143 + ListBuffer<Type> args = ListBuffer.lb(); 17.144 + for (int i = 0; i < tree.args.length(); i ++) { 17.145 + args.append(Type.noType); 17.146 + } 17.147 + 17.148 + Resolve.LookupHelper lh = rs.new LookupHelper(name, site, args.toList(), List.<Type>nil(), MethodResolutionPhase.VARARITY) { 17.149 + @Override 17.150 + Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) { 17.151 + return rec == null ? 17.152 + rs.findFun(env, name, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()) : 17.153 + rs.findMethod(env, site, name, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired(), false); 17.154 + } 17.155 + @Override 17.156 + Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) { 17.157 + return sym; 17.158 + } 17.159 + }; 17.160 + 17.161 + Symbol sym = rs.lookupMethod(env, tree, site.tsym, rs.arityMethodCheck, lh); 17.162 + 17.163 + if (sym.kind == Kinds.AMBIGUOUS) { 17.164 + Resolve.AmbiguityError err = (Resolve.AmbiguityError)sym.baseSymbol(); 17.165 + result = ArgumentExpressionKind.PRIMITIVE; 17.166 + for (List<Symbol> ambigousSyms = err.ambiguousSyms ; 17.167 + ambigousSyms.nonEmpty() && !result.isPoly() ; 17.168 + ambigousSyms = ambigousSyms.tail) { 17.169 + Symbol s = ambigousSyms.head; 17.170 + if (s.kind == Kinds.MTH) { 17.171 + result = reduce(ArgumentExpressionKind.methodKind(s, types)); 17.172 + } 17.173 + } 17.174 + } else { 17.175 + result = (sym.kind == Kinds.MTH) ? 17.176 + ArgumentExpressionKind.methodKind(sym, types) : 17.177 + ArgumentExpressionKind.NO_POLY; 17.178 + } 17.179 + } 17.180 + //where 17.181 + private boolean isSimpleReceiver(JCTree rec) { 17.182 + switch (rec.getTag()) { 17.183 + case IDENT: 17.184 + return true; 17.185 + case SELECT: 17.186 + return isSimpleReceiver(((JCFieldAccess)rec).selected); 17.187 + case TYPEAPPLY: 17.188 + case TYPEARRAY: 17.189 + return true; 17.190 + case ANNOTATED_TYPE: 17.191 + return isSimpleReceiver(((JCAnnotatedType)rec).underlyingType); 17.192 + default: 17.193 + return false; 17.194 + } 17.195 + } 17.196 + private ArgumentExpressionKind reduce(ArgumentExpressionKind kind) { 17.197 + switch (result) { 17.198 + case PRIMITIVE: return kind; 17.199 + case NO_POLY: return kind.isPoly() ? kind : result; 17.200 + case POLY: return result; 17.201 + default: 17.202 + Assert.error(); 17.203 + return null; 17.204 + } 17.205 + } 17.206 + 17.207 + @Override 17.208 + public void visitLiteral(JCLiteral tree) { 17.209 + Type litType = attr.litType(tree.typetag); 17.210 + result = ArgumentExpressionKind.standaloneKind(litType, types); 17.211 + } 17.212 + 17.213 + @Override 17.214 + void skip(JCTree tree) { 17.215 + result = ArgumentExpressionKind.NO_POLY; 17.216 + } 17.217 + } 17.218 + //where 17.219 + private EnumSet<JCTree.Tag> deferredCheckerTags = 17.220 + EnumSet.of(LAMBDA, REFERENCE, PARENS, TYPECAST, 17.221 + CONDEXPR, NEWCLASS, APPLY, LITERAL); 17.222 }
18.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue Apr 16 15:00:49 2013 -0700 18.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Wed Apr 17 21:50:43 2013 -0700 18.3 @@ -719,7 +719,7 @@ 18.4 Flow.this.make = make; 18.5 pendingExits = new ListBuffer<PendingExit>(); 18.6 alive = true; 18.7 - scan(env.tree); 18.8 + scan(tree); 18.9 } finally { 18.10 pendingExits = null; 18.11 Flow.this.make = null;
19.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Apr 16 15:00:49 2013 -0700 19.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Wed Apr 17 21:50:43 2013 -0700 19.3 @@ -262,7 +262,7 @@ 19.4 UndetVar uv = (UndetVar)inferenceContext.asFree(t); 19.5 List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER); 19.6 if (Type.containsAny(upperBounds, vars)) { 19.7 - TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner); 19.8 + TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner); 19.9 fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null); 19.10 todo.append(uv); 19.11 uv.inst = fresh_tvar.type;
20.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue Apr 16 15:00:49 2013 -0700 20.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Apr 17 21:50:43 2013 -0700 20.3 @@ -48,6 +48,7 @@ 20.4 import static com.sun.tools.javac.code.TypeTag.*; 20.5 import static com.sun.tools.javac.jvm.ByteCodes.*; 20.6 import static com.sun.tools.javac.tree.JCTree.Tag.*; 20.7 +import javax.lang.model.type.TypeKind; 20.8 20.9 /** This pass translates away some syntactic sugar: inner classes, 20.10 * class literals, assertions, foreach loops, etc. 20.11 @@ -3400,8 +3401,11 @@ 20.12 if (iterableType.getTypeArguments().nonEmpty()) 20.13 iteratorTarget = types.erasure(iterableType.getTypeArguments().head); 20.14 Type eType = tree.expr.type; 20.15 + while (eType.hasTag(TYPEVAR)) { 20.16 + eType = eType.getUpperBound(); 20.17 + } 20.18 tree.expr.type = types.erasure(eType); 20.19 - if (eType.hasTag(TYPEVAR) && eType.getUpperBound().isCompound()) 20.20 + if (eType.isCompound()) 20.21 tree.expr = make.TypeCast(types.erasure(iterableType), tree.expr); 20.22 Symbol iterator = lookupMethod(tree.expr.pos(), 20.23 names.iterator,
21.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Apr 16 15:00:49 2013 -0700 21.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Apr 17 21:50:43 2013 -0700 21.3 @@ -3604,6 +3604,11 @@ 21.4 } 21.5 21.6 @Override 21.7 + public Symbol baseSymbol() { 21.8 + return delegatedError.baseSymbol(); 21.9 + } 21.10 + 21.11 + @Override 21.12 protected Symbol access(Name name, TypeSymbol location) { 21.13 return delegatedError.access(name, location); 21.14 }
22.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Tue Apr 16 15:00:49 2013 -0700 22.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Wed Apr 17 21:50:43 2013 -0700 22.3 @@ -40,6 +40,7 @@ 22.4 import static com.sun.tools.javac.code.TypeTag.CLASS; 22.5 import static com.sun.tools.javac.code.TypeTag.TYPEVAR; 22.6 import static com.sun.tools.javac.code.TypeTag.VOID; 22.7 +import static com.sun.tools.javac.comp.CompileStates.CompileState; 22.8 22.9 /** This pass translates Generic Java to conventional Java. 22.10 * 22.11 @@ -77,8 +78,11 @@ 22.12 */ 22.13 private final boolean addBridges; 22.14 22.15 + private final CompileStates compileStates; 22.16 + 22.17 protected TransTypes(Context context) { 22.18 context.put(transTypesKey, this); 22.19 + compileStates = CompileStates.instance(context); 22.20 names = Names.instance(context); 22.21 log = Log.instance(context); 22.22 syms = Symtab.instance(context); 22.23 @@ -706,8 +710,18 @@ 22.24 22.25 public void visitTypeCast(JCTypeCast tree) { 22.26 tree.clazz = translate(tree.clazz, null); 22.27 + Type originalTarget = tree.type; 22.28 tree.type = erasure(tree.type); 22.29 tree.expr = translate(tree.expr, tree.type); 22.30 + if (originalTarget.isCompound()) { 22.31 + Type.IntersectionClassType ict = (Type.IntersectionClassType)originalTarget; 22.32 + for (Type c : ict.getExplicitComponents()) { 22.33 + Type ec = erasure(c); 22.34 + if (!types.isSameType(ec, tree.type)) { 22.35 + tree.expr = coerce(tree.expr, ec); 22.36 + } 22.37 + } 22.38 + } 22.39 result = tree; 22.40 } 22.41 22.42 @@ -904,16 +918,40 @@ 22.43 22.44 private Env<AttrContext> env; 22.45 22.46 + private static final String statePreviousToFlowAssertMsg = 22.47 + "The current compile state [%s] of class %s is previous to FLOW"; 22.48 + 22.49 void translateClass(ClassSymbol c) { 22.50 Type st = types.supertype(c.type); 22.51 - 22.52 // process superclass before derived 22.53 - if (st.hasTag(CLASS)) 22.54 + if (st.hasTag(CLASS)) { 22.55 translateClass((ClassSymbol)st.tsym); 22.56 + } 22.57 22.58 Env<AttrContext> myEnv = enter.typeEnvs.remove(c); 22.59 - if (myEnv == null) 22.60 + if (myEnv == null) { 22.61 return; 22.62 + } 22.63 + 22.64 + /* The two assertions below are set for early detection of any attempt 22.65 + * to translate a class that: 22.66 + * 22.67 + * 1) has no compile state being it the most outer class. 22.68 + * We accept this condition for inner classes. 22.69 + * 22.70 + * 2) has a compile state which is previous to Flow state. 22.71 + */ 22.72 + boolean envHasCompState = compileStates.get(myEnv) != null; 22.73 + if (!envHasCompState && c.outermostClass() == c) { 22.74 + Assert.error("No info for outermost class: " + myEnv.enclClass.sym); 22.75 + } 22.76 + 22.77 + if (envHasCompState && 22.78 + CompileState.FLOW.isAfter(compileStates.get(myEnv))) { 22.79 + Assert.error(String.format(statePreviousToFlowAssertMsg, 22.80 + compileStates.get(myEnv), myEnv.enclClass.sym)); 22.81 + } 22.82 + 22.83 Env<AttrContext> oldEnv = env; 22.84 try { 22.85 env = myEnv;
23.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Tue Apr 16 15:00:49 2013 -0700 23.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Wed Apr 17 21:50:43 2013 -0700 23.3 @@ -1016,7 +1016,8 @@ 23.4 // log.errWriter.println("enter inner " + c);//DEBUG 23.5 enterInner(c.owner.enclClass()); 23.6 pool.put(c); 23.7 - pool.put(c.name); 23.8 + if (c.name != names.empty) 23.9 + pool.put(c.name); 23.10 if (innerClasses == null) { 23.11 innerClasses = new HashSet<ClassSymbol>(); 23.12 innerClassesQueue = new ListBuffer<ClassSymbol>();
24.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Apr 16 15:00:49 2013 -0700 24.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Apr 17 21:50:43 2013 -0700 24.3 @@ -25,6 +25,7 @@ 24.4 24.5 package com.sun.tools.javac.main; 24.6 24.7 +import com.sun.tools.javac.comp.CompileStates; 24.8 import java.io.*; 24.9 import java.util.HashMap; 24.10 import java.util.HashSet; 24.11 @@ -61,6 +62,7 @@ 24.12 import com.sun.tools.javac.tree.*; 24.13 import com.sun.tools.javac.tree.JCTree.*; 24.14 import com.sun.tools.javac.util.*; 24.15 +import com.sun.tools.javac.comp.CompileStates.CompileState; 24.16 import com.sun.tools.javac.util.Log.WriterKind; 24.17 24.18 import static com.sun.tools.javac.code.TypeTag.CLASS; 24.19 @@ -326,6 +328,8 @@ 24.20 **/ 24.21 protected boolean implicitSourceFilesRead; 24.22 24.23 + protected CompileStates compileStates; 24.24 + 24.25 /** Construct a new compiler using a shared context. 24.26 */ 24.27 public JavaCompiler(Context context) { 24.28 @@ -348,6 +352,7 @@ 24.29 24.30 fileManager = context.get(JavaFileManager.class); 24.31 parserFactory = ParserFactory.instance(context); 24.32 + compileStates = CompileStates.instance(context); 24.33 24.34 try { 24.35 // catch completion problems with predefineds 24.36 @@ -521,42 +526,6 @@ 24.37 */ 24.38 public List<Closeable> closeables = List.nil(); 24.39 24.40 - /** Ordered list of compiler phases for each compilation unit. */ 24.41 - public enum CompileState { 24.42 - INIT(0), 24.43 - PARSE(1), 24.44 - ENTER(2), 24.45 - PROCESS(3), 24.46 - ATTR(4), 24.47 - FLOW(5), 24.48 - TRANSTYPES(6), 24.49 - UNLAMBDA(7), 24.50 - LOWER(8), 24.51 - GENERATE(9); 24.52 - 24.53 - CompileState(int value) { 24.54 - this.value = value; 24.55 - } 24.56 - boolean isAfter(CompileState other) { 24.57 - return value > other.value; 24.58 - } 24.59 - public static CompileState max(CompileState a, CompileState b) { 24.60 - return a.value > b.value ? a : b; 24.61 - } 24.62 - private final int value; 24.63 - }; 24.64 - /** Partial map to record which compiler phases have been executed 24.65 - * for each compilation unit. Used for ATTR and FLOW phases. 24.66 - */ 24.67 - protected class CompileStates extends HashMap<Env<AttrContext>,CompileState> { 24.68 - private static final long serialVersionUID = 1812267524140424433L; 24.69 - boolean isDone(Env<AttrContext> env, CompileState cs) { 24.70 - CompileState ecs = get(env); 24.71 - return (ecs != null) && !cs.isAfter(ecs); 24.72 - } 24.73 - } 24.74 - private CompileStates compileStates = new CompileStates(); 24.75 - 24.76 /** The set of currently compiled inputfiles, needed to ensure 24.77 * we don't accidentally overwrite an input file when -s is set. 24.78 * initialized by `compile'. 24.79 @@ -1395,13 +1364,17 @@ 24.80 @Override 24.81 public void visitClassDef(JCClassDecl node) { 24.82 Type st = types.supertype(node.sym.type); 24.83 - if (st.hasTag(CLASS)) { 24.84 + boolean envForSuperTypeFound = false; 24.85 + while (!envForSuperTypeFound && st.hasTag(CLASS)) { 24.86 ClassSymbol c = st.tsym.outermostClass(); 24.87 Env<AttrContext> stEnv = enter.getEnv(c); 24.88 if (stEnv != null && env != stEnv) { 24.89 - if (dependencies.add(stEnv)) 24.90 + if (dependencies.add(stEnv)) { 24.91 scan(stEnv.tree); 24.92 + } 24.93 + envForSuperTypeFound = true; 24.94 } 24.95 + st = types.supertype(st); 24.96 } 24.97 super.visitClassDef(node); 24.98 }
25.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Apr 16 15:00:49 2013 -0700 25.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed Apr 17 21:50:43 2013 -0700 25.3 @@ -59,7 +59,6 @@ 25.4 import com.sun.tools.javac.jvm.*; 25.5 import com.sun.tools.javac.jvm.ClassReader.BadClassFile; 25.6 import com.sun.tools.javac.main.JavaCompiler; 25.7 -import com.sun.tools.javac.main.JavaCompiler.CompileState; 25.8 import com.sun.tools.javac.model.JavacElements; 25.9 import com.sun.tools.javac.model.JavacTypes; 25.10 import com.sun.tools.javac.parser.*; 25.11 @@ -79,6 +78,7 @@ 25.12 import com.sun.tools.javac.util.Options; 25.13 import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING; 25.14 import static com.sun.tools.javac.main.Option.*; 25.15 +import static com.sun.tools.javac.comp.CompileStates.CompileState; 25.16 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*; 25.17 25.18 /**
26.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Tue Apr 16 15:00:49 2013 -0700 26.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Apr 17 21:50:43 2013 -0700 26.3 @@ -249,23 +249,6 @@ 26.4 } 26.5 } 26.6 26.7 - /** Return true if a a tree corresponds to a poly expression. */ 26.8 - public static boolean isPoly(JCTree tree, JCTree origin) { 26.9 - switch (tree.getTag()) { 26.10 - case APPLY: 26.11 - case NEWCLASS: 26.12 - case CONDEXPR: 26.13 - return !origin.hasTag(TYPECAST); 26.14 - case LAMBDA: 26.15 - case REFERENCE: 26.16 - return true; 26.17 - case PARENS: 26.18 - return isPoly(((JCParens)tree).expr, origin); 26.19 - default: 26.20 - return false; 26.21 - } 26.22 - } 26.23 - 26.24 /** set 'polyKind' on given tree */ 26.25 public static void setPolyKind(JCTree tree, PolyKind pkind) { 26.26 switch (tree.getTag()) {
27.1 --- a/src/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java Tue Apr 16 15:00:49 2013 -0700 27.2 +++ b/src/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java Wed Apr 17 21:50:43 2013 -0700 27.3 @@ -61,6 +61,10 @@ 27.4 return type.tsym.getQualifiedName().toString(); 27.5 } 27.6 27.7 + public com.sun.javadoc.Type getElementType() { 27.8 + return null; 27.9 + } 27.10 + 27.11 public String simpleTypeName() { 27.12 return type.tsym.name.toString(); 27.13 }
28.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Tue Apr 16 15:00:49 2013 -0700 28.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Wed Apr 17 21:50:43 2013 -0700 28.3 @@ -108,6 +108,10 @@ 28.4 this.tsym = sym; 28.5 } 28.6 28.7 + public com.sun.javadoc.Type getElementType() { 28.8 + return null; 28.9 + } 28.10 + 28.11 /** 28.12 * Returns the flags in terms of javac's flags 28.13 */
29.1 --- a/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java Tue Apr 16 15:00:49 2013 -0700 29.2 +++ b/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java Wed Apr 17 21:50:43 2013 -0700 29.3 @@ -199,22 +199,15 @@ 29.4 return result; 29.5 } 29.6 29.7 - public AnnotationDesc[] receiverAnnotations() { 29.8 - // TODO: change how receiver annotations are output! 29.9 + /** 29.10 + * Get the receiver type of this executable element. 29.11 + * 29.12 + * @return the receiver type of this executable element. 29.13 + * @since 1.8 29.14 + */ 29.15 + public com.sun.javadoc.Type receiverType() { 29.16 Type recvtype = sym.type.asMethodType().recvtype; 29.17 - if (recvtype == null) { 29.18 - return new AnnotationDesc[0]; 29.19 - } 29.20 - if (!recvtype.isAnnotated()) { 29.21 - return new AnnotationDesc[0]; 29.22 - } 29.23 - List<? extends Compound> typeAnnos = ((com.sun.tools.javac.code.Type.AnnotatedType)recvtype).typeAnnotations; 29.24 - AnnotationDesc result[] = new AnnotationDesc[typeAnnos.length()]; 29.25 - int i = 0; 29.26 - for (Attribute.Compound a : typeAnnos) { 29.27 - result[i++] = new AnnotationDescImpl(env, a); 29.28 - } 29.29 - return result; 29.30 + return (recvtype != null) ? TypeMaker.getType(env, recvtype, false, true) : null; 29.31 } 29.32 29.33 /**
30.1 --- a/src/share/classes/com/sun/tools/javadoc/PrimitiveType.java Tue Apr 16 15:00:49 2013 -0700 30.2 +++ b/src/share/classes/com/sun/tools/javadoc/PrimitiveType.java Wed Apr 17 21:50:43 2013 -0700 30.3 @@ -63,6 +63,10 @@ 30.4 return name; 30.5 } 30.6 30.7 + public com.sun.javadoc.Type getElementType() { 30.8 + return null; 30.9 + } 30.10 + 30.11 /** 30.12 * Return qualified name of type excluding any dimension information. 30.13 *<p>
31.1 --- a/src/share/classes/com/sun/tools/javadoc/TypeMaker.java Tue Apr 16 15:00:49 2013 -0700 31.2 +++ b/src/share/classes/com/sun/tools/javadoc/TypeMaker.java Wed Apr 17 21:50:43 2013 -0700 31.3 @@ -222,6 +222,10 @@ 31.4 31.5 private com.sun.javadoc.Type skipArraysCache = null; 31.6 31.7 + public com.sun.javadoc.Type getElementType() { 31.8 + return TypeMaker.getType(env, env.types.elemtype(arrayType)); 31.9 + } 31.10 + 31.11 private com.sun.javadoc.Type skipArrays() { 31.12 if (skipArraysCache == null) { 31.13 Type t;
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Wed Apr 17 21:50:43 2013 -0700 32.3 @@ -0,0 +1,421 @@ 32.4 +/* 32.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.7 + * 32.8 + * This code is free software; you can redistribute it and/or modify it 32.9 + * under the terms of the GNU General Public License version 2 only, as 32.10 + * published by the Free Software Foundation. 32.11 + * 32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.15 + * version 2 for more details (a copy is included in the LICENSE file that 32.16 + * accompanied this code). 32.17 + * 32.18 + * You should have received a copy of the GNU General Public License version 32.19 + * 2 along with this work; if not, write to the Free Software Foundation, 32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.21 + * 32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 32.23 + * or visit www.oracle.com if you need additional information or have any 32.24 + * questions. 32.25 + */ 32.26 + 32.27 +/* 32.28 + * @test 32.29 + * @bug 8005091 8009686 32.30 + * @summary Make sure that type annotations are displayed correctly 32.31 + * @author Bhavesh Patel 32.32 + * @library ../lib/ 32.33 + * @build JavadocTester TestTypeAnnotations 32.34 + * @run main TestTypeAnnotations 32.35 + */ 32.36 + 32.37 +public class TestTypeAnnotations extends JavadocTester { 32.38 + 32.39 + //Test information. 32.40 + private static final String BUG_ID = "8005091-8009686"; 32.41 + 32.42 + //Javadoc arguments. 32.43 + private static final String[] ARGS = new String[] { 32.44 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-private", "typeannos" 32.45 + }; 32.46 + 32.47 + //Input for string search tests. 32.48 + private static final String[][] NEGATED_TEST = NO_TEST; 32.49 + private static final String[][] TEST = { 32.50 + // Test for type annotations on Class Extends (ClassExtends.java). 32.51 + /* @ignore 8012173 32.52 + {BUG_ID + FS + "typeannos" + FS + "MyClass.html", 32.53 + "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " + 32.54 + "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedClass.html\" " + 32.55 + "title=\"class in typeannos\">ParameterizedClass</a><<a href=\"" + 32.56 + "../typeannos/ClassExtB.html\" title=\"annotation in typeannos\">" + 32.57 + "@ClassExtB</a> java.lang.String>" 32.58 + }, 32.59 + */ 32.60 + /* @ignore 8012173 32.61 + {BUG_ID + FS + "typeannos" + FS + "MyClass.html", 32.62 + "implements <a href=\"../typeannos/ClassExtB.html\" title=\"" + 32.63 + "annotation in typeannos\">@ClassExtB</a> java.lang.CharSequence, " + 32.64 + "<a href=\"../typeannos/ClassExtA.html\" title=\"annotation in " + 32.65 + "typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedInterface.html\" " + 32.66 + "title=\"interface in typeannos\">ParameterizedInterface</a><" + 32.67 + "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in " + 32.68 + "typeannos\">@ClassExtB</a> java.lang.String></pre>" 32.69 + }, 32.70 + */ 32.71 + /* @ignore 8012173 32.72 + {BUG_ID + FS + "typeannos" + FS + "MyInterface.html", 32.73 + "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " + 32.74 + "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/" + 32.75 + "ParameterizedInterface.html\" title=\"interface in typeannos\">" + 32.76 + "ParameterizedInterface</a><<a href=\"../typeannos/ClassExtA.html\" " + 32.77 + "title=\"annotation in typeannos\">@ClassExtA</a> java.lang.String>, " + 32.78 + "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in " + 32.79 + "typeannos\">@ClassExtB</a> java.lang.CharSequence</pre>" 32.80 + }, 32.81 + */ 32.82 + 32.83 + // Test for type annotations on Class Parameters (ClassParameters.java). 32.84 + {BUG_ID + FS + "typeannos" + FS + "ExtendsBound.html", 32.85 + "class <span class=\"strong\">ExtendsBound<K extends <a " + 32.86 + "href=\"../typeannos/ClassParamA.html\" title=\"annotation in " + 32.87 + "typeannos\">@ClassParamA</a> java.lang.String></span>" 32.88 + }, 32.89 + /* @ignore 8012173 32.90 + {BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html", 32.91 + "<pre> class <span class=\"strong\">ExtendsGeneric<K extends " + 32.92 + "<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in " + 32.93 + "typeannos\">@ClassParamA</a> <a href=\"../typeannos/Unannotated.html\" " + 32.94 + "title=\"class in typeannos\">Unannotated</a><<a href=\"" + 32.95 + "../typeannos/ClassParamB.html\" title=\"annotation in typeannos\">" + 32.96 + "@ClassParamB</a> java.lang.String>></span>" 32.97 + }, 32.98 + */ 32.99 + {BUG_ID + FS + "typeannos" + FS + "TwoBounds.html", 32.100 + "<pre> class <span class=\"strong\">TwoBounds<K extends <a href=\"" + 32.101 + "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" + 32.102 + "@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos/" + 32.103 + "ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB" + 32.104 + "</a> java.lang.String></span>" 32.105 + }, 32.106 + {BUG_ID + FS + "typeannos" + FS + "Complex1.html", 32.107 + "class <span class=\"strong\">Complex1<K extends <a href=\"../" + 32.108 + "typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" + 32.109 + "@ClassParamA</a> java.lang.String & java.lang.Runnable></span>" 32.110 + }, 32.111 + {BUG_ID + FS + "typeannos" + FS + "Complex2.html", 32.112 + "class <span class=\"strong\">Complex2<K extends java.lang." + 32.113 + "String & <a href=\"../typeannos/ClassParamB.html\" title=\"" + 32.114 + "annotation in typeannos\">@ClassParamB</a> java.lang.Runnable></span>" 32.115 + }, 32.116 + {BUG_ID + FS + "typeannos" + FS + "ComplexBoth.html", 32.117 + "class <span class=\"strong\">ComplexBoth<K extends <a href=\"" + 32.118 + "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\"" + 32.119 + ">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/" + 32.120 + "ClassParamA.html\" title=\"annotation in typeannos\">@ClassParamA" + 32.121 + "</a> java.lang.Runnable></span>" 32.122 + }, 32.123 + 32.124 + // Test for type annotations on fields (Fields.java). 32.125 + /* @ignore 8012173 32.126 + {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html", 32.127 + "<pre><a href=\"../typeannos/Parameterized.html\" title=\"class in " + 32.128 + "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" " + 32.129 + "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a " + 32.130 + "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">" + 32.131 + "@FldB</a> java.lang.String> bothTypeArgs</pre>" 32.132 + }, 32.133 + */ 32.134 + {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html", 32.135 + "<pre><a href=\"../typeannos/FldA.html\" title=\"annotation in " + 32.136 + "typeannos\">@FldA</a> java.lang.String <a href=\"../typeannos/" + 32.137 + "FldB.html\" title=\"annotation in typeannos\">@FldB</a> [] " + 32.138 + "array1Deep</pre>" 32.139 + }, 32.140 + {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html", 32.141 + "<pre>java.lang.String[] <a href=\"../typeannos/FldB.html\" " + 32.142 + "title=\"annotation in typeannos\">@FldB</a> [] array2SecondOld</pre>" 32.143 + }, 32.144 + {BUG_ID + FS + "typeannos" + FS + "DefaultScope.html", 32.145 + "<pre><a href=\"../typeannos/FldD.html\" title=\"annotation in " + 32.146 + "typeannos\">@FldD</a> java.lang.String <a href=\"../typeannos/" + 32.147 + "FldC.html\" title=\"annotation in typeannos\">@FldC</a> <a href=\"" + 32.148 + "../typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA" + 32.149 + "</a> [] <a href=\"../typeannos/FldC.html\" title=\"annotation in " + 32.150 + "typeannos\">@FldC</a> <a href=\"../typeannos/FldB.html\" title=\"" + 32.151 + "annotation in typeannos\">@FldB</a> [] array2Deep</pre>" 32.152 + }, 32.153 + /* @ignore 8012173 32.154 + {BUG_ID + FS + "typeannos" + FS + "ModifiedScoped.html", 32.155 + "<pre>public final <a href=\"../typeannos/Parameterized.html\" " + 32.156 + "title=\"class in typeannos\">Parameterized</a><<a href=\"../" + 32.157 + "typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA</a> " + 32.158 + "<a href=\"../typeannos/Parameterized.html\" title=\"class in " + 32.159 + "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" " + 32.160 + "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a " + 32.161 + "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">" + 32.162 + "@FldB</a> java.lang.String>,<a href=\"../typeannos/FldB.html\" " + 32.163 + "title=\"annotation in typeannos\">@FldB</a> java.lang.String> " + 32.164 + "nestedParameterized</pre>" 32.165 + }, 32.166 + */ 32.167 + {BUG_ID + FS + "typeannos" + FS + "ModifiedScoped.html", 32.168 + "<pre>public final <a href=\"../typeannos/FldA.html\" " + 32.169 + "title=\"annotation in typeannos\">@FldA</a> java.lang.String[][] " + 32.170 + "array2</pre>" 32.171 + }, 32.172 + 32.173 + // Test for type annotations on method return types (MethodReturnType.java). 32.174 + {BUG_ID + FS + "typeannos" + FS + "MtdDefaultScope.html", 32.175 + "<pre>public <T> <a href=\"../typeannos/MRtnA.html\" " + 32.176 + "title=\"annotation in typeannos\">@MRtnA</a> java.lang.String" + 32.177 + " method()</pre>" 32.178 + }, 32.179 + {BUG_ID + FS + "typeannos" + FS + "MtdDefaultScope.html", 32.180 + "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " + 32.181 + "typeannos\">@MRtnA</a> java.lang.String <a href=\"../typeannos/" + 32.182 + "MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> [] <a " + 32.183 + "href=\"../typeannos/MRtnB.html\" title=\"annotation in typeannos\">" + 32.184 + "@MRtnB</a> [] array2Deep()</pre>" 32.185 + }, 32.186 + {BUG_ID + FS + "typeannos" + FS + "MtdDefaultScope.html", 32.187 + "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " + 32.188 + "typeannos\">@MRtnA</a> java.lang.String[][] array2()</pre>" 32.189 + }, 32.190 + /* @ignore 8012173 32.191 + {BUG_ID + FS + "typeannos" + FS + "MtdModifiedScoped.html", 32.192 + "<pre>public final <a href=\"../typeannos/MtdParameterized.html\" " + 32.193 + "title=\"class in typeannos\">MtdParameterized</a><<a href=\"../" + 32.194 + "typeannos/MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> " + 32.195 + "<a href=\"../typeannos/MtdParameterized.html\" title=\"class in " + 32.196 + "typeannos\">MtdParameterized</a><<a href=\"../typeannos/MRtnA." + 32.197 + "html\" title=\"annotation in typeannos\">@MRtnA</a> java.lang." + 32.198 + "String,<a href=\"../typeannos/MRtnB.html\" title=\"annotation in " + 32.199 + "typeannos\">@MRtnB</a> java.lang.String>,<a href=\"../typeannos/" + 32.200 + "MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> java." + 32.201 + "lang.String> nestedMtdParameterized()</pre>" 32.202 + }, 32.203 + */ 32.204 + 32.205 + // Test for type annotations on method type parameters (MethodTypeParameters.java). 32.206 + {BUG_ID + FS + "typeannos" + FS + "UnscopedUnmodified.html", 32.207 + "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" + 32.208 + "annotation in typeannos\">@MTyParamA</a> java.lang.String>" + 32.209 + " void methodExtends()</pre>" 32.210 + }, 32.211 + /* @ignore 8012173 32.212 + {BUG_ID + FS + "typeannos" + FS + "UnscopedUnmodified.html", 32.213 + "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" + 32.214 + "annotation in typeannos\">@MTyParamA</a> <a href=\"../typeannos/" + 32.215 + "MtdTyParameterized.html\" title=\"class in typeannos\">" + 32.216 + "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " + 32.217 + "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" + 32.218 + ">> void nestedExtends()</pre>" 32.219 + }, 32.220 + */ 32.221 + {BUG_ID + FS + "typeannos" + FS + "PublicModifiedMethods.html", 32.222 + "<pre>public final <K extends <a href=\"../typeannos/" + 32.223 + "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " + 32.224 + "java.lang.String> void methodExtends()</pre>" 32.225 + }, 32.226 + /* @ignore 8012173 32.227 + {BUG_ID + FS + "typeannos" + FS + "PublicModifiedMethods.html", 32.228 + "<pre>public final <K extends <a href=\"../typeannos/" + 32.229 + "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " + 32.230 + "java.lang.String,V extends <a href=\"../typeannos/MTyParamA.html\" " + 32.231 + "title=\"annotation in typeannos\">@MTyParamA</a> <a href=\"../" + 32.232 + "typeannos/MtdTyParameterized.html\" title=\"class in typeannos\">" + 32.233 + "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " + 32.234 + "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" + 32.235 + ">> void dual()</pre>" 32.236 + }, 32.237 + */ 32.238 + 32.239 + // Test for type annotations on parameters (Parameters.java). 32.240 + {BUG_ID + FS + "typeannos" + FS + "Parameters.html", 32.241 + "<pre>void unannotated(<a href=\"../typeannos/" + 32.242 + "ParaParameterized.html\" title=\"class in typeannos\">" + 32.243 + "ParaParameterized</a><java.lang.String,java.lang.String>" + 32.244 + " a)</pre>" 32.245 + }, 32.246 + /* @ignore 8012173 32.247 + {BUG_ID + FS + "typeannos" + FS + "Parameters.html", 32.248 + "<pre>void nestedParaParameterized(<a href=\"../typeannos/" + 32.249 + "ParaParameterized.html\" title=\"class in typeannos\">" + 32.250 + "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" " + 32.251 + "title=\"annotation in typeannos\">@ParamA</a> <a href=\"../" + 32.252 + "typeannos/ParaParameterized.html\" title=\"class in typeannos\">" + 32.253 + "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" " + 32.254 + "title=\"annotation in typeannos\">@ParamA</a> java.lang.String," + 32.255 + "<a href=\"../typeannos/ParamB.html\" title=\"annotation in " + 32.256 + "typeannos\">@ParamB</a> java.lang.String>,<a href=\"../" + 32.257 + "typeannos/ParamB.html\" title=\"annotation in typeannos\">@ParamB" + 32.258 + "</a> java.lang.String> a)</pre>" 32.259 + }, 32.260 + */ 32.261 + {BUG_ID + FS + "typeannos" + FS + "Parameters.html", 32.262 + "<pre>void array2Deep(<a href=\"../typeannos/ParamA.html\" " + 32.263 + "title=\"annotation in typeannos\">@ParamA</a> java.lang.String " + 32.264 + "<a href=\"../typeannos/ParamA.html\" title=\"annotation in " + 32.265 + "typeannos\">@ParamA</a> [] <a href=\"../typeannos/ParamB.html\" " + 32.266 + "title=\"annotation in typeannos\">@ParamB</a> [] a)</pre>" 32.267 + }, 32.268 + 32.269 + // Test for type annotations on throws (Throws.java). 32.270 + {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html", 32.271 + "<pre>void oneException()" + NL + 32.272 + " throws <a href=\"../typeannos/ThrA.html\" title=\"" + 32.273 + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 32.274 + }, 32.275 + {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html", 32.276 + "<pre>void twoExceptions()" + NL + 32.277 + " throws <a href=\"../typeannos/ThrA.html\" title=\"" + 32.278 + "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException," + NL + 32.279 + " <a href=\"../typeannos/ThrA.html\" title=\"" + 32.280 + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 32.281 + }, 32.282 + {BUG_ID + FS + "typeannos" + FS + "ThrPublicModified.html", 32.283 + "<pre>public final void oneException(java.lang.String a)" + NL + 32.284 + " throws <a href=\"../typeannos/ThrA.html\" " + 32.285 + "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 32.286 + }, 32.287 + {BUG_ID + FS + "typeannos" + FS + "ThrPublicModified.html", 32.288 + "<pre>public final void twoExceptions(java.lang.String a)" + NL + 32.289 + " throws <a href=\"../typeannos/ThrA.html\" " + 32.290 + "title=\"annotation in typeannos\">@ThrA</a> java.lang.RuntimeException," + NL + 32.291 + " <a href=\"../typeannos/ThrA.html\" " + 32.292 + "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 32.293 + }, 32.294 + {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html", 32.295 + "<pre>void oneException()" + NL + 32.296 + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + 32.297 + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" + 32.298 + "ThrB.html#value()\">value</a>=\"m\") java.lang.Exception</pre>" 32.299 + }, 32.300 + {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html", 32.301 + "<pre>void twoExceptions()" + NL + 32.302 + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + 32.303 + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" + 32.304 + "ThrB.html#value()\">value</a>=\"m\") java.lang.RuntimeException," + NL + 32.305 + " <a href=\"../typeannos/ThrA.html\" title=\"" + 32.306 + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 32.307 + }, 32.308 + 32.309 + // Test for type annotations on type parameters (TypeParameters.java). 32.310 + {BUG_ID + FS + "typeannos" + FS + "TestMethods.html", 32.311 + "<pre><K,V extends <a href=\"../typeannos/TyParaA.html\" title=\"" + 32.312 + "annotation in typeannos\">@TyParaA</a> java.lang.String> " + 32.313 + "void secondAnnotated()</pre>" 32.314 + }, 32.315 + 32.316 + // Test for type annotations on wildcard type (Wildcards.java). 32.317 + {BUG_ID + FS + "typeannos" + FS + "BoundTest.html", 32.318 + "<pre>void wcExtends(<a href=\"../typeannos/MyList.html\" " + 32.319 + "title=\"class in typeannos\">MyList</a><? extends <a href=\"" + 32.320 + "../typeannos/WldA.html\" title=\"annotation in typeannos\">@WldA" + 32.321 + "</a> java.lang.String> l)</pre>" 32.322 + }, 32.323 + {BUG_ID + FS + "typeannos" + FS + "BoundTest.html", 32.324 + "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " + 32.325 + "typeannos\">MyList</a><? super <a href=\"../typeannos/WldA.html\" " + 32.326 + "title=\"annotation in typeannos\">@WldA</a> java.lang.String>" + 32.327 + " returnWcSuper()</pre>" 32.328 + }, 32.329 + {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html", 32.330 + "<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" + 32.331 + "class in typeannos\">MyList</a><? super <a href=\"../typeannos/" + 32.332 + "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" + 32.333 + "../typeannos/WldB.html#value()\">value</a>=\"m\") java.lang." + 32.334 + "String> l)</pre>" 32.335 + }, 32.336 + {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html", 32.337 + "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " + 32.338 + "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." + 32.339 + "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" + 32.340 + "typeannos/WldB.html#value()\">value</a>=\"m\") java.lang.String" + 32.341 + "> returnWcExtends()</pre>" 32.342 + }, 32.343 + 32.344 + // Test for receiver annotations (Receivers.java). 32.345 + {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html", 32.346 + "<pre>void withException(<a href=\"../typeannos/RcvrA.html\" " + 32.347 + "title=\"annotation in typeannos\">@RcvrA</a> " + 32.348 + "DefaultUnmodified this)" + NL + " throws java." + 32.349 + "lang.Exception</pre>" 32.350 + }, 32.351 + {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html", 32.352 + "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA." + 32.353 + "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" + 32.354 + "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" + 32.355 + "</a>(<a href=\"../typeannos/RcvrB.html#value()\">value</a>=\"m\")" + 32.356 + " DefaultUnmodified this)</pre>" 32.357 + }, 32.358 + {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html", 32.359 + "<pre><T extends java.lang.Runnable> void accept(" + 32.360 + "<a href=\"../typeannos/RcvrA.html\" title=\"annotation in " + 32.361 + "typeannos\">@RcvrA</a> DefaultUnmodified this," + NL + 32.362 + " T r)" + NL + 32.363 + " throws java.lang.Exception</pre>" 32.364 + }, 32.365 + {BUG_ID + FS + "typeannos" + FS + "PublicModified.html", 32.366 + "<pre>public final java.lang.String nonVoid(<a href=\"" + 32.367 + "../typeannos/RcvrA.html\" title=\"annotation in typeannos\">" + 32.368 + "@RcvrA</a> PublicModified this)</pre>" 32.369 + }, 32.370 + {BUG_ID + FS + "typeannos" + FS + "PublicModified.html", 32.371 + "<pre>public final <T extends java.lang.Runnable> " + 32.372 + "void accept(<a href=\"../typeannos/RcvrA.html\" title=\"" + 32.373 + "annotation in typeannos\">@RcvrA</a> PublicModified this," + NL + 32.374 + " T r)" + NL + 32.375 + " throws java.lang.Exception</pre>" 32.376 + }, 32.377 + {BUG_ID + FS + "typeannos" + FS + "WithValue.html", 32.378 + "<pre><T extends java.lang.Runnable> void accept(" + 32.379 + "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " + 32.380 + "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value()\">" + 32.381 + "value</a>=\"m\") WithValue this," + NL + 32.382 + " T r)" + NL + 32.383 + " throws java.lang.Exception</pre>" 32.384 + }, 32.385 + {BUG_ID + FS + "typeannos" + FS + "WithFinal.html", 32.386 + "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB." + 32.387 + "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" + 32.388 + "typeannos/RcvrB.html#value()\">value</a>=\"m\") WithFinal" + 32.389 + " this)</pre>" 32.390 + }, 32.391 + {BUG_ID + FS + "typeannos" + FS + "WithBody.html", 32.392 + "<pre>void field(<a href=\"../typeannos/RcvrA.html\" title=\"" + 32.393 + "annotation in typeannos\">@RcvrA</a> WithBody this)</pre>" 32.394 + }, 32.395 + {BUG_ID + FS + "typeannos" + FS + "Generic2.html", 32.396 + "<pre>void test2(<a href=\"../typeannos/RcvrA.html\" title=\"" + 32.397 + "annotation in typeannos\">@RcvrA</a> Generic2<X> this)</pre>" 32.398 + } 32.399 + }; 32.400 + 32.401 + /** 32.402 + * The entry point of the test. 32.403 + * @param args the array of command line arguments. 32.404 + */ 32.405 + public static void main(String[] args) { 32.406 + TestTypeAnnotations tester = new TestTypeAnnotations(); 32.407 + run(tester, ARGS, TEST, NEGATED_TEST); 32.408 + tester.printSummary(); 32.409 + } 32.410 + 32.411 + /** 32.412 + * {@inheritDoc} 32.413 + */ 32.414 + public String getBugId() { 32.415 + return BUG_ID; 32.416 + } 32.417 + 32.418 + /** 32.419 + * {@inheritDoc} 32.420 + */ 32.421 + public String getBugName() { 32.422 + return getClass().getName(); 32.423 + } 32.424 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/ClassExtends.java Wed Apr 17 21:50:43 2013 -0700 33.3 @@ -0,0 +1,45 @@ 33.4 +/* 33.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.7 + * 33.8 + * This code is free software; you can redistribute it and/or modify it 33.9 + * under the terms of the GNU General Public License version 2 only, as 33.10 + * published by the Free Software Foundation. 33.11 + * 33.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 33.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33.15 + * version 2 for more details (a copy is included in the LICENSE file that 33.16 + * accompanied this code). 33.17 + * 33.18 + * You should have received a copy of the GNU General Public License version 33.19 + * 2 along with this work; if not, write to the Free Software Foundation, 33.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 33.21 + * 33.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 33.23 + * or visit www.oracle.com if you need additional information or have any 33.24 + * questions. 33.25 + */ 33.26 + 33.27 +package typeannos; 33.28 + 33.29 +import java.lang.annotation.*; 33.30 + 33.31 +/* 33.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 33.33 + */ 33.34 +abstract class MyClass extends @ClassExtA ParameterizedClass<@ClassExtB String> 33.35 + implements @ClassExtB CharSequence, @ClassExtA ParameterizedInterface<@ClassExtB String> { } 33.36 + 33.37 +interface MyInterface extends @ClassExtA ParameterizedInterface<@ClassExtA String>, 33.38 + @ClassExtB CharSequence { } 33.39 + 33.40 +class ParameterizedClass<K> {} 33.41 +interface ParameterizedInterface<K> {} 33.42 + 33.43 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 33.44 +@Documented 33.45 +@interface ClassExtA {} 33.46 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 33.47 +@Documented 33.48 +@interface ClassExtB {}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/ClassParameters.java Wed Apr 17 21:50:43 2013 -0700 34.3 @@ -0,0 +1,60 @@ 34.4 +/* 34.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.7 + * 34.8 + * This code is free software; you can redistribute it and/or modify it 34.9 + * under the terms of the GNU General Public License version 2 only, as 34.10 + * published by the Free Software Foundation. 34.11 + * 34.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 34.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 34.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 34.15 + * version 2 for more details (a copy is included in the LICENSE file that 34.16 + * accompanied this code). 34.17 + * 34.18 + * You should have received a copy of the GNU General Public License version 34.19 + * 2 along with this work; if not, write to the Free Software Foundation, 34.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 34.21 + * 34.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 34.23 + * or visit www.oracle.com if you need additional information or have any 34.24 + * questions. 34.25 + */ 34.26 + 34.27 +package typeannos; 34.28 + 34.29 +import java.lang.annotation.*; 34.30 + 34.31 +/* 34.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 34.33 + */ 34.34 +class Unannotated<K> { } 34.35 + 34.36 +class ExtendsBound<K extends @ClassParamA String> { } 34.37 +class ExtendsGeneric<K extends @ClassParamA Unannotated<@ClassParamB String>> { } 34.38 +class TwoBounds<K extends @ClassParamA String, V extends @ClassParamB String> { } 34.39 + 34.40 +class Complex1<K extends @ClassParamA String&Runnable> { } 34.41 +class Complex2<K extends String & @ClassParamB Runnable> { } 34.42 +class ComplexBoth<K extends @ClassParamA String & @ClassParamA Runnable> { } 34.43 + 34.44 +class ClassParamOuter { 34.45 + void inner() { 34.46 + class LUnannotated<K> { } 34.47 + 34.48 + class LExtendsBound<K extends @ClassParamA String> { } 34.49 + class LExtendsGeneric<K extends @ClassParamA LUnannotated<@ClassParamB String>> { } 34.50 + class LTwoBounds<K extends @ClassParamA String, V extends @ClassParamB String> { } 34.51 + 34.52 + class LComplex1<K extends @ClassParamA String&Runnable> { } 34.53 + class LComplex2<K extends String & @ClassParamB Runnable> { } 34.54 + class LComplexBoth<K extends @ClassParamA String & @ClassParamA Runnable> { } 34.55 + } 34.56 +} 34.57 + 34.58 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 34.59 +@Documented 34.60 +@interface ClassParamA { } 34.61 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 34.62 +@Documented 34.63 +@interface ClassParamB { }
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 35.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Fields.java Wed Apr 17 21:50:43 2013 -0700 35.3 @@ -0,0 +1,82 @@ 35.4 +/* 35.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.7 + * 35.8 + * This code is free software; you can redistribute it and/or modify it 35.9 + * under the terms of the GNU General Public License version 2 only, as 35.10 + * published by the Free Software Foundation. 35.11 + * 35.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 35.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 35.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 35.15 + * version 2 for more details (a copy is included in the LICENSE file that 35.16 + * accompanied this code). 35.17 + * 35.18 + * You should have received a copy of the GNU General Public License version 35.19 + * 2 along with this work; if not, write to the Free Software Foundation, 35.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 35.21 + * 35.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 35.23 + * or visit www.oracle.com if you need additional information or have any 35.24 + * questions. 35.25 + */ 35.26 + 35.27 +package typeannos; 35.28 + 35.29 +import java.lang.annotation.*; 35.30 + 35.31 +/* 35.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 35.33 + */ 35.34 +class DefaultScope { 35.35 + Parameterized<String, String> unannotated; 35.36 + Parameterized<@FldA String, String> firstTypeArg; 35.37 + Parameterized<String, @FldA String> secondTypeArg; 35.38 + Parameterized<@FldA String, @FldB String> bothTypeArgs; 35.39 + 35.40 + Parameterized<@FldA Parameterized<@FldA String, @FldB String>, @FldB String> 35.41 + nestedParameterized; 35.42 + 35.43 + @FldA String [] array1; 35.44 + @FldA String @FldB [] array1Deep; 35.45 + @FldA String [] [] array2; 35.46 + @FldD String @FldC @FldA [] @FldC @FldB [] array2Deep; 35.47 + String @FldA [] [] array2First; 35.48 + String [] @FldB [] array2Second; 35.49 + 35.50 + // Old-style array syntax 35.51 + String array2FirstOld @FldA []; 35.52 + String array2SecondOld [] @FldB []; 35.53 +} 35.54 + 35.55 +class ModifiedScoped { 35.56 + public final Parameterized<String, String> unannotated = null; 35.57 + public final Parameterized<@FldA String, String> firstTypeArg = null; 35.58 + public final Parameterized<String, @FldA String> secondTypeArg = null; 35.59 + public final Parameterized<@FldA String, @FldB String> bothTypeArgs = null; 35.60 + 35.61 + public final Parameterized<@FldA Parameterized<@FldA String, @FldB String>, @FldB String> 35.62 + nestedParameterized = null; 35.63 + 35.64 + public final @FldA String [] array1 = null; 35.65 + public final @FldA String @FldB [] array1Deep = null; 35.66 + public final @FldA String [] [] array2 = null; 35.67 + public final @FldA String @FldA [] @FldB [] array2Deep = null; 35.68 + public final String @FldA [] [] array2First = null; 35.69 + public final String [] @FldB [] array2Second = null; 35.70 +} 35.71 + 35.72 +class Parameterized<K, V> { } 35.73 + 35.74 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 35.75 +@Documented 35.76 +@interface FldA { } 35.77 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 35.78 +@Documented 35.79 +@interface FldB { } 35.80 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 35.81 +@Documented 35.82 +@interface FldC { } 35.83 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 35.84 +@Documented 35.85 +@interface FldD { }
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/MethodReturnType.java Wed Apr 17 21:50:43 2013 -0700 36.3 @@ -0,0 +1,78 @@ 36.4 +/* 36.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.7 + * 36.8 + * This code is free software; you can redistribute it and/or modify it 36.9 + * under the terms of the GNU General Public License version 2 only, as 36.10 + * published by the Free Software Foundation. 36.11 + * 36.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 36.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 36.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 36.15 + * version 2 for more details (a copy is included in the LICENSE file that 36.16 + * accompanied this code). 36.17 + * 36.18 + * You should have received a copy of the GNU General Public License version 36.19 + * 2 along with this work; if not, write to the Free Software Foundation, 36.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 36.21 + * 36.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 36.23 + * or visit www.oracle.com if you need additional information or have any 36.24 + * questions. 36.25 + */ 36.26 + 36.27 +package typeannos; 36.28 + 36.29 +import java.lang.annotation.*; 36.30 + 36.31 +/* 36.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 36.33 + */ 36.34 +class MtdDefaultScope { 36.35 + MtdParameterized<String, String> unannotated() { return null; } 36.36 + MtdParameterized<@MRtnA String, String> firstTypeArg() { return null; } 36.37 + MtdParameterized<String, @MRtnA String> secondTypeArg() { return null; } 36.38 + MtdParameterized<@MRtnA String, @MRtnB String> bothTypeArgs() { return null; } 36.39 + 36.40 + MtdParameterized<@MRtnA MtdParameterized<@MRtnA String, @MRtnB String>, @MRtnB String> 36.41 + nestedMtdParameterized() { return null; } 36.42 + 36.43 + public <T> @MRtnA String method() { return null; } 36.44 + 36.45 + @MRtnA String [] array1() { return null; } 36.46 + @MRtnA String @MRtnB [] array1Deep() { return null; } 36.47 + @MRtnA String [] [] array2() { return null; } 36.48 + @MRtnA String @MRtnA [] @MRtnB [] array2Deep() { return null; } 36.49 + String @MRtnA [] [] array2First() { return null; } 36.50 + String [] @MRtnB [] array2Second() { return null; } 36.51 + 36.52 + // Old-style array syntax 36.53 + String array2FirstOld() @MRtnA [] { return null; } 36.54 + String array2SecondOld() [] @MRtnB [] { return null; } 36.55 +} 36.56 + 36.57 +class MtdModifiedScoped { 36.58 + public final MtdParameterized<String, String> unannotated() { return null; } 36.59 + public final MtdParameterized<@MRtnA String, String> firstTypeArg() { return null; } 36.60 + public final MtdParameterized<String, @MRtnA String> secondTypeArg() { return null; } 36.61 + public final MtdParameterized<@MRtnA String, @MRtnB String> bothTypeArgs() { return null; } 36.62 + 36.63 + public final MtdParameterized<@MRtnA MtdParameterized<@MRtnA String, @MRtnB String>, @MRtnB String> 36.64 + nestedMtdParameterized() { return null; } 36.65 + 36.66 + public final @MRtnA String [] array1() { return null; } 36.67 + public final @MRtnA String @MRtnB [] array1Deep() { return null; } 36.68 + public final @MRtnA String [] [] array2() { return null; } 36.69 + public final @MRtnA String @MRtnA [] @MRtnB [] array2Deep() { return null; } 36.70 + public final String @MRtnA [] [] array2First() { return null; } 36.71 + public final String [] @MRtnB [] array2Second() { return null; } 36.72 +} 36.73 + 36.74 +class MtdParameterized<K, V> { } 36.75 + 36.76 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 36.77 +@Documented 36.78 +@interface MRtnA { } 36.79 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 36.80 +@Documented 36.81 +@interface MRtnB { }
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/MethodTypeParameters.java Wed Apr 17 21:50:43 2013 -0700 37.3 @@ -0,0 +1,52 @@ 37.4 +/* 37.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.7 + * 37.8 + * This code is free software; you can redistribute it and/or modify it 37.9 + * under the terms of the GNU General Public License version 2 only, as 37.10 + * published by the Free Software Foundation. 37.11 + * 37.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 37.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 37.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 37.15 + * version 2 for more details (a copy is included in the LICENSE file that 37.16 + * accompanied this code). 37.17 + * 37.18 + * You should have received a copy of the GNU General Public License version 37.19 + * 2 along with this work; if not, write to the Free Software Foundation, 37.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 37.21 + * 37.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 37.23 + * or visit www.oracle.com if you need additional information or have any 37.24 + * questions. 37.25 + */ 37.26 + 37.27 +package typeannos; 37.28 + 37.29 +import java.lang.annotation.*; 37.30 + 37.31 +/* 37.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 37.33 + */ 37.34 +class UnscopedUnmodified { 37.35 + <K extends @MTyParamA String> void methodExtends() {} 37.36 + <K extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void nestedExtends() {} 37.37 + <K extends @MTyParamA String, V extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void dual() {} 37.38 + <K extends String, V extends MtdTyParameterized<@MTyParamB String>> void dualOneAnno() {} 37.39 +} 37.40 + 37.41 +class PublicModifiedMethods { 37.42 + public final <K extends @MTyParamA String> void methodExtends() {} 37.43 + public final <K extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void nestedExtends() {} 37.44 + public final <K extends @MTyParamA String, V extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void dual() {} 37.45 + public final <K extends String, V extends MtdTyParameterized<@MTyParamB String>> void dualOneAnno() {} 37.46 +} 37.47 + 37.48 +class MtdTyParameterized<K> { } 37.49 + 37.50 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 37.51 +@Documented 37.52 +@interface MTyParamA { } 37.53 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 37.54 +@Documented 37.55 +@interface MTyParamB { }
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Parameters.java Wed Apr 17 21:50:43 2013 -0700 38.3 @@ -0,0 +1,54 @@ 38.4 +/* 38.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 38.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.7 + * 38.8 + * This code is free software; you can redistribute it and/or modify it 38.9 + * under the terms of the GNU General Public License version 2 only, as 38.10 + * published by the Free Software Foundation. 38.11 + * 38.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 38.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 38.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 38.15 + * version 2 for more details (a copy is included in the LICENSE file that 38.16 + * accompanied this code). 38.17 + * 38.18 + * You should have received a copy of the GNU General Public License version 38.19 + * 2 along with this work; if not, write to the Free Software Foundation, 38.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 38.21 + * 38.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 38.23 + * or visit www.oracle.com if you need additional information or have any 38.24 + * questions. 38.25 + */ 38.26 + 38.27 +package typeannos; 38.28 + 38.29 +import java.lang.annotation.*; 38.30 + 38.31 +/* 38.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 38.33 + */ 38.34 +class Parameters { 38.35 + void unannotated(ParaParameterized<String, String> a) {} 38.36 + void firstTypeArg(ParaParameterized<@ParamA String, String> a) {} 38.37 + void secondTypeArg(ParaParameterized<String, @ParamA String> a) {} 38.38 + void bothTypeArgs(ParaParameterized<@ParamA String, @ParamB String> both) {} 38.39 + 38.40 + void nestedParaParameterized(ParaParameterized<@ParamA ParaParameterized<@ParamA String, @ParamB String>, @ParamB String> a) {} 38.41 + 38.42 + void array1(@ParamA String [] a) {} 38.43 + void array1Deep(@ParamA String @ParamB [] a) {} 38.44 + void array2(@ParamA String [] [] a) {} 38.45 + void array2Deep(@ParamA String @ParamA [] @ParamB [] a) {} 38.46 + void array2First(String @ParamA [] [] a) {} 38.47 + void array2Second(String [] @ParamB [] a) {} 38.48 +} 38.49 + 38.50 +class ParaParameterized<K, V> { } 38.51 + 38.52 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 38.53 +@Documented 38.54 +@interface ParamA { } 38.55 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 38.56 +@Documented 38.57 +@interface ParamB { }
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Receivers.java Wed Apr 17 21:50:43 2013 -0700 39.3 @@ -0,0 +1,131 @@ 39.4 +/* 39.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 39.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.7 + * 39.8 + * This code is free software; you can redistribute it and/or modify it 39.9 + * under the terms of the GNU General Public License version 2 only, as 39.10 + * published by the Free Software Foundation. 39.11 + * 39.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 39.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.15 + * version 2 for more details (a copy is included in the LICENSE file that 39.16 + * accompanied this code). 39.17 + * 39.18 + * You should have received a copy of the GNU General Public License version 39.19 + * 2 along with this work; if not, write to the Free Software Foundation, 39.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.21 + * 39.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 39.23 + * or visit www.oracle.com if you need additional information or have any 39.24 + * questions. 39.25 + */ 39.26 + 39.27 +package typeannos; 39.28 + 39.29 +import java.lang.annotation.*; 39.30 + 39.31 +/* 39.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 39.33 + */ 39.34 +class DefaultUnmodified { 39.35 + void plain(@RcvrA DefaultUnmodified this) { } 39.36 + <T> void generic(@RcvrA DefaultUnmodified this) { } 39.37 + void withException(@RcvrA DefaultUnmodified this) throws Exception { } 39.38 + String nonVoid(@RcvrA @RcvrB("m") DefaultUnmodified this) { return null; } 39.39 + <T extends Runnable> void accept(@RcvrA DefaultUnmodified this, T r) throws Exception { } 39.40 +} 39.41 + 39.42 +class PublicModified { 39.43 + public final void plain(@RcvrA PublicModified this) { } 39.44 + public final <T> void generic(@RcvrA PublicModified this) { } 39.45 + public final void withException(@RcvrA PublicModified this) throws Exception { } 39.46 + public final String nonVoid(@RcvrA PublicModified this) { return null; } 39.47 + public final <T extends Runnable> void accept(@RcvrA PublicModified this, T r) throws Exception { } 39.48 +} 39.49 + 39.50 +class WithValue { 39.51 + void plain(@RcvrB("m") WithValue this) { } 39.52 + <T> void generic(@RcvrB("m") WithValue this) { } 39.53 + void withException(@RcvrB("m") WithValue this) throws Exception { } 39.54 + String nonVoid(@RcvrB("m") WithValue this) { return null; } 39.55 + <T extends Runnable> void accept(@RcvrB("m") WithValue this, T r) throws Exception { } 39.56 +} 39.57 + 39.58 +class WithFinal { 39.59 + void plain(final @RcvrB("m") WithFinal this) { } 39.60 + <T> void generic(final @RcvrB("m") WithFinal this) { } 39.61 + void withException(final @RcvrB("m") WithFinal this) throws Exception { } 39.62 + String nonVoid(final @RcvrB("m") WithFinal this) { return null; } 39.63 + <T extends Runnable> void accept(final @RcvrB("m") WithFinal this, T r) throws Exception { } 39.64 +} 39.65 + 39.66 +class WithBody { 39.67 + Object f; 39.68 + 39.69 + void field(@RcvrA WithBody this) { 39.70 + this.f = null; 39.71 + } 39.72 + void meth(@RcvrA WithBody this) { 39.73 + this.toString(); 39.74 + } 39.75 +} 39.76 + 39.77 +class Generic1<X> { 39.78 + void test1(Generic1<X> this) {} 39.79 + void test2(@RcvrA Generic1<X> this) {} 39.80 + void test3(Generic1<@RcvrA X> this) {} 39.81 + void test4(@RcvrA Generic1<@RcvrA X> this) {} 39.82 +} 39.83 + 39.84 +class Generic2<@RcvrA X> { 39.85 + void test1(Generic2<X> this) {} 39.86 + void test2(@RcvrA Generic2<X> this) {} 39.87 + void test3(Generic2<@RcvrA X> this) {} 39.88 + void test4(@RcvrA Generic2<@RcvrA X> this) {} 39.89 +} 39.90 + 39.91 +class Generic3<X extends @RcvrA Object> { 39.92 + void test1(Generic3<X> this) {} 39.93 + void test2(@RcvrA Generic3<X> this) {} 39.94 + void test3(Generic3<@RcvrA X> this) {} 39.95 + void test4(@RcvrA Generic3<@RcvrA X> this) {} 39.96 +} 39.97 + 39.98 +class Generic4<X extends @RcvrA Object> { 39.99 + <Y> void test1(Generic4<X> this) {} 39.100 + <Y> void test2(@RcvrA Generic4<X> this) {} 39.101 + <Y> void test3(Generic4<@RcvrA X> this) {} 39.102 + <Y> void test4(@RcvrA Generic4<@RcvrA X> this) {} 39.103 +} 39.104 + 39.105 +class Outer { 39.106 + class Inner { 39.107 + void none(Outer.Inner this) {} 39.108 + void outer(@RcvrA Outer.Inner this) {} 39.109 + void inner(Outer. @RcvrB("i") Inner this) {} 39.110 + void both(@RcvrA Outer.@RcvrB("i") Inner this) {} 39.111 + 39.112 + void innerOnlyNone(Inner this) {} 39.113 + void innerOnly(@RcvrA Inner this) {} 39.114 + } 39.115 +} 39.116 + 39.117 +class GenericOuter<S, T> { 39.118 + class GenericInner<U, V> { 39.119 + void none(GenericOuter<S, T>.GenericInner<U, V> this) {} 39.120 + void outer(@RcvrA GenericOuter<S, T>.GenericInner<U, V> this) {} 39.121 + void inner(GenericOuter<S, T>. @RcvrB("i") GenericInner<U, V> this) {} 39.122 + void both(@RcvrA GenericOuter<S, T>.@RcvrB("i") GenericInner<U, V> this) {} 39.123 + 39.124 + void innerOnlyNone(GenericInner<U, V> this) {} 39.125 + void innerOnly(@RcvrA GenericInner<U, V> this) {} 39.126 + } 39.127 +} 39.128 + 39.129 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 39.130 +@Documented 39.131 +@interface RcvrA {} 39.132 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 39.133 +@Documented 39.134 +@interface RcvrB { String value(); }
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Throws.java Wed Apr 17 21:50:43 2013 -0700 40.3 @@ -0,0 +1,51 @@ 40.4 +/* 40.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.7 + * 40.8 + * This code is free software; you can redistribute it and/or modify it 40.9 + * under the terms of the GNU General Public License version 2 only, as 40.10 + * published by the Free Software Foundation. 40.11 + * 40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 40.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 40.15 + * version 2 for more details (a copy is included in the LICENSE file that 40.16 + * accompanied this code). 40.17 + * 40.18 + * You should have received a copy of the GNU General Public License version 40.19 + * 2 along with this work; if not, write to the Free Software Foundation, 40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 40.21 + * 40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 40.23 + * or visit www.oracle.com if you need additional information or have any 40.24 + * questions. 40.25 + */ 40.26 + 40.27 +package typeannos; 40.28 + 40.29 +import java.lang.annotation.*; 40.30 + 40.31 +/* 40.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 40.33 + */ 40.34 +class ThrDefaultUnmodified { 40.35 + void oneException() throws @ThrA Exception {} 40.36 + void twoExceptions() throws @ThrA RuntimeException, @ThrA Exception {} 40.37 +} 40.38 + 40.39 +class ThrPublicModified { 40.40 + public final void oneException(String a) throws @ThrA Exception {} 40.41 + public final void twoExceptions(String a) throws @ThrA RuntimeException, @ThrA Exception {} 40.42 +} 40.43 + 40.44 +class ThrWithValue { 40.45 + void oneException() throws @ThrB("m") Exception {} 40.46 + void twoExceptions() throws @ThrB(value="m") RuntimeException, @ThrA Exception {} 40.47 +} 40.48 + 40.49 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 40.50 +@Documented 40.51 +@interface ThrA {} 40.52 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 40.53 +@Documented 40.54 +@interface ThrB { String value(); }
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 41.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/TypeParameters.java Wed Apr 17 21:50:43 2013 -0700 41.3 @@ -0,0 +1,60 @@ 41.4 +/* 41.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 41.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.7 + * 41.8 + * This code is free software; you can redistribute it and/or modify it 41.9 + * under the terms of the GNU General Public License version 2 only, as 41.10 + * published by the Free Software Foundation. 41.11 + * 41.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 41.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 41.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 41.15 + * version 2 for more details (a copy is included in the LICENSE file that 41.16 + * accompanied this code). 41.17 + * 41.18 + * You should have received a copy of the GNU General Public License version 41.19 + * 2 along with this work; if not, write to the Free Software Foundation, 41.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 41.21 + * 41.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 41.23 + * or visit www.oracle.com if you need additional information or have any 41.24 + * questions. 41.25 + */ 41.26 + 41.27 +package typeannos; 41.28 + 41.29 +import java.lang.annotation.*; 41.30 + 41.31 +/* 41.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 41.33 + */ 41.34 +class TypUnannotated<K> { } 41.35 +class OneAnnotated<@TyParaA K> { } 41.36 +class TwoAnnotated<@TyParaA K, @TyParaA V> { } 41.37 +class SecondAnnotated<K, @TyParaA V extends String> { } 41.38 + 41.39 +class TestMethods { 41.40 + <K> void unannotated() { } 41.41 + <@TyParaA K> void oneAnnotated() { } 41.42 + <@TyParaA K, @TyParaB("m") V> void twoAnnotated() { } 41.43 + <K, @TyParaA V extends @TyParaA String> void secondAnnotated() { } 41.44 +} 41.45 + 41.46 +class UnannotatedB<K> { } 41.47 +class OneAnnotatedB<@TyParaB("m") K> { } 41.48 +class TwoAnnotatedB<@TyParaB("m") K, @TyParaB("m") V> { } 41.49 +class SecondAnnotatedB<K, @TyParaB("m") V extends @TyParaB("m") String> { } 41.50 + 41.51 +class OneAnnotatedC<@TyParaC K> { } 41.52 +class TwoAnnotatedC<@TyParaC K, @TyParaC V> { } 41.53 +class SecondAnnotatedC<K, @TyParaC V extends String> { } 41.54 + 41.55 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 41.56 +@Documented 41.57 +@interface TyParaA { } 41.58 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 41.59 +@Documented 41.60 +@interface TyParaB { String value(); } 41.61 +@Target(ElementType.TYPE_USE) 41.62 +@Documented 41.63 +@interface TyParaC { }
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Varargs.java Wed Apr 17 21:50:43 2013 -0700 42.3 @@ -0,0 +1,42 @@ 42.4 +/* 42.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 42.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.7 + * 42.8 + * This code is free software; you can redistribute it and/or modify it 42.9 + * under the terms of the GNU General Public License version 2 only, as 42.10 + * published by the Free Software Foundation. 42.11 + * 42.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 42.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 42.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 42.15 + * version 2 for more details (a copy is included in the LICENSE file that 42.16 + * accompanied this code). 42.17 + * 42.18 + * You should have received a copy of the GNU General Public License version 42.19 + * 2 along with this work; if not, write to the Free Software Foundation, 42.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 42.21 + * 42.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 42.23 + * or visit www.oracle.com if you need additional information or have any 42.24 + * questions. 42.25 + */ 42.26 +package typeannos; 42.27 + 42.28 +import java.lang.annotation.*; 42.29 + 42.30 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 42.31 +@Documented 42.32 +@interface VarArgA {} 42.33 + 42.34 +/* 42.35 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 42.36 + */ 42.37 +class Varargs { 42.38 + 42.39 + // Handle annotations on a varargs element type 42.40 + void varargPlain(Object @VarArgA... objs) { 42.41 + } 42.42 + 42.43 + void varargGeneric(Class<?> @VarArgA ... clz) { 42.44 + } 42.45 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Wildcards.java Wed Apr 17 21:50:43 2013 -0700 43.3 @@ -0,0 +1,74 @@ 43.4 +/* 43.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.7 + * 43.8 + * This code is free software; you can redistribute it and/or modify it 43.9 + * under the terms of the GNU General Public License version 2 only, as 43.10 + * published by the Free Software Foundation. 43.11 + * 43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.15 + * version 2 for more details (a copy is included in the LICENSE file that 43.16 + * accompanied this code). 43.17 + * 43.18 + * You should have received a copy of the GNU General Public License version 43.19 + * 2 along with this work; if not, write to the Free Software Foundation, 43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.21 + * 43.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 43.23 + * or visit www.oracle.com if you need additional information or have any 43.24 + * questions. 43.25 + */ 43.26 + 43.27 +package typeannos; 43.28 + 43.29 +import java.lang.annotation.*; 43.30 + 43.31 +/* 43.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 43.33 + */ 43.34 +class BoundTest { 43.35 + void wcExtends(MyList<? extends @WldA String> l) { } 43.36 + void wcSuper(MyList<? super @WldA String> l) { } 43.37 + 43.38 + MyList<? extends @WldA String> returnWcExtends() { return null; } 43.39 + MyList<? super @WldA String> returnWcSuper() { return null; } 43.40 + MyList<? extends @WldA MyList<? super @WldB("m") String>> complex() { return null; } 43.41 +} 43.42 + 43.43 +class BoundWithValue { 43.44 + void wcExtends(MyList<? extends @WldB("m") String> l) { } 43.45 + void wcSuper(MyList<? super @WldB(value="m") String> l) { } 43.46 + 43.47 + MyList<? extends @WldB("m") String> returnWcExtends() { return null; } 43.48 + MyList<? super @WldB(value="m") String> returnWcSuper() { return null; } 43.49 + MyList<? extends @WldB("m") MyList<? super @WldB("m") String>> complex() { return null; } 43.50 +} 43.51 + 43.52 +class SelfTest { 43.53 + void wcExtends(MyList<@WldA ?> l) { } 43.54 + void wcSuper(MyList<@WldA ?> l) { } 43.55 + 43.56 + MyList<@WldA ?> returnWcExtends() { return null; } 43.57 + MyList<@WldA ?> returnWcSuper() { return null; } 43.58 + MyList<@WldA ? extends @WldA MyList<@WldB("m") ?>> complex() { return null; } 43.59 +} 43.60 + 43.61 +class SelfWithValue { 43.62 + void wcExtends(MyList<@WldB("m") ?> l) { } 43.63 + void wcSuper(MyList<@WldB(value="m") ?> l) { } 43.64 + 43.65 + MyList<@WldB("m") ?> returnWcExtends() { return null; } 43.66 + MyList<@WldB(value="m") ?> returnWcSuper() { return null; } 43.67 + MyList<@WldB("m") ? extends MyList<@WldB("m") ? super String>> complex() { return null; } 43.68 +} 43.69 + 43.70 +class MyList<K> { } 43.71 + 43.72 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 43.73 +@Documented 43.74 +@interface WldA { } 43.75 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 43.76 +@Documented 43.77 +@interface WldB { String value(); }
44.1 --- a/test/tools/javac/T5053846/MethodRefDupInConstantPoolTest.java Tue Apr 16 15:00:49 2013 -0700 44.2 +++ b/test/tools/javac/T5053846/MethodRefDupInConstantPoolTest.java Wed Apr 17 21:50:43 2013 -0700 44.3 @@ -23,8 +23,9 @@ 44.4 44.5 /* 44.6 * @test 44.7 - * @bug 5053846 44.8 + * @bug 5053846 8011432 44.9 * @summary javac: MethodRef entries are duplicated in the constant pool 44.10 + * @summary javac, compiler regression iterable + captured type 44.11 */ 44.12 44.13 import java.io.PrintWriter; 44.14 @@ -43,9 +44,13 @@ 44.15 44.16 void run() { 44.17 check("-v", Paths.get(System.getProperty("test.classes"), 44.18 - "TestHelper1.class").toString()); 44.19 + this.getClass().getSimpleName() + "$TestHelper1.class").toString()); 44.20 check("-v", Paths.get(System.getProperty("test.classes"), 44.21 - "TestHelper2.class").toString()); 44.22 + this.getClass().getSimpleName() + "$TestHelper2.class").toString()); 44.23 + check("-v", Paths.get(System.getProperty("test.classes"), 44.24 + this.getClass().getSimpleName() + "$TestHelper3.class").toString()); 44.25 + check("-v", Paths.get(System.getProperty("test.classes"), 44.26 + this.getClass().getSimpleName() + "$TestHelper4.class").toString()); 44.27 } 44.28 44.29 void check(String... params) { 44.30 @@ -68,24 +73,38 @@ 44.31 int end = out.indexOf("{"); 44.32 return out.substring(start, end); 44.33 } 44.34 -} 44.35 44.36 -class TestHelper1 { 44.37 - void m() { 44.38 - Vector v = new Vector(); 44.39 - Iterator iter = v.iterator(); 44.40 - while (iter.hasNext()) { 44.41 - Object o = iter.next(); 44.42 - Object o2 = o; 44.43 - } 44.44 - for (Object o: v) { 44.45 - Object o2 = o; 44.46 + class TestHelper1 { 44.47 + void m() { 44.48 + Vector v = new Vector(); 44.49 + Iterator iter = v.iterator(); 44.50 + while (iter.hasNext()) { 44.51 + Object o = iter.next(); 44.52 + Object o2 = o; 44.53 + } 44.54 + for (Object o: v) { 44.55 + Object o2 = o; 44.56 + } 44.57 } 44.58 } 44.59 -} 44.60 44.61 -class TestHelper2<X extends Number & Iterable<String>> { 44.62 - void test(X x) { 44.63 - for (String s : x) { } 44.64 + class TestHelper2<X extends Number & Iterable<String>> { 44.65 + void test(X x) { 44.66 + for (String s : x) { } 44.67 + } 44.68 + } 44.69 + 44.70 + interface Data extends Iterable<String> {} 44.71 + 44.72 + class TestHelper3<X extends Number & Iterable<? extends Data>> { 44.73 + void test(X x) { 44.74 + for (Data s : x) { } 44.75 + } 44.76 + } 44.77 + 44.78 + class TestHelper4 { 44.79 + void test(Iterable<? extends Data> t) { 44.80 + for(Object a: t.iterator().next()); 44.81 + } 44.82 } 44.83 }
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/test/tools/javac/T8010659/CompilerCrashWhenMixingBinariesAndSourcesTest.java Wed Apr 17 21:50:43 2013 -0700 45.3 @@ -0,0 +1,66 @@ 45.4 +/* 45.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.7 + * 45.8 + * This code is free software; you can redistribute it and/or modify it 45.9 + * under the terms of the GNU General Public License version 2 only, as 45.10 + * published by the Free Software Foundation. Oracle designates this 45.11 + * particular file as subject to the "Classpath" exception as provided 45.12 + * by Oracle in the LICENSE file that accompanied this code. 45.13 + * 45.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 45.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 45.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 45.17 + * version 2 for more details (a copy is included in the LICENSE file that 45.18 + * accompanied this code). 45.19 + * 45.20 + * You should have received a copy of the GNU General Public License version 45.21 + * 2 along with this work; if not, write to the Free Software Foundation, 45.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 45.23 + * 45.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 45.25 + * or visit www.oracle.com if you need additional information or have any 45.26 + * questions. 45.27 + */ 45.28 + 45.29 +/* 45.30 + * @test 45.31 + * @bug 8010659 45.32 + * @summary Javac Crashes while building OpenJFX 45.33 + * @library /tools/javac/lib 45.34 + * @build ToolBox 45.35 + * @run main CompilerCrashWhenMixingBinariesAndSourcesTest 45.36 + */ 45.37 + 45.38 +public class CompilerCrashWhenMixingBinariesAndSourcesTest { 45.39 + private static final String ASource = 45.40 + "class A {\n" + 45.41 + " void test() {new B(){};}\n" + 45.42 + "}"; 45.43 + private static final String BSource = 45.44 + "class B extends C {}"; 45.45 + private static final String CSource = 45.46 + "class C extends D {\n" + 45.47 + " String m(int i) {return null;}\n" + 45.48 + "}"; 45.49 + private static final String DSource = 45.50 + "class D {\n" + 45.51 + " Object m(int i) {return null;}\n" + 45.52 + "}"; 45.53 + 45.54 + public static void main (String[] args) throws Exception{ 45.55 + ToolBox.JavaToolArgs javacParams = new ToolBox.JavaToolArgs() 45.56 + .setSources(ASource, BSource, CSource, DSource); 45.57 + ToolBox.javac(javacParams); 45.58 + 45.59 + ToolBox.rm("A.class"); 45.60 + ToolBox.rm("A$1.class"); 45.61 + ToolBox.rm("C.class"); 45.62 + ToolBox.rm("D.class"); 45.63 + 45.64 + javacParams = new ToolBox.JavaToolArgs() 45.65 + .setOptions("-cp", ".") 45.66 + .setSources(ASource, CSource, DSource); 45.67 + ToolBox.javac(javacParams); 45.68 + } 45.69 +}
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/test/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java Wed Apr 17 21:50:43 2013 -0700 46.3 @@ -0,0 +1,81 @@ 46.4 +/* 46.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 46.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 46.7 + * 46.8 + * This code is free software; you can redistribute it and/or modify it 46.9 + * under the terms of the GNU General Public License version 2 only, as 46.10 + * published by the Free Software Foundation. Oracle designates this 46.11 + * particular file as subject to the "Classpath" exception as provided 46.12 + * by Oracle in the LICENSE file that accompanied this code. 46.13 + * 46.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 46.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 46.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 46.17 + * version 2 for more details (a copy is included in the LICENSE file that 46.18 + * accompanied this code). 46.19 + * 46.20 + * You should have received a copy of the GNU General Public License version 46.21 + * 2 along with this work; if not, write to the Free Software Foundation, 46.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 46.23 + * 46.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 46.25 + * or visit www.oracle.com if you need additional information or have any 46.26 + * questions. 46.27 + */ 46.28 + 46.29 +/* 46.30 + * @test 46.31 + * @bug 8011181 46.32 + * @summary javac, empty UTF8 entry generated for inner class 46.33 + */ 46.34 + 46.35 +import java.io.BufferedInputStream; 46.36 +import java.nio.file.Files; 46.37 +import java.nio.file.Path; 46.38 +import java.nio.file.Paths; 46.39 + 46.40 +import com.sun.tools.javac.util.Assert; 46.41 +import com.sun.tools.classfile.ClassFile; 46.42 + 46.43 +import static com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8; 46.44 +import static com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info; 46.45 +import static com.sun.tools.classfile.ConstantPool.CPInfo; 46.46 + 46.47 +public class EmptyUTF8ForInnerClassNameTest { 46.48 + 46.49 + public static void main(String[] args) throws Exception { 46.50 + new EmptyUTF8ForInnerClassNameTest().run(); 46.51 + } 46.52 + 46.53 + void run() throws Exception { 46.54 + checkClassFile(Paths.get(System.getProperty("test.classes"), 46.55 + this.getClass().getName() + "$1.class")); 46.56 + checkClassFile(Paths.get(System.getProperty("test.classes"), 46.57 + this.getClass().getName() + "$EnumPlusSwitch.class")); 46.58 + } 46.59 + 46.60 + void checkClassFile(final Path path) throws Exception { 46.61 + ClassFile classFile = ClassFile.read( 46.62 + new BufferedInputStream(Files.newInputStream(path))); 46.63 + for (CPInfo cpInfo : classFile.constant_pool.entries()) { 46.64 + if (cpInfo.getTag() == CONSTANT_Utf8) { 46.65 + CONSTANT_Utf8_info utf8Info = (CONSTANT_Utf8_info)cpInfo; 46.66 + Assert.check(utf8Info.value.length() > 0, 46.67 + "UTF8 with length 0 found at class " + classFile.getName()); 46.68 + } 46.69 + } 46.70 + } 46.71 + 46.72 + static class EnumPlusSwitch { 46.73 + enum E {E1} 46.74 + 46.75 + public int m (E e) { 46.76 + switch (e) { 46.77 + case E1: 46.78 + return 0; 46.79 + } 46.80 + return -1; 46.81 + } 46.82 + } 46.83 + 46.84 +}
47.1 --- a/test/tools/javac/annotations/typeAnnotations/TypeProcOnly.java Tue Apr 16 15:00:49 2013 -0700 47.2 +++ b/test/tools/javac/annotations/typeAnnotations/TypeProcOnly.java Wed Apr 17 21:50:43 2013 -0700 47.3 @@ -1,5 +1,5 @@ 47.4 /* 47.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 47.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 47.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 47.8 * 47.9 * This code is free software; you can redistribute it and/or modify it 47.10 @@ -32,12 +32,12 @@ 47.11 import com.sun.source.util.JavacTask; 47.12 import com.sun.source.util.TaskEvent; 47.13 import com.sun.source.util.TaskListener; 47.14 -import com.sun.source.util.TreePath; 47.15 import com.sun.tools.javac.main.JavaCompiler; 47.16 -import com.sun.tools.javac.main.JavaCompiler.CompileState; 47.17 import com.sun.tools.javac.processing.JavacProcessingEnvironment; 47.18 import com.sun.tools.javac.util.Context; 47.19 47.20 +import static com.sun.tools.javac.comp.CompileStates.CompileState; 47.21 + 47.22 /* 47.23 * @test 47.24 * @summary test that type processors are run when -proc:only is passed.
48.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/PackageProcessor.java Tue Apr 16 15:00:49 2013 -0700 48.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/PackageProcessor.java Wed Apr 17 21:50:43 2013 -0700 48.3 @@ -1,5 +1,5 @@ 48.4 /* 48.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 48.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 48.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 48.8 * 48.9 * This code is free software; you can redistribute it and/or modify it 48.10 @@ -31,12 +31,12 @@ 48.11 import com.sun.source.util.JavacTask; 48.12 import com.sun.source.util.TaskEvent; 48.13 import com.sun.source.util.TaskListener; 48.14 -import com.sun.source.util.TreePath; 48.15 import com.sun.tools.javac.main.JavaCompiler; 48.16 -import com.sun.tools.javac.main.JavaCompiler.CompileState; 48.17 import com.sun.tools.javac.processing.JavacProcessingEnvironment; 48.18 import com.sun.tools.javac.util.Context; 48.19 48.20 +import static com.sun.tools.javac.comp.CompileStates.CompileState; 48.21 + 48.22 /* 48.23 * @test 48.24 * @summary test that package annotations are available to type processors.
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 49.2 +++ b/test/tools/javac/defaultMethods/DefaultMethodFlags.java Wed Apr 17 21:50:43 2013 -0700 49.3 @@ -0,0 +1,111 @@ 49.4 +/* 49.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 49.7 + * 49.8 + * This code is free software; you can redistribute it and/or modify it 49.9 + * under the terms of the GNU General Public License version 2 only, as 49.10 + * published by the Free Software Foundation. 49.11 + * 49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 49.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 49.15 + * version 2 for more details (a copy is included in the LICENSE file that 49.16 + * accompanied this code). 49.17 + * 49.18 + * You should have received a copy of the GNU General Public License version 49.19 + * 2 along with this work; if not, write to the Free Software Foundation, 49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 49.21 + * 49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 49.23 + * or visit www.oracle.com if you need additional information or have any 49.24 + * questions. 49.25 + */ 49.26 + 49.27 +/* 49.28 + * @test 49.29 + * @bug 8011383 49.30 + * @summary Symbol.getModifiers omits ACC_ABSTRACT from interface with default methods 49.31 + */ 49.32 + 49.33 +import java.io.File; 49.34 +import java.io.IOException; 49.35 +import java.util.Arrays; 49.36 + 49.37 +import javax.lang.model.element.*; 49.38 +import javax.tools.JavaCompiler; 49.39 +import javax.tools.JavaFileObject; 49.40 +import javax.tools.StandardJavaFileManager; 49.41 +import javax.tools.ToolProvider; 49.42 + 49.43 +import com.sun.source.util.JavacTask; 49.44 +import com.sun.source.util.TaskEvent; 49.45 +import com.sun.source.util.TaskListener; 49.46 +import com.sun.tools.javac.util.Assert; 49.47 + 49.48 +public class DefaultMethodFlags { 49.49 + 49.50 + public static void main(String[] args) throws IOException { 49.51 + new DefaultMethodFlags().run(args); 49.52 + } 49.53 + 49.54 + void run(String[] args) throws IOException { 49.55 + checkDefaultMethodFlags(); 49.56 + } 49.57 + 49.58 + void checkDefaultMethodFlags() throws IOException { 49.59 + JavaCompiler c = ToolProvider.getSystemJavaCompiler(); 49.60 + StandardJavaFileManager fm = c.getStandardFileManager(null, null, null); 49.61 + Iterable<? extends JavaFileObject> fos = 49.62 + fm.getJavaFileObjectsFromFiles( 49.63 + Arrays.asList(new File( 49.64 + System.getProperty("test.src"), 49.65 + this.getClass().getSimpleName() + ".java"))); 49.66 + JavacTask task = (JavacTask) c.getTask(null, fm, null, null, null, fos); 49.67 + 49.68 + task.addTaskListener(new TaskListener() { 49.69 + 49.70 + @Override 49.71 + public void started(TaskEvent e) {} 49.72 + 49.73 + @Override 49.74 + public void finished(TaskEvent e) { 49.75 + if (e.getKind() == TaskEvent.Kind.ANALYZE) { 49.76 + TypeElement te = e.getTypeElement(); 49.77 + if (te.getSimpleName().toString().equals("I")) { 49.78 + checkDefaultInterface(te); 49.79 + } 49.80 + } 49.81 + } 49.82 + }); 49.83 + 49.84 + task.analyze(); 49.85 + } 49.86 + 49.87 + void checkDefaultInterface(TypeElement te) { 49.88 + System.err.println("Checking " + te.getSimpleName()); 49.89 + Assert.check(te.getModifiers().contains(Modifier.ABSTRACT)); 49.90 + for (Element e : te.getEnclosedElements()) { 49.91 + if (e.getSimpleName().toString().matches("(\\w)_(default|static|abstract)")) { 49.92 + boolean abstractExpected = false; 49.93 + String methodKind = e.getSimpleName().toString().substring(2); 49.94 + switch (methodKind) { 49.95 + case "default": 49.96 + case "static": 49.97 + break; 49.98 + case "abstract": 49.99 + abstractExpected = true; 49.100 + break; 49.101 + default: 49.102 + Assert.error("Cannot get here!" + methodKind); 49.103 + } 49.104 + Assert.check(e.getModifiers().contains(Modifier.ABSTRACT) == abstractExpected); 49.105 + } 49.106 + } 49.107 + } 49.108 +} 49.109 + 49.110 +interface I { 49.111 + default void m_default() { } 49.112 + static void m_static() { } 49.113 + void m_abstract(); 49.114 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 50.2 +++ b/test/tools/javac/lambda/Intersection03.java Wed Apr 17 21:50:43 2013 -0700 50.3 @@ -0,0 +1,49 @@ 50.4 +/* 50.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 50.7 + * 50.8 + * This code is free software; you can redistribute it and/or modify it 50.9 + * under the terms of the GNU General Public License version 2 only, as 50.10 + * published by the Free Software Foundation. 50.11 + * 50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 50.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 50.15 + * version 2 for more details (a copy is included in the LICENSE file that 50.16 + * accompanied this code). 50.17 + * 50.18 + * You should have received a copy of the GNU General Public License version 50.19 + * 2 along with this work; if not, write to the Free Software Foundation, 50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 50.21 + * 50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 50.23 + * or visit www.oracle.com if you need additional information or have any 50.24 + * questions. 50.25 + */ 50.26 + 50.27 +/* 50.28 + * @test 50.29 + * @bug 8011392 50.30 + * @summary Missing checkcast when casting to intersection type 50.31 + */ 50.32 +import java.util.*; 50.33 + 50.34 +public class Intersection03 { 50.35 + 50.36 + static int assertionCount = 0; 50.37 + 50.38 + static void assertTrue(boolean cond) { 50.39 + assertionCount++; 50.40 + if (!cond) throw new AssertionError(); 50.41 + } 50.42 + 50.43 + public static void main(String[] args) { 50.44 + try { 50.45 + Runnable r = (List<?> & Runnable)new ArrayList<String>(); 50.46 + assertTrue(false); 50.47 + } catch (ClassCastException cce) { 50.48 + assertTrue(true); 50.49 + } 50.50 + assertTrue(assertionCount == 1); 50.51 + } 50.52 +}
51.1 --- a/test/tools/javac/lambda/TargetType69.java Tue Apr 16 15:00:49 2013 -0700 51.2 +++ b/test/tools/javac/lambda/TargetType69.java Wed Apr 17 21:50:43 2013 -0700 51.3 @@ -25,11 +25,11 @@ 51.4 * @test 51.5 * @bug 8010303 51.6 * @summary Graph inference: missing incorporation step causes spurious inference error 51.7 - * @compile TargetType68.java 51.8 + * @compile TargetType69.java 51.9 */ 51.10 import java.util.*; 51.11 51.12 -class TargetType68 { 51.13 +class TargetType69 { 51.14 51.15 interface Function<X,Y> { 51.16 Y m(X x);
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 52.2 +++ b/test/tools/javac/lambda/TargetType70.java Wed Apr 17 21:50:43 2013 -0700 52.3 @@ -0,0 +1,52 @@ 52.4 +/* 52.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.7 + * 52.8 + * This code is free software; you can redistribute it and/or modify it 52.9 + * under the terms of the GNU General Public License version 2 only, as 52.10 + * published by the Free Software Foundation. 52.11 + * 52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 52.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 52.15 + * version 2 for more details (a copy is included in the LICENSE file that 52.16 + * accompanied this code). 52.17 + * 52.18 + * You should have received a copy of the GNU General Public License version 52.19 + * 2 along with this work; if not, write to the Free Software Foundation, 52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 52.21 + * 52.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 52.23 + * or visit www.oracle.com if you need additional information or have any 52.24 + * questions. 52.25 + */ 52.26 + 52.27 +/* 52.28 + * @test 52.29 + * @bug 8011028 52.30 + * @summary lang/INFR/infr001/infr00101md/infr00101md.java fails to compile after switch to JDK8-b82 52.31 + * @compile TargetType70.java 52.32 + */ 52.33 +class TargetType70 { 52.34 + 52.35 + static class Sup {} 52.36 + static class Sub extends Sup {} 52.37 + 52.38 + interface I<T extends GenSup<U>, U> { 52.39 + T m(U o); 52.40 + } 52.41 + 52.42 + static class GenSup<T> { 52.43 + GenSup(T f) { } 52.44 + } 52.45 + 52.46 + static class GenSub<T> extends GenSup<T> { 52.47 + GenSub(T f) { super(f); } 52.48 + } 52.49 + 52.50 + <T extends Sup> void m(I<? extends GenSup<T>, T> o1, T o2) { } 52.51 + 52.52 + void test(Sub sub) { 52.53 + m(GenSub::new, sub); 52.54 + } 52.55 +}
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 53.2 +++ b/test/tools/javac/lambda/TargetType71.java Wed Apr 17 21:50:43 2013 -0700 53.3 @@ -0,0 +1,34 @@ 53.4 +/* 53.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.7 + * 53.8 + * This code is free software; you can redistribute it and/or modify it 53.9 + * under the terms of the GNU General Public License version 2 only, as 53.10 + * published by the Free Software Foundation. 53.11 + * 53.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 53.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 53.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 53.15 + * version 2 for more details (a copy is included in the LICENSE file that 53.16 + * accompanied this code). 53.17 + * 53.18 + * You should have received a copy of the GNU General Public License version 53.19 + * 2 along with this work; if not, write to the Free Software Foundation, 53.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 53.21 + * 53.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 53.23 + * or visit www.oracle.com if you need additional information or have any 53.24 + * questions. 53.25 + */ 53.26 + 53.27 +/* 53.28 + * @test 53.29 + * @bug 8011377 53.30 + * @summary Javac crashes when multiple lambdas are defined in an array 53.31 + * @compile TargetType71.java 53.32 + */ 53.33 +class TargetType71 { 53.34 + void test() { 53.35 + Runnable[] rs = { () -> { String x = null; }, () -> { String x = null; } }; 53.36 + } 53.37 +}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 54.2 +++ b/test/tools/javac/lambda/TargetType72.java Wed Apr 17 21:50:43 2013 -0700 54.3 @@ -0,0 +1,39 @@ 54.4 +/* 54.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 54.7 + * 54.8 + * This code is free software; you can redistribute it and/or modify it 54.9 + * under the terms of the GNU General Public License version 2 only, as 54.10 + * published by the Free Software Foundation. 54.11 + * 54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 54.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 54.15 + * version 2 for more details (a copy is included in the LICENSE file that 54.16 + * accompanied this code). 54.17 + * 54.18 + * You should have received a copy of the GNU General Public License version 54.19 + * 2 along with this work; if not, write to the Free Software Foundation, 54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 54.21 + * 54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 54.23 + * or visit www.oracle.com if you need additional information or have any 54.24 + * questions. 54.25 + */ 54.26 + 54.27 +/* 54.28 + * @test 54.29 + * @bug 8011376 54.30 + * @summary Spurious checked exception errors in nested method call 54.31 + * @compile TargetType72.java 54.32 + */ 54.33 +import java.io.IOException; 54.34 +import java.util.concurrent.Callable; 54.35 + 54.36 +class TargetType72 { 54.37 + 54.38 + Callable<Number> c = id(id(()->{ if (true) throw new java.io.IOException(); return 0; })); 54.39 + 54.40 + <Z> Z id(Z z) { return null; } 54.41 + 54.42 +}
55.1 --- a/test/tools/javac/scope/7017664/CompoundScopeTest.java Tue Apr 16 15:00:49 2013 -0700 55.2 +++ b/test/tools/javac/scope/7017664/CompoundScopeTest.java Wed Apr 17 21:50:43 2013 -0700 55.3 @@ -1,5 +1,5 @@ 55.4 /* 55.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 55.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 55.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.8 * 55.9 * This code is free software; you can redistribute it and/or modify it 55.10 @@ -147,7 +147,7 @@ 55.11 Scope createScope(int nelems) { 55.12 Scope s = new Scope(symtab.noSymbol); 55.13 for (int i = 0 ; i < nelems ; i++) { 55.14 - Symbol sym = new TypeSymbol(0, names.fromString("s" + i), null, null); 55.15 + Symbol sym = new TypeVariableSymbol(0, names.fromString("s" + i), null, null); 55.16 s.enter(sym); 55.17 elems = elems.prepend(sym); 55.18 List<Symbol> shadowed = shadowedMap.get(sym.name);
56.1 --- a/test/tools/javac/types/TypeHarness.java Tue Apr 16 15:00:49 2013 -0700 56.2 +++ b/test/tools/javac/types/TypeHarness.java Wed Apr 17 21:50:43 2013 -0700 56.3 @@ -1,5 +1,5 @@ 56.4 /* 56.5 - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 56.6 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 56.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.8 * 56.9 * This code is free software; you can redistribute it and/or modify it 56.10 @@ -309,7 +309,7 @@ 56.11 } 56.12 56.13 public TypeVar TypeVariable(Type bound) { 56.14 - TypeSymbol tvsym = new TypeSymbol(0, syntheticName(), null, predef.noSymbol); 56.15 + TypeSymbol tvsym = new TypeVariableSymbol(0, syntheticName(), null, predef.noSymbol); 56.16 tvsym.type = new TypeVar(tvsym, bound, null); 56.17 return (TypeVar)tvsym.type; 56.18 }