--- a/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java Fri Oct 24 20:47:47 2008 -0700
@@ -49,4 +49,23 @@
* @return a string representing the object's kind
*/
String getKind();
+
+ static class LocalizedString implements Formattable {
+ String key;
+
+ public LocalizedString(String key) {
+ this.key = key;
+ }
+
+ public String toString(java.util.Locale l, Messages messages) {
+ return messages.getLocalizedString(l, key);
+ }
+ public String getKind() {
+ return "LocalizedString";
+ }
+
+ public String toString() {
+ return key;
+ }
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Oct 24 20:47:47 2008 -0700
@@ -361,6 +361,8 @@
for (Symbol sup = clazz;
sup != null && sup != this.owner;
sup = types.supertype(sup.type).tsym) {
+ while (sup.type.tag == TYPEVAR)
+ sup = sup.type.getUpperBound().tsym;
if (sup.type.isErroneous())
return true; // error recovery
if ((sup.flags() & COMPOUND) != 0)
@@ -1183,7 +1185,9 @@
* as possible implementations.
*/
public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) {
- for (Type t = origin.type; t.tag == CLASS; t = types.supertype(t)) {
+ for (Type t = origin.type; t.tag == CLASS || t.tag == TYPEVAR; t = types.supertype(t)) {
+ while (t.tag == TYPEVAR)
+ t = t.getUpperBound();
TypeSymbol c = t.tsym;
for (Scope.Entry e = c.members().lookup(name);
e.scope != null;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Fri Oct 24 20:47:47 2008 -0700
@@ -360,17 +360,6 @@
public boolean isUnbound() { return false; }
public Type withTypeVar(Type t) { return this; }
- public static List<Type> removeBounds(List<Type> ts) {
- ListBuffer<Type> result = new ListBuffer<Type>();
- for(;ts.nonEmpty(); ts = ts.tail) {
- result.append(ts.head.removeBounds());
- }
- return result.toList();
- }
- public Type removeBounds() {
- return this;
- }
-
/** The underlying method type of this type.
*/
public MethodType asMethodType() { throw new AssertionError(); }
@@ -489,10 +478,6 @@
return new WildcardType(t, kind, tsym, bound);
}
- public Type removeBounds() {
- return isUnbound() ? this : type;
- }
-
public Type getExtendsBound() {
if (kind == EXTENDS)
return type;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Fri Oct 24 20:47:47 2008 -0700
@@ -709,16 +709,13 @@
case UNDETVAR:
if (s.tag == WILDCARD) {
UndetVar undetvar = (UndetVar)t;
-
- // Because of wildcard capture, s must be on the left
- // hand side of an assignment. Furthermore, t is an
- // underconstrained type variable, for example, one
- // that is only used in the return type of a method.
- // If the type variable is truly underconstrained, it
- // cannot have any low bounds:
- assert undetvar.lobounds.isEmpty() : undetvar;
-
undetvar.inst = glb(upperBound(s), undetvar.inst);
+ // We should check instantiated type against any of the
+ // undetvar's lower bounds.
+ for (Type t2 : undetvar.lobounds) {
+ if (!isSubtype(t2, undetvar.inst))
+ return false;
+ }
return true;
} else {
return isSameType(t, s);
@@ -3367,33 +3364,67 @@
* quantifiers) only
*/
private Type rewriteQuantifiers(Type t, boolean high, boolean rewriteTypeVars) {
- ListBuffer<Type> from = new ListBuffer<Type>();
- ListBuffer<Type> to = new ListBuffer<Type>();
- adaptSelf(t, from, to);
- ListBuffer<Type> rewritten = new ListBuffer<Type>();
- List<Type> formals = from.toList();
- boolean changed = false;
- for (Type arg : to.toList()) {
- Type bound;
- if (rewriteTypeVars && arg.tag == TYPEVAR) {
- TypeVar tv = (TypeVar)arg;
- bound = high ? tv.bound : syms.botType;
- } else {
- bound = high ? upperBound(arg) : lowerBound(arg);
+ return new Rewriter(high, rewriteTypeVars).rewrite(t);
+ }
+
+ class Rewriter extends UnaryVisitor<Type> {
+
+ boolean high;
+ boolean rewriteTypeVars;
+
+ Rewriter(boolean high, boolean rewriteTypeVars) {
+ this.high = high;
+ this.rewriteTypeVars = rewriteTypeVars;
+ }
+
+ Type rewrite(Type t) {
+ ListBuffer<Type> from = new ListBuffer<Type>();
+ ListBuffer<Type> to = new ListBuffer<Type>();
+ adaptSelf(t, from, to);
+ ListBuffer<Type> rewritten = new ListBuffer<Type>();
+ List<Type> formals = from.toList();
+ boolean changed = false;
+ for (Type arg : to.toList()) {
+ Type bound = visit(arg);
+ if (arg != bound) {
+ changed = true;
+ bound = high ? makeExtendsWildcard(bound, (TypeVar)formals.head)
+ : makeSuperWildcard(bound, (TypeVar)formals.head);
+ }
+ rewritten.append(bound);
+ formals = formals.tail;
}
- Type newarg = bound;
- if (arg != bound) {
- changed = true;
- newarg = high ? makeExtendsWildcard(bound, (TypeVar)formals.head)
- : makeSuperWildcard(bound, (TypeVar)formals.head);
- }
- rewritten.append(newarg);
- formals = formals.tail;
+ if (changed)
+ return subst(t.tsym.type, from.toList(), rewritten.toList());
+ else
+ return t;
+ }
+
+ public Type visitType(Type t, Void s) {
+ return high ? upperBound(t) : lowerBound(t);
+ }
+
+ @Override
+ public Type visitCapturedType(CapturedType t, Void s) {
+ return visitWildcardType(t.wildcard, null);
}
- if (changed)
- return subst(t.tsym.type, from.toList(), rewritten.toList());
- else
- return t;
+
+ @Override
+ public Type visitTypeVar(TypeVar t, Void s) {
+ if (rewriteTypeVars)
+ return high ? t.bound : syms.botType;
+ else
+ return t;
+ }
+
+ @Override
+ public Type visitWildcardType(WildcardType t, Void s) {
+ Type bound = high ? t.getExtendsBound() :
+ t.getSuperBound();
+ if (bound == null)
+ bound = high ? syms.objectType : syms.botType;
+ return bound;
+ }
}
/**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Oct 24 20:47:47 2008 -0700
@@ -2007,6 +2007,10 @@
log.error(pos, "type.var.cant.be.deref");
return syms.errSymbol;
} else {
+ Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
+ rs.new AccessError(env, site, sym) :
+ sym;
+ rs.access(sym2, pos, site, name, true);
return sym;
}
case ERROR:
@@ -2374,16 +2378,14 @@
}
if (warned && sym.type.tag == FORALL) {
- String typeargs = "";
- if (typeargtypes != null && typeargtypes.nonEmpty()) {
- typeargs = "<" + Type.toString(typeargtypes) + ">";
- }
chk.warnUnchecked(env.tree.pos(),
"unchecked.meth.invocation.applied",
- sym,
- sym.location(),
- typeargs,
- Type.toString(argtypes));
+ kindName(sym),
+ sym.name,
+ rs.methodArguments(sym.type.getParameterTypes()),
+ rs.methodArguments(argtypes),
+ kindName(sym.location()),
+ sym.location());
owntype = new MethodType(owntype.getParameterTypes(),
types.erasure(owntype.getReturnType()),
owntype.getThrownTypes(),
@@ -2516,7 +2518,10 @@
// accept class or interface or typevar as first bound.
Type b = checkBase(bs.head, tree.bounds.head, env, false, false, false);
boundSet.add(types.erasure(b));
- if (b.tag == TYPEVAR) {
+ if (b.isErroneous()) {
+ a.bound = b;
+ }
+ else if (b.tag == TYPEVAR) {
// if first bound was a typevar, do not accept further bounds.
if (tree.bounds.tail.nonEmpty()) {
log.error(tree.bounds.tail.head.pos(),
@@ -2530,7 +2535,9 @@
for (JCExpression bound : tree.bounds.tail) {
bs = bs.tail;
Type i = checkBase(bs.head, bound, env, false, true, false);
- if (i.tag == CLASS)
+ if (i.isErroneous())
+ a.bound = i;
+ else if (i.tag == CLASS)
chk.checkNotRepeated(bound.pos(), types.erasure(i), boundSet);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Oct 24 20:47:47 2008 -0700
@@ -424,43 +424,43 @@
* @param bs The bound.
*/
private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
- if (a.tag == TYPEVAR && ((TypeVar)a).isCaptured()) {
- CapturedType ct = (CapturedType)a;
- boolean ok;
- if (ct.bound.isErroneous()) {//capture doesn't exist
- ok = false;
+ if (a.isUnbound()) {
+ return;
+ } else if (a.tag != WILDCARD) {
+ a = types.upperBound(a);
+ for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
+ if (!types.isSubtype(a, l.head)) {
+ log.error(pos, "not.within.bounds", a);
+ return;
+ }
+ }
+ } else if (a.isExtendsBound()) {
+ if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
+ log.error(pos, "not.within.bounds", a);
+ } else if (a.isSuperBound()) {
+ if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
+ log.error(pos, "not.within.bounds", a);
+ }
+ }
+
+ /** Check that a type is within some bounds.
+ *
+ * Used in TypeApply to verify that, e.g., X in V<X> is a valid
+ * type argument.
+ * @param pos Position to be used for error reporting.
+ * @param a The type that should be bounded by bs.
+ * @param bs The bound.
+ */
+ private void checkCapture(JCTypeApply tree) {
+ List<JCExpression> args = tree.getTypeArguments();
+ for (Type arg : types.capture(tree.type).getTypeArguments()) {
+ if (arg.tag == TYPEVAR && arg.getUpperBound().isErroneous()) {
+ log.error(args.head.pos, "not.within.bounds", args.head.type);
+ break;
}
- else {
- switch (ct.wildcard.kind) {
- case EXTENDS:
- ok = types.isCastable(bs.getUpperBound(),
- types.upperBound(a),
- Warner.noWarnings);
- break;
- case SUPER:
- ok = !types.notSoftSubtype(types.lowerBound(a),
- bs.getUpperBound());
- break;
- case UNBOUND:
- ok = true;
- break;
- default:
- throw new AssertionError("Invalid bound kind");
- }
- }
- if (!ok)
- log.error(pos, "not.within.bounds", a);
+ args = args.tail;
}
- else {
- a = types.upperBound(a);
- for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
- if (!types.isSubtype(a, l.head)) {
- log.error(pos, "not.within.bounds", a);
- return;
- }
- }
- }
- }
+ }
/** Check that type is different from 'void'.
* @param pos Position to be used for error reporting.
@@ -802,10 +802,10 @@
public void visitTypeApply(JCTypeApply tree) {
if (tree.type.tag == CLASS) {
- List<Type> formals = tree.type.tsym.type.getTypeArguments();
- List<Type> actuals = types.capture(tree.type).getTypeArguments();
+ List<Type> formals = tree.type.tsym.type.allparams();
+ List<Type> actuals = tree.type.allparams();
List<JCExpression> args = tree.arguments;
- List<Type> forms = formals;
+ List<Type> forms = tree.type.tsym.type.getTypeArguments();
ListBuffer<TypeVar> tvars_buf = new ListBuffer<TypeVar>();
// For matching pairs of actual argument types `a' and
@@ -826,24 +826,28 @@
}
args = tree.arguments;
+ List<Type> tvars_cap = types.substBounds(formals,
+ formals,
+ types.capture(tree.type).allparams());
+ while (args.nonEmpty() && tvars_cap.nonEmpty()) {
+ // Let the actual arguments know their bound
+ args.head.type.withTypeVar((TypeVar)tvars_cap.head);
+ args = args.tail;
+ tvars_cap = tvars_cap.tail;
+ }
+
+ args = tree.arguments;
List<TypeVar> tvars = tvars_buf.toList();
+
while (args.nonEmpty() && tvars.nonEmpty()) {
- // Let the actual arguments know their bound
- args.head.type.withTypeVar(tvars.head);
+ checkExtends(args.head.pos(),
+ args.head.type,
+ tvars.head);
args = args.tail;
tvars = tvars.tail;
}
- args = tree.arguments;
- tvars = tvars_buf.toList();
- while (args.nonEmpty() && tvars.nonEmpty()) {
- checkExtends(args.head.pos(),
- actuals.head,
- tvars.head);
- args = args.tail;
- tvars = tvars.tail;
- actuals = actuals.tail;
- }
+ checkCapture(tree);
// Check that this type is either fully parameterized, or
// not parameterized at all.
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Oct 24 20:47:47 2008 -0700
@@ -30,6 +30,8 @@
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.jvm.*;
import com.sun.tools.javac.tree.*;
+import com.sun.tools.javac.api.Formattable.LocalizedString;
+import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.code.Symbol.*;
@@ -40,6 +42,9 @@
import static com.sun.tools.javac.code.TypeTags.*;
import javax.lang.model.element.ElementVisitor;
+import java.util.Map;
+import java.util.HashMap;
+
/** Helper class for name resolution, used mostly by the attribution phase.
*
* <p><b>This is NOT part of any API supported by Sun Microsystems. If
@@ -554,7 +559,6 @@
boolean useVarargs,
boolean operator) {
if (sym.kind == ERR) return bestSoFar;
- if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
assert sym.kind < AMBIGUOUS;
try {
if (rawInstantiate(env, site, sym, argtypes, typeargtypes,
@@ -651,8 +655,9 @@
// both abstract or both concrete
if (!m1Abstract && !m2Abstract)
return new AmbiguityError(m1, m2);
- // check for same erasure
- if (!types.isSameType(m1.erasure(types), m2.erasure(types)))
+ // check that both signatures have the same erasure
+ if (!types.isSameTypes(m1.erasure(types).getParameterTypes(),
+ m2.erasure(types).getParameterTypes()))
return new AmbiguityError(m1, m2);
// both abstract, neither overridden; merge throws clause and result type
Symbol result;
@@ -1192,15 +1197,23 @@
Name name,
List<Type> argtypes,
List<Type> typeargtypes) {
- Symbol sym = findFun(env, name, argtypes, typeargtypes, false, env.info.varArgs=false);
- if (varargsEnabled && sym.kind >= WRONG_MTHS) {
- sym = findFun(env, name, argtypes, typeargtypes, true, false);
- if (sym.kind >= WRONG_MTHS)
- sym = findFun(env, name, argtypes, typeargtypes, true, env.info.varArgs=true);
+ Symbol sym = methodNotFound;
+ List<MethodResolutionPhase> steps = methodResolutionSteps;
+ while (steps.nonEmpty() &&
+ steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+ sym.kind >= ERRONEOUS) {
+ sym = findFun(env, name, argtypes, typeargtypes,
+ steps.head.isBoxingRequired,
+ env.info.varArgs = steps.head.isVarargsRequired);
+ methodResolutionCache.put(steps.head, sym);
+ steps = steps.tail;
}
- if (sym.kind >= AMBIGUOUS) {
- sym = access(
- sym, pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes);
+ if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
+ MethodResolutionPhase errPhase =
+ firstErroneousResolutionPhase();
+ sym = access(methodResolutionCache.get(errPhase),
+ pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes);
+ env.info.varArgs = errPhase.isVarargsRequired;
}
return sym;
}
@@ -1217,17 +1230,23 @@
Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
Type site, Name name, List<Type> argtypes,
List<Type> typeargtypes) {
- Symbol sym = findMethod(env, site, name, argtypes, typeargtypes, false,
- env.info.varArgs=false, false);
- if (varargsEnabled && sym.kind >= WRONG_MTHS) {
- sym = findMethod(env, site, name, argtypes, typeargtypes, true,
- false, false);
- if (sym.kind >= WRONG_MTHS)
- sym = findMethod(env, site, name, argtypes, typeargtypes, true,
- env.info.varArgs=true, false);
+ Symbol sym = methodNotFound;
+ List<MethodResolutionPhase> steps = methodResolutionSteps;
+ while (steps.nonEmpty() &&
+ steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+ sym.kind >= ERRONEOUS) {
+ sym = findMethod(env, site, name, argtypes, typeargtypes,
+ steps.head.isBoxingRequired(),
+ env.info.varArgs = steps.head.isVarargsRequired(), false);
+ methodResolutionCache.put(steps.head, sym);
+ steps = steps.tail;
}
- if (sym.kind >= AMBIGUOUS) {
- sym = access(sym, pos, site, name, true, argtypes, typeargtypes);
+ if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
+ MethodResolutionPhase errPhase =
+ firstErroneousResolutionPhase();
+ sym = access(methodResolutionCache.get(errPhase),
+ pos, site, name, true, argtypes, typeargtypes);
+ env.info.varArgs = errPhase.isVarargsRequired;
}
return sym;
}
@@ -1268,14 +1287,22 @@
Type site,
List<Type> argtypes,
List<Type> typeargtypes) {
- Symbol sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, false, env.info.varArgs=false);
- if (varargsEnabled && sym.kind >= WRONG_MTHS) {
- sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, true, false);
- if (sym.kind >= WRONG_MTHS)
- sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, true, env.info.varArgs=true);
+ Symbol sym = methodNotFound;
+ List<MethodResolutionPhase> steps = methodResolutionSteps;
+ while (steps.nonEmpty() &&
+ steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+ sym.kind >= ERRONEOUS) {
+ sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
+ steps.head.isBoxingRequired(),
+ env.info.varArgs = steps.head.isVarargsRequired());
+ methodResolutionCache.put(steps.head, sym);
+ steps = steps.tail;
}
- if (sym.kind >= AMBIGUOUS) {
- sym = access(sym, pos, site, names.init, true, argtypes, typeargtypes);
+ if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
+ MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
+ sym = access(methodResolutionCache.get(errPhase),
+ pos, site, names.init, true, argtypes, typeargtypes);
+ env.info.varArgs = errPhase.isVarargsRequired();
}
return sym;
}
@@ -1452,6 +1479,12 @@
error.report(log, tree.pos(), type.getEnclosingType(), null, null, null);
}
+ private final LocalizedString noArgs = new LocalizedString("compiler.misc.no.args");
+
+ public Object methodArguments(List<Type> argtypes) {
+ return argtypes.isEmpty() ? noArgs : argtypes;
+ }
+
/** Root class for resolve errors.
* Instances of this class indicate "Symbol not found".
* Instances of subclass indicate other errors.
@@ -1558,8 +1591,8 @@
"cant.apply.symbol" + (explanation != null ? ".1" : ""),
kindname,
ws.name == names.init ? ws.owner.name : ws.name,
- ws.type.getParameterTypes(),
- argtypes,
+ methodArguments(ws.type.getParameterTypes()),
+ methodArguments(argtypes),
kindName(ws.owner),
ws.owner.type,
explanation);
@@ -1733,4 +1766,50 @@
pair.sym2.location(site, types));
}
}
+
+ enum MethodResolutionPhase {
+ BASIC(false, false),
+ BOX(true, false),
+ VARARITY(true, true);
+
+ boolean isBoxingRequired;
+ boolean isVarargsRequired;
+
+ MethodResolutionPhase(boolean isBoxingRequired, boolean isVarargsRequired) {
+ this.isBoxingRequired = isBoxingRequired;
+ this.isVarargsRequired = isVarargsRequired;
+ }
+
+ public boolean isBoxingRequired() {
+ return isBoxingRequired;
+ }
+
+ public boolean isVarargsRequired() {
+ return isVarargsRequired;
+ }
+
+ public boolean isApplicable(boolean boxingEnabled, boolean varargsEnabled) {
+ return (varargsEnabled || !isVarargsRequired) &&
+ (boxingEnabled || !isBoxingRequired);
+ }
+ }
+
+ private Map<MethodResolutionPhase, Symbol> methodResolutionCache =
+ new HashMap<MethodResolutionPhase, Symbol>(MethodResolutionPhase.values().length);
+
+ final List<MethodResolutionPhase> methodResolutionSteps = List.of(BASIC, BOX, VARARITY);
+
+ private MethodResolutionPhase firstErroneousResolutionPhase() {
+ MethodResolutionPhase bestSoFar = BASIC;
+ Symbol sym = methodNotFound;
+ List<MethodResolutionPhase> steps = methodResolutionSteps;
+ while (steps.nonEmpty() &&
+ steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+ sym.kind >= WRONG_MTHS) {
+ sym = methodResolutionCache.get(steps.head);
+ bestSoFar = steps.head;
+ steps = steps.tail;
+ }
+ return bestSoFar;
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Oct 24 20:47:47 2008 -0700
@@ -745,7 +745,10 @@
compiler.warn.unchecked.cast.to.type=\
[unchecked] unchecked cast to type {0}
compiler.warn.unchecked.meth.invocation.applied=\
- [unchecked] unchecked method invocation: {0} in {1} is applied to {2}({3})
+ [unchecked] unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
+ required: {2}\n\
+ found: {3}
+
compiler.warn.unchecked.generic.array.creation=\
[unchecked] unchecked generic array creation of type {0} for varargs parameter
@@ -1062,6 +1065,9 @@
package
#####
+compiler.misc.no.args=\
+ no arguments
+
compiler.err.override.static=\
{0}; overriding method is static
compiler.err.override.meth=\
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6758789/T6758789a.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6758789
+ * @summary 6758789: Some method resolution diagnostic should be improved
+ * @author Maurizio Cimadamore
+ *
+ * @compile/fail/ref=T6758789a.out -XDrawDiagnostics T6758789a.java
+ */
+
+class T6758789a {
+ void m1() {}
+ void m2(int i) {}
+ void test() {
+ m1(1);
+ m2();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6758789/T6758789a.out Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,3 @@
+T6758789a.java:37:9: compiler.err.cant.apply.symbol: kindname.method, m1, compiler.misc.no.args, int, kindname.class, T6758789a, null
+T6758789a.java:38:9: compiler.err.cant.apply.symbol: kindname.method, m2, int, compiler.misc.no.args, kindname.class, T6758789a, null
+2 errors
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6758789/T6758789b.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6758789
+ * @summary 6758789: Some method resolution diagnostic should be improved
+ * @author Maurizio Cimadamore
+ *
+ * @compile/fail/ref=T6758789b.out -Werror -XDrawDiagnostics -Xlint:unchecked T6758789b.java
+ */
+
+class T6758789a {
+ class Foo<T> {}
+
+ <X> void m(Foo<X> foo) {}
+
+ void test() {
+ m(new Foo());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6758789/T6758789b.out Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,3 @@
+T6758789b.java:39:11: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
+T6758789b.java:39:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
+2 warnings
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/6548436/T6548436a.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6548436
+ * @summary Incorrect inconvertible types error
+ * @author Maurizio Cimadamore
+ *
+ * @compile T6548436a.java
+ */
+
+public class T6548436a {
+
+ static class Base<E extends Comparable<E>> {}
+
+ static void test(Base<?> je) {
+ Object o = (Base<Integer>)je;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/6548436/T6548436b.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6548436
+ * @summary Incorrect inconvertible types error
+ * @author Maurizio Cimadamore
+ *
+ * @compile T6548436b.java
+ */
+
+public class T6548436b {
+
+ enum E { }
+
+ static void test(Enum<?> o) {
+ Object e = (E)o;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/6548436/T6548436c.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6548436
+ * @summary Incorrect inconvertible types error
+ * @author Maurizio Cimadamore
+ *
+ * @compile T6548436c.java
+ */
+
+public class T6548436c {
+
+ interface A<T extends A<? super T>> { }
+
+ interface B extends A<B> { }
+
+ static void test(A<?> a) {
+ Object o = (B)a;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/cast/6548436/T6548436d.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6548436
+ * @summary Incorrect inconvertible types error
+ * @author Maurizio Cimadamore
+ *
+ * @compile/fail T6548436d.java
+ */
+
+public class T6548436d {
+
+ static class Base<E extends Comparable<E>> {}
+
+ static void test(Base<? extends Double> je) {
+ Object o = (Base<Integer>)je;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6487370/T6487370.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6487370
+ * @author Maurizio Cimadamore
+ * @summary javac incorrectly gives ambiguity warning with override-equivalent abstract inherited methods
+ */
+
+public class T6487370 {
+
+ interface I1 {
+ String m(Number n);
+ }
+
+ interface I2 {
+ Object m(Number n);
+ }
+
+ static abstract class X implements I1, I2 {
+ String test() {
+ return m(0.0f);
+ }
+ }
+
+ static class W extends X {
+ public String m(Number n) {
+ return "Hello!";
+ }
+ }
+
+ public static void main(String args[]) {
+ System.out.println(new W().test());
+ }
+}
--- a/langtools/test/tools/javac/generics/6531090/T6531090b.java Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/test/tools/javac/generics/6531090/T6531090b.java Fri Oct 24 20:47:47 2008 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6531090
+ * @bug 6531090 6711619
*
* @summary Cannot access methods/fields of a captured type belonging to an intersection type
* @author Maurizio Cimadamore
@@ -32,12 +32,20 @@
public class T6531090b {
static class A {
- public void a() {}
- public A a;
+ public void a1() {}
+ protected void a2() {}
+ void a3() {}
+ public A a1;
+ protected A a2;
+ A a3;
}
static class B extends A {
- public void b(){}
- public B b;
+ public void b1() {}
+ protected void b2() {}
+ void b3() {}
+ public B b1;
+ protected B b2;
+ B b3;
}
static interface I{
void i();
@@ -65,18 +73,35 @@
}
static void testMemberMethods(C<? extends A, ? extends I> arg) {
- arg.t.a();
- arg.t.b();
+ arg.t.a1();
+ arg.t.a2();
+ arg.t.a3();
+ arg.t.b1();
+ arg.t.b2();
+ arg.t.b3();
arg.t.i1();
- arg.w.a();
- arg.w.b();
+ arg.w.a1();
+ arg.w.a2();
+ arg.w.a3();
+ arg.w.b1();
+ arg.w.b2();
+ arg.w.b3();
arg.w.i1();
}
static void testMemberFields(C<? extends A, ? extends I> arg) {
- A ta = arg.t.a;
- B tb = arg.t.b;
- A wa = arg.w.a;
- B wb = arg.w.b;
+ A ta; B tb;
+ ta = arg.t.a1;
+ ta = arg.t.a2;
+ ta = arg.t.a3;
+ tb = arg.t.b1;
+ tb = arg.t.b2;
+ tb = arg.t.b3;
+ ta = arg.w.a1;
+ ta = arg.w.a2;
+ ta = arg.w.a3;
+ tb = arg.w.b1;
+ tb = arg.w.b2;
+ tb = arg.w.b3;
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6711619/T6711619a.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6711619
+ *
+ * @summary javac doesn't allow access to protected members in intersection types
+ * @author Maurizio Cimadamore
+ *
+ * @compile/fail/ref=T6711619a.out -XDrawDiagnostics T6711619a.java
+ */
+class T6711619a {
+
+ static class A {
+ private void a() {}
+ private A a;
+ }
+ static class B extends A {
+ private B b() {}
+ private B b;
+ }
+ static interface I{
+ void i();
+ }
+ static interface I1{
+ void i1();
+ }
+ static class E extends B implements I, I1{
+ public void i() {}
+ public void i1() {}
+ }
+ static class C<W extends B & I1, T extends W>{
+ T t;
+ W w;
+ C(W w, T t) {
+ this.w = w;
+ this.t = t;
+ }
+ }
+
+ static void testMemberMethods(C<? extends A, ? extends I> arg) {
+ arg.t.a();
+ arg.t.b();
+ }
+
+ static void testMemberFields(C<? extends A, ? extends I> arg) {
+ A ta; B tb;
+ ta = arg.t.a;
+ tb = arg.t.b;
+ ta = arg.w.a;
+ tb = arg.w.b;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6711619/T6711619a.out Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,7 @@
+T6711619a.java:63:14: compiler.err.report.access: a(), private, T6711619a.A
+T6711619a.java:64:14: compiler.err.report.access: b(), private, T6711619a.B
+T6711619a.java:69:19: compiler.err.report.access: a, private, T6711619a.A
+T6711619a.java:70:19: compiler.err.report.access: b, private, T6711619a.B
+T6711619a.java:71:19: compiler.err.report.access: a, private, T6711619a.A
+T6711619a.java:72:19: compiler.err.report.access: b, private, T6711619a.B
+6 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6711619/T6711619b.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6711619
+ *
+ * @summary javac doesn't allow access to protected members in intersection types
+ * @author Maurizio Cimadamore
+ *
+ * @compile/fail/ref=T6711619b.out -XDrawDiagnostics T6711619b.java
+ */
+
+class T6711619b {
+ static class X1<E extends X1<E>> {
+ private int i;
+ E e;
+ int f() {
+ return e.i;
+ }
+ }
+
+ static class X2<E extends X2<E>> {
+ static private int i;
+ int f() {
+ return E.i;
+ }
+ }
+
+ static class X3<E extends X3<E> & java.io.Serializable> {
+ private int i;
+ E e;
+ int f() {
+ return e.i;
+ }
+ }
+
+ static class X4<E extends X4<E> & java.io.Serializable> {
+ static private int i;
+ int f() {
+ return E.i;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/6711619/T6711619b.out Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,5 @@
+T6711619b.java:39:22: compiler.err.report.access: i, private, T6711619b.X1
+T6711619b.java:46:22: compiler.err.report.access: i, private, T6711619b.X2
+T6711619b.java:54:22: compiler.err.report.access: i, private, T6711619b.X3
+T6711619b.java:61:22: compiler.err.report.access: i, private, T6711619b.X4
+4 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/T6557954.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6557954
+ * @summary Inner class type parameters doesn't get substituted when checking type well-formedness
+ * @author Maurizio Cimadamore
+ *
+ * @compile T6557954.java
+ */
+
+class T6557954<T> {
+ class Foo<U extends T> {}
+ T6557954<Number>.Foo<Integer> f;
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/generics/inference/6718364/T6718364.out Wed Jul 05 16:43:17 2017 +0200
+++ b/langtools/test/tools/javac/generics/inference/6718364/T6718364.out Fri Oct 24 20:47:47 2008 -0700
@@ -1,3 +1,3 @@
T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
-T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: <T>m(T6718364.X<T>,T), T6718364, , T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X
+T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X<T>,T, T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X, kindname.class, T6718364
2 warnings
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6680106/T6680106.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6680106
+ * @summary StackOverFlowError for Cyclic inheritance in TypeParameters with ArrayType Bounds
+ * @author Maurizio Cimadamore
+ * @compile/fail/ref=T6680106.out -XDrawDiagnostics T6680106.java
+ */
+
+class T6680106 {
+ class A0 {}
+ class A1<T extends T[]> {}
+ class A2<T extends S[], S extends T[]> {}
+ class A3<T extends S[], S extends U[], U extends T[]> {}
+ class A5<T extends A0 & T[]> {}
+ class A6<T extends A0 & S[], S extends A0 & T[]> {}
+ class A7<T extends A0 & S[], S extends A0 & U[], U extends A0 & T[]> {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6680106/T6680106.out Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,13 @@
+T6680106.java:34:25: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
+T6680106.java:35:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
+T6680106.java:35:40: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
+T6680106.java:36:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
+T6680106.java:36:40: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
+T6680106.java:36:55: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
+T6680106.java:37:30: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
+T6680106.java:38:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
+T6680106.java:38:50: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
+T6680106.java:39:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
+T6680106.java:39:50: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
+T6680106.java:39:70: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
+12 errors
\ No newline at end of file
--- a/langtools/test/tools/javac/generics/wildcards/6651719/T6651719b.java Wed Jul 05 16:43:17 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- * @test
- * @bug 6651719
- * @summary Compiler crashes possibly during forward reference of TypeParameter
- * @compile T6651719b.java
- */
-import java.util.*;
-
-public class T6651719b {
- <T> void m(T t, List<? super List<T>> list) {}
- void test(List<? super List<?>> list) {
- m("", list);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/wildcards/6762569/T6762569a.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6762569
+ * @summary Javac crashes with AssertionError in Types.containedBy
+ * @compile T6762569a.java
+ */
+import java.util.*;
+
+class T6762569a {
+ <T> void m(T t, List<? super List<T>> list) {}
+
+ void test(List<? super List<?>> list) {
+ m("", list);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/wildcards/6762569/T6762569b.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6762569
+ * @summary Javac crashes with AssertionError in Types.containedBy
+ * @compile/fail T6762569b.java
+ */
+import java.util.*;
+
+class T6762569b {
+ <T> void m(T t, List<? super List<T>> list) {}
+
+ void test(List<? super List<? extends Number>> list) {
+ m("", list);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/wildcards/T6732484.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6732484
+ * @summary Bound error on wildcard code
+ * @author Maurizio Cimadamore
+ * @compile T6732484.java
+ */
+
+class T6732484 {
+ class A<T extends A<T>> {}
+ class B extends A<B> {}
+
+ A<? super B> f;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/T6746184.java Fri Oct 24 20:47:47 2008 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6746184
+ * @summary javac fails to compile call to public varargs method
+ */
+
+public class T6746184 {
+ public static void main(String[] args) {
+ A.m(new Object());
+ }
+}
+
+class A {
+ public static void m(final Object... varargs) {}
+ private static void m(final Object singleArg) {}
+}
\ No newline at end of file