This commit is contained in:
Lana Steuck 2012-04-09 21:58:05 -07:00
commit 7dbe9f0b6d
61 changed files with 2002 additions and 1569 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -221,7 +221,7 @@ public class Flags {
/** Flag that marks a hypothetical method that need not really be
* generated in the binary, but is present in the symbol table to
* simplify checking for erasure clashes.
* simplify checking for erasure clashes - also used for 292 poly sig methods.
*/
public static final long HYPOTHETICAL = 1L<<37;
@ -235,27 +235,21 @@ public class Flags {
*/
public static final long UNION = 1L<<39;
/**
* Flag that marks a signature-polymorphic invoke method.
* (These occur inside java.lang.invoke.MethodHandle.)
*/
public static final long POLYMORPHIC_SIGNATURE = 1L<<40;
/**
* Flag that marks a special kind of bridge methods (the ones that
* come from restricted supertype bounds)
*/
public static final long OVERRIDE_BRIDGE = 1L<<41;
public static final long OVERRIDE_BRIDGE = 1L<<40;
/**
* Flag that marks an 'effectively final' local variable
*/
public static final long EFFECTIVELY_FINAL = 1L<<42;
public static final long EFFECTIVELY_FINAL = 1L<<41;
/**
* Flag that marks non-override equivalent methods with the same signature
*/
public static final long CLASH = 1L<<43;
public static final long CLASH = 1L<<42;
/** Modifier masks.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -202,16 +202,6 @@ public abstract class Symbol implements Element {
return (flags() & INTERFACE) != 0;
}
/** Recognize if this symbol was marked @PolymorphicSignature in the source. */
public boolean isPolymorphicSignatureGeneric() {
return (flags() & (POLYMORPHIC_SIGNATURE | HYPOTHETICAL)) == POLYMORPHIC_SIGNATURE;
}
/** Recognize if this symbol was split from a @PolymorphicSignature symbol in the source. */
public boolean isPolymorphicSignatureInstance() {
return (flags() & (POLYMORPHIC_SIGNATURE | HYPOTHETICAL)) == (POLYMORPHIC_SIGNATURE | HYPOTHETICAL);
}
/** Is this symbol declared (directly or indirectly) local
* to a method or variable initializer?
* Also includes fields of inner classes which are in
@ -1316,6 +1306,25 @@ public abstract class Symbol implements Element {
getKind() == ElementKind.INSTANCE_INIT;
}
/**
* A polymorphic signature method (JLS SE 7, 8.4.1) is a method that
* (i) is declared in the java.lang.invoke.MethodHandle class, (ii) takes
* a single variable arity parameter (iii) whose declared type is Object[],
* (iv) has a return type of Object and (v) is native.
*/
public boolean isSignaturePolymorphic(Types types) {
List<Type> argtypes = type.getParameterTypes();
Type firstElemType = argtypes.nonEmpty() ?
types.elemtype(argtypes.head) :
null;
return owner == types.syms.methodHandleType.tsym &&
argtypes.length() == 1 &&
firstElemType != null &&
types.isSameType(firstElemType, types.syms.objectType) &&
types.isSameType(type.getReturnType(), types.syms.objectType) &&
(flags() & NATIVE) != 0;
}
public Attribute getDefaultValue() {
return defaultValue;
}

View File

@ -127,7 +127,6 @@ public class Symtab {
public final Type serializableType;
public final Type methodHandleType;
public final Type nativeHeaderType;
public final Type polymorphicSignatureType;
public final Type throwableType;
public final Type errorType;
public final Type interruptedExceptionType;
@ -436,7 +435,6 @@ public class Symtab {
throwableType = enterClass("java.lang.Throwable");
serializableType = enterClass("java.io.Serializable");
methodHandleType = enterClass("java.lang.invoke.MethodHandle");
polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature");
errorType = enterClass("java.lang.Error");
illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
interruptedExceptionType = enterClass("java.lang.InterruptedException");
@ -483,7 +481,6 @@ public class Symtab {
synthesizeEmptyInterfaceIfMissing(autoCloseableType);
synthesizeEmptyInterfaceIfMissing(cloneableType);
synthesizeEmptyInterfaceIfMissing(serializableType);
synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
synthesizeBoxTypeIfMissing(doubleType);
synthesizeBoxTypeIfMissing(floatType);
synthesizeBoxTypeIfMissing(voidType);

View File

@ -42,6 +42,7 @@ import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.comp.Check.CheckContext;
import com.sun.source.tree.IdentifierTree;
import com.sun.source.tree.MemberSelectTree;
@ -132,6 +133,11 @@ public class Attr extends JCTree.Visitor {
findDiamonds = options.get("findDiamond") != null &&
source.allowDiamond();
useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
statInfo = new ResultInfo(NIL, Type.noType);
varInfo = new ResultInfo(VAR, Type.noType);
unknownExprInfo = new ResultInfo(VAL, Type.noType);
unknownTypeInfo = new ResultInfo(TYP, Type.noType);
}
/** Switch: relax some constraints for retrofit mode.
@ -204,7 +210,7 @@ public class Attr extends JCTree.Visitor {
Type check(JCTree tree, Type owntype, int ownkind, ResultInfo resultInfo) {
if (owntype.tag != ERROR && resultInfo.pt.tag != METHOD && resultInfo.pt.tag != FORALL) {
if ((ownkind & ~resultInfo.pkind) == 0) {
owntype = chk.checkType(tree.pos(), owntype, resultInfo.pt, errKey);
owntype = resultInfo.check(tree, owntype);
} else {
log.error(tree.pos(), "unexpected.type",
kindNames(resultInfo.pkind),
@ -394,20 +400,30 @@ public class Attr extends JCTree.Visitor {
}
}
static class ResultInfo {
class ResultInfo {
int pkind;
Type pt;
CheckContext checkContext;
ResultInfo(int pkind, Type pt) {
this(pkind, pt, chk.basicHandler);
}
protected ResultInfo(int pkind, Type pt, CheckContext checkContext) {
this.pkind = pkind;
this.pt = pt;
this.checkContext = checkContext;
}
protected Type check(DiagnosticPosition pos, Type found) {
return chk.checkType(pos, found, pt, checkContext);
}
}
private final ResultInfo statInfo = new ResultInfo(NIL, Type.noType);
private final ResultInfo varInfo = new ResultInfo(VAR, Type.noType);
private final ResultInfo unknownExprInfo = new ResultInfo(VAL, Type.noType);
private final ResultInfo unknownTypeInfo = new ResultInfo(TYP, Type.noType);
private final ResultInfo statInfo;
private final ResultInfo varInfo;
private final ResultInfo unknownExprInfo;
private final ResultInfo unknownTypeInfo;
Type pt() {
return resultInfo.pt;
@ -429,10 +445,6 @@ public class Attr extends JCTree.Visitor {
*/
ResultInfo resultInfo;
/** Visitor argument: the error key to be generated when a type error occurs
*/
String errKey;
/** Visitor result: the computed type.
*/
Type result;
@ -445,17 +457,11 @@ public class Attr extends JCTree.Visitor {
* @param resultInfo The result info visitor argument.
*/
private Type attribTree(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
return attribTree(tree, env, resultInfo, "incompatible.types");
}
private Type attribTree(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo, String errKey) {
Env<AttrContext> prevEnv = this.env;
ResultInfo prevResult = this.resultInfo;
String prevErrKey = this.errKey;
try {
this.env = env;
this.resultInfo = resultInfo;
this.errKey = errKey;
tree.accept(this);
if (tree == breakTree)
throw new BreakAttr(env);
@ -466,18 +472,13 @@ public class Attr extends JCTree.Visitor {
} finally {
this.env = prevEnv;
this.resultInfo = prevResult;
this.errKey = prevErrKey;
}
}
/** Derived visitor method: attribute an expression tree.
*/
public Type attribExpr(JCTree tree, Env<AttrContext> env, Type pt) {
return attribExpr(tree, env, pt, "incompatible.types");
}
public Type attribExpr(JCTree tree, Env<AttrContext> env, Type pt, String key) {
return attribTree(tree, env, new ResultInfo(VAL, pt.tag != ERROR ? pt : Type.noType), key);
return attribTree(tree, env, new ResultInfo(VAL, pt.tag != ERROR ? pt : Type.noType));
}
/** Derived visitor method: attribute an expression tree with
@ -1121,9 +1122,16 @@ public class Attr extends JCTree.Visitor {
localEnv;
// Attribute resource declarations
for (JCTree resource : tree.resources) {
CheckContext twrContext = new Check.NestedCheckContext(resultInfo.checkContext) {
@Override
public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
chk.basicHandler.report(pos, found, req, diags.fragment("try.not.applicable.to.type", found));
}
};
ResultInfo twrResult = new ResultInfo(VAL, syms.autoCloseableType, twrContext);
if (resource.hasTag(VARDEF)) {
attribStat(resource, tryEnv);
chk.checkType(resource, resource.type, syms.autoCloseableType, "try.not.applicable.to.type");
twrResult.check(resource, resource.type);
//check that resource type cannot throw InterruptedException
checkAutoCloseable(resource.pos(), localEnv, resource.type);
@ -1131,7 +1139,7 @@ public class Attr extends JCTree.Visitor {
VarSymbol var = (VarSymbol)TreeInfo.symbolFor(resource);
var.setData(ElementKind.RESOURCE_VARIABLE);
} else {
attribExpr(resource, tryEnv, syms.autoCloseableType, "try.not.applicable.to.type");
attribTree(resource, tryEnv, twrResult);
}
}
// Attribute body
@ -1846,7 +1854,7 @@ public class Attr extends JCTree.Visitor {
}
Type attribDiamond(Env<AttrContext> env,
JCNewClass tree,
final JCNewClass tree,
Type clazztype,
List<Type> argtypes,
List<Type> typeargtypes) {
@ -1886,25 +1894,17 @@ public class Attr extends JCTree.Visitor {
clazztype = syms.errType;
}
if (clazztype.tag == FORALL && !pt().isErroneous()) {
//if the resolved constructor's return type has some uninferred
//type-variables, infer them using the expected type and declared
//bounds (JLS 15.12.2.8).
if (clazztype.tag == FORALL && !resultInfo.pt.isErroneous()) {
try {
clazztype = infer.instantiateExpr((ForAll) clazztype,
pt().tag == NONE ? syms.objectType : pt(),
Warner.noWarnings);
clazztype = resultInfo.checkContext.rawInstantiatePoly((ForAll)clazztype, pt(), Warner.noWarnings);
} catch (Infer.InferenceException ex) {
//an error occurred while inferring uninstantiated type-variables
log.error(tree.clazz.pos(),
"cant.apply.diamond.1",
diags.fragment("diamond", clazztype.tsym),
ex.diagnostic);
resultInfo.checkContext.report(tree.clazz.pos(), clazztype, resultInfo.pt,
diags.fragment("cant.apply.diamond.1", diags.fragment("diamond", clazztype.tsym), ex.diagnostic));
}
}
return chk.checkClassType(tree.clazz.pos(),
clazztype,
true);
return chk.checkClassType(tree.clazz.pos(), clazztype, true);
}
/** Make an attributed null check tree.
@ -2106,6 +2106,7 @@ public class Attr extends JCTree.Visitor {
if (exprtype.constValue() != null)
owntype = cfolder.coerce(exprtype, owntype);
result = check(tree, capture(owntype), VAL, resultInfo);
chk.checkRedundantCast(localEnv, tree);
}
public void visitTypeTest(JCInstanceOf tree) {

View File

@ -269,23 +269,6 @@ public class Check {
else return syms.errType;
}
/** Report a type error.
* @param pos Position to be used for error reporting.
* @param problem A string describing the error.
* @param found The type that was found.
* @param req The type that was required.
*/
Type typeError(DiagnosticPosition pos, Object problem, Type found, Type req) {
log.error(pos, "prob.found.req",
problem, found, req);
return types.createErrorType(found);
}
Type typeError(DiagnosticPosition pos, String problem, Type found, Type req, Object explanation) {
log.error(pos, "prob.found.req.1", problem, found, req, explanation);
return types.createErrorType(found);
}
/** Report an error that wrong type tag was found.
* @param pos Position to be used for error reporting.
* @param required An internationalized string describing the type tag
@ -430,6 +413,86 @@ public class Check {
* Type Checking
**************************************************************************/
/**
* A check context is an object that can be used to perform compatibility
* checks - depending on the check context, meaning of 'compatibility' might
* vary significantly.
*/
interface CheckContext {
/**
* Is type 'found' compatible with type 'req' in given context
*/
boolean compatible(Type found, Type req, Warner warn);
/**
* Instantiate a ForAll type against a given target type 'req' in given context
*/
Type rawInstantiatePoly(ForAll found, Type req, Warner warn);
/**
* Report a check error
*/
void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details);
/**
* Obtain a warner for this check context
*/
public Warner checkWarner(DiagnosticPosition pos, Type found, Type req);
}
/**
* This class represent a check context that is nested within another check
* context - useful to check sub-expressions. The default behavior simply
* redirects all method calls to the enclosing check context leveraging
* the forwarding pattern.
*/
static class NestedCheckContext implements CheckContext {
CheckContext enclosingContext;
NestedCheckContext(CheckContext enclosingContext) {
this.enclosingContext = enclosingContext;
}
public boolean compatible(Type found, Type req, Warner warn) {
return enclosingContext.compatible(found, req, warn);
}
public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) {
return enclosingContext.rawInstantiatePoly(found, req, warn);
}
public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
enclosingContext.report(pos, found, req, details);
}
public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) {
return enclosingContext.checkWarner(pos, found, req);
}
}
/**
* Check context to be used when evaluating assignment/return statements
*/
CheckContext basicHandler = new CheckContext() {
public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
if (details == null) {
log.error(pos, "prob.found.req", found, req);
} else {
log.error(pos, "prob.found.req.1", details);
}
}
public boolean compatible(Type found, Type req, Warner warn) {
return types.isAssignable(found, req, warn);
}
public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) {
if (req.tag == NONE)
req = found.qtype.tag <= VOID ? found.qtype : syms.objectType;
return infer.instantiateExpr(found, req, warn);
}
public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) {
return convertWarner(pos, found, req);
}
};
/** Check that a given type is assignable to a given proto-type.
* If it is, return the type, otherwise return errType.
* @param pos Position to be used for error reporting.
@ -437,64 +500,54 @@ public class Check {
* @param req The type that was required.
*/
Type checkType(DiagnosticPosition pos, Type found, Type req) {
return checkType(pos, found, req, "incompatible.types");
return checkType(pos, found, req, basicHandler);
}
Type checkType(DiagnosticPosition pos, Type found, Type req, String errKey) {
Type checkType(final DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) {
if (req.tag == ERROR)
return req;
if (found.tag == FORALL)
return instantiatePoly(pos, (ForAll)found, req, convertWarner(pos, found, req));
if (found.tag == FORALL) {
ForAll fa = (ForAll)found;
Type owntype = instantiatePoly(pos, checkContext, fa, req, checkContext.checkWarner(pos, found, req));
return checkType(pos, owntype, req, checkContext);
}
if (req.tag == NONE)
return found;
if (types.isAssignable(found, req, convertWarner(pos, found, req)))
if (checkContext.compatible(found, req, checkContext.checkWarner(pos, found, req))) {
return found;
if (found.tag <= DOUBLE && req.tag <= DOUBLE)
return typeError(pos, diags.fragment("possible.loss.of.precision"), found, req);
if (found.isSuperBound()) {
log.error(pos, "assignment.from.super-bound", found);
} else {
if (found.tag <= DOUBLE && req.tag <= DOUBLE) {
checkContext.report(pos, found, req, diags.fragment("possible.loss.of.precision"));
return types.createErrorType(found);
}
checkContext.report(pos, found, req, null);
return types.createErrorType(found);
}
if (req.isExtendsBound()) {
log.error(pos, "assignment.to.extends-bound", req);
return types.createErrorType(found);
}
return typeError(pos, diags.fragment(errKey), found, req);
}
/** Instantiate polymorphic type to some prototype, unless
* prototype is `anyPoly' in which case polymorphic type
* is returned unchanged.
*/
Type instantiatePoly(DiagnosticPosition pos, ForAll t, Type pt, Warner warn) throws Infer.NoInstanceException {
if (pt == Infer.anyPoly && complexInference) {
return t;
} else if (pt == Infer.anyPoly || pt.tag == NONE) {
Type newpt = t.qtype.tag <= VOID ? t.qtype : syms.objectType;
return instantiatePoly(pos, t, newpt, warn);
} else if (pt.tag == ERROR) {
return pt;
} else {
try {
return infer.instantiateExpr(t, pt, warn);
} catch (Infer.NoInstanceException ex) {
Type instantiatePoly(DiagnosticPosition pos, CheckContext checkContext, ForAll t, Type pt, Warner warn) throws Infer.NoInstanceException {
try {
return checkContext.rawInstantiatePoly(t, pt, warn);
} catch (final Infer.NoInstanceException ex) {
JCDiagnostic d = ex.getDiagnostic();
if (d != null) {
if (ex.isAmbiguous) {
JCDiagnostic d = ex.getDiagnostic();
log.error(pos,
"undetermined.type" + (d!=null ? ".1" : ""),
t, d);
return types.createErrorType(pt);
} else {
JCDiagnostic d = ex.getDiagnostic();
return typeError(pos,
diags.fragment("incompatible.types" + (d!=null ? ".1" : ""), d),
t, pt);
d = diags.fragment("undetermined.type", t, d);
}
} catch (Infer.InvalidInstanceException ex) {
JCDiagnostic d = ex.getDiagnostic();
log.error(pos, "invalid.inferred.types", t.tvars, d);
return types.createErrorType(pt);
}
checkContext.report(pos, t, pt, d);
return types.createErrorType(pt);
} catch (Infer.InvalidInstanceException ex) {
JCDiagnostic d = ex.getDiagnostic();
if (d != null) {
d = diags.fragment("invalid.inferred.types", t.tvars, d);
}
checkContext.report(pos, t, pt, d);
return types.createErrorType(pt);
}
}
@ -505,17 +558,48 @@ public class Check {
* @param req The target type of the cast.
*/
Type checkCastable(DiagnosticPosition pos, Type found, Type req) {
return checkCastable(pos, found, req, basicHandler);
}
Type checkCastable(DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) {
if (found.tag == FORALL) {
instantiatePoly(pos, (ForAll) found, req, castWarner(pos, found, req));
instantiatePoly(pos, basicHandler, (ForAll) found, req, castWarner(pos, found, req));
return req;
} else if (types.isCastable(found, req, castWarner(pos, found, req))) {
return req;
} else {
return typeError(pos,
diags.fragment("inconvertible.types"),
found, req);
checkContext.report(pos, found, req, diags.fragment("inconvertible.types", found, req));
return types.createErrorType(found);
}
}
/** Check for redundant casts (i.e. where source type is a subtype of target type)
* The problem should only be reported for non-292 cast
*/
public void checkRedundantCast(Env<AttrContext> env, JCTypeCast tree) {
if (!tree.type.isErroneous() &&
(env.info.lint == null || env.info.lint.isEnabled(Lint.LintCategory.CAST))
&& types.isSameType(tree.expr.type, tree.clazz.type)
&& !is292targetTypeCast(tree)) {
log.warning(Lint.LintCategory.CAST,
tree.pos(), "redundant.cast", tree.expr.type);
}
}
//where
private boolean is292targetTypeCast(JCTypeCast tree) {
boolean is292targetTypeCast = false;
JCExpression expr = TreeInfo.skipParens(tree.expr);
if (expr.hasTag(APPLY)) {
JCMethodInvocation apply = (JCMethodInvocation)expr;
Symbol sym = TreeInfo.symbol(apply.meth);
is292targetTypeCast = sym != null &&
sym.kind == MTH &&
(sym.flags() & HYPOTHETICAL) != 0;
}
return is292targetTypeCast;
}
//where
/** Is type a type variable, or a (possibly multi-dimensional) array of
* type variables?
@ -838,14 +922,6 @@ public class Check {
&& types.isSubtype(actual, types.supertype(formal))
&& types.isSubtypeUnchecked(actual, types.interfaces(formal), warn))
return;
if (false) {
// TODO: make assertConvertible work
typeError(tree.pos(), diags.fragment("incompatible.types"), actual, formal);
throw new AssertionError("Tree: " + tree
+ " actual:" + actual
+ " formal: " + formal);
}
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -347,7 +347,7 @@ public class Infer {
that.tvars,
instantiateAsUninferredVars(undetvars, that.tvars));
}
return chk.checkType(warn.pos(), that.inst(targs, types), to);
return that.inst(targs, types);
}
//where
private List<Type> instantiateAsUninferredVars(List<Type> undetvars, List<Type> tvars) {
@ -603,8 +603,7 @@ public class Infer {
* method signature. The target return type is computed from the immediately
* enclosing scope surrounding the polymorphic-signature call.
*/
Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env, Type site,
Name name,
Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env,
MethodSymbol spMethod, // sig. poly. method or null if none
List<Type> argtypes) {
final Type restype;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -781,20 +781,6 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
&& s.owner.kind != MTH
&& types.isSameType(c.type, syms.deprecatedType))
s.flags_field |= Flags.DEPRECATED;
// Internally to java.lang.invoke, a @PolymorphicSignature annotation
// acts like a classfile attribute.
if (!c.type.isErroneous() &&
types.isSameType(c.type, syms.polymorphicSignatureType)) {
if (!target.hasMethodHandles()) {
// Somebody is compiling JDK7 source code to a JDK6 target.
// Make it an error, since it is unlikely but important.
log.error(env.tree.pos(),
"wrong.target.for.polymorphic.signature.definition",
target.name);
}
// Pull the flag through for better diagnostics, even on a bad target.
s.flags_field |= Flags.POLYMORPHIC_SIGNATURE;
}
if (!annotated.add(a.type.tsym))
log.error(a.pos, "duplicate.annotation");
}

View File

@ -29,6 +29,8 @@ import com.sun.tools.javac.api.Formattable.LocalizedString;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.comp.Attr.ResultInfo;
import com.sun.tools.javac.comp.Check.CheckContext;
import com.sun.tools.javac.comp.Resolve.MethodResolutionContext.Candidate;
import com.sun.tools.javac.jvm.*;
import com.sun.tools.javac.tree.*;
@ -70,6 +72,7 @@ public class Resolve {
Names names;
Log log;
Symtab syms;
Attr attr;
Check chk;
Infer infer;
ClassReader reader;
@ -101,6 +104,7 @@ public class Resolve {
names = Names.instance(context);
log = Log.instance(context);
attr = Attr.instance(context);
chk = Check.instance(context);
infer = Infer.instance(context);
reader = ClassReader.instance(context);
@ -395,7 +399,6 @@ public class Resolve {
else {
Symbol s2 = ((MethodSymbol)sym).implementation(site.tsym, types, true);
return (s2 == null || s2 == sym || sym.owner == s2.owner ||
s2.isPolymorphicSignatureGeneric() ||
!types.isSubSignature(types.memberType(site, s2), types.memberType(site, sym)));
}
}
@ -445,7 +448,6 @@ public class Resolve {
boolean useVarargs,
Warner warn)
throws Infer.InferenceException {
boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles;
if (useVarargs && (m.flags() & VARARGS) == 0)
throw inapplicableMethodException.setMessage();
Type mt = types.memberType(site, m);
@ -486,8 +488,7 @@ public class Resolve {
}
// find out whether we need to go the slow route via infer
boolean instNeeded = tvars.tail != null || /*inlined: tvars.nonEmpty()*/
polymorphicSignature;
boolean instNeeded = tvars.tail != null; /*inlined: tvars.nonEmpty()*/
for (List<Type> l = argtypes;
l.tail != null/*inlined: l.nonEmpty()*/ && !instNeeded;
l = l.tail) {
@ -495,9 +496,7 @@ public class Resolve {
}
if (instNeeded)
return polymorphicSignature ?
infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes) :
infer.instantiateMethod(env,
return infer.instantiateMethod(env,
tvars,
(MethodType)mt,
m,
@ -627,15 +626,8 @@ public class Resolve {
}
while (argtypes.nonEmpty() && formals.head != varargsFormal) {
Type undetFormal = infer.asUndetType(formals.head, undetvars);
Type capturedActual = types.capture(argtypes.head);
boolean works = allowBoxing ?
types.isConvertible(capturedActual, undetFormal, warn) :
types.isSubtypeUnchecked(capturedActual, undetFormal, warn);
if (!works) {
throw handler.argumentMismatch(false, argtypes.head, formals.head);
}
checkedArgs.append(capturedActual);
ResultInfo resultInfo = methodCheckResult(formals.head, allowBoxing, false, undetvars, handler, warn);
checkedArgs.append(resultInfo.check(env.tree.pos(), argtypes.head));
argtypes = argtypes.tail;
formals = formals.tail;
}
@ -648,13 +640,9 @@ public class Resolve {
//note: if applicability check is triggered by most specific test,
//the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
Type elt = types.elemtype(varargsFormal);
Type eltUndet = infer.asUndetType(elt, undetvars);
while (argtypes.nonEmpty()) {
Type capturedActual = types.capture(argtypes.head);
if (!types.isConvertible(capturedActual, eltUndet, warn)) {
throw handler.argumentMismatch(true, argtypes.head, elt);
}
checkedArgs.append(capturedActual);
ResultInfo resultInfo = methodCheckResult(elt, allowBoxing, true, undetvars, handler, warn);
checkedArgs.append(resultInfo.check(env.tree.pos(), argtypes.head));
argtypes = argtypes.tail;
}
//check varargs element type accessibility
@ -665,39 +653,116 @@ public class Resolve {
}
return checkedArgs.toList();
}
// where
public static class InapplicableMethodException extends RuntimeException {
private static final long serialVersionUID = 0;
JCDiagnostic diagnostic;
JCDiagnostic.Factory diags;
/**
* Check context to be used during method applicability checks. A method check
* context might contain inference variables.
*/
abstract class MethodCheckContext implements CheckContext {
InapplicableMethodException(JCDiagnostic.Factory diags) {
this.diagnostic = null;
this.diags = diags;
}
InapplicableMethodException setMessage() {
this.diagnostic = null;
return this;
}
InapplicableMethodException setMessage(String key) {
this.diagnostic = key != null ? diags.fragment(key) : null;
return this;
}
InapplicableMethodException setMessage(String key, Object... args) {
this.diagnostic = key != null ? diags.fragment(key, args) : null;
return this;
}
InapplicableMethodException setMessage(JCDiagnostic diag) {
this.diagnostic = diag;
return this;
}
MethodCheckHandler handler;
boolean useVarargs;
List<Type> undetvars;
Warner rsWarner;
public JCDiagnostic getDiagnostic() {
return diagnostic;
}
public MethodCheckContext(MethodCheckHandler handler, boolean useVarargs, List<Type> undetvars, Warner rsWarner) {
this.handler = handler;
this.useVarargs = useVarargs;
this.undetvars = undetvars;
this.rsWarner = rsWarner;
}
private final InapplicableMethodException inapplicableMethodException;
public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) {
throw handler.argumentMismatch(useVarargs, found, req);
}
public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) {
throw new AssertionError("ForAll in argument position");
}
public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) {
return rsWarner;
}
}
/**
* Subclass of method check context class that implements strict method conversion.
* Strict method conversion checks compatibility between types using subtyping tests.
*/
class StrictMethodContext extends MethodCheckContext {
public StrictMethodContext(MethodCheckHandler handler, boolean useVarargs, List<Type> undetvars, Warner rsWarner) {
super(handler, useVarargs, undetvars, rsWarner);
}
public boolean compatible(Type found, Type req, Warner warn) {
return types.isSubtypeUnchecked(found, infer.asUndetType(req, undetvars), warn);
}
}
/**
* Subclass of method check context class that implements loose method conversion.
* Loose method conversion checks compatibility between types using method conversion tests.
*/
class LooseMethodContext extends MethodCheckContext {
public LooseMethodContext(MethodCheckHandler handler, boolean useVarargs, List<Type> undetvars, Warner rsWarner) {
super(handler, useVarargs, undetvars, rsWarner);
}
public boolean compatible(Type found, Type req, Warner warn) {
return types.isConvertible(found, infer.asUndetType(req, undetvars), warn);
}
}
/**
* Create a method check context to be used during method applicability check
*/
ResultInfo methodCheckResult(Type to, boolean allowBoxing, boolean useVarargs,
List<Type> undetvars, MethodCheckHandler methodHandler, Warner rsWarner) {
MethodCheckContext checkContext = allowBoxing ?
new LooseMethodContext(methodHandler, useVarargs, undetvars, rsWarner) :
new StrictMethodContext(methodHandler, useVarargs, undetvars, rsWarner);
return attr.new ResultInfo(VAL, to, checkContext) {
@Override
protected Type check(DiagnosticPosition pos, Type found) {
return super.check(pos, chk.checkNonVoid(pos, types.capture(types.upperBound(found))));
}
};
}
public static class InapplicableMethodException extends RuntimeException {
private static final long serialVersionUID = 0;
JCDiagnostic diagnostic;
JCDiagnostic.Factory diags;
InapplicableMethodException(JCDiagnostic.Factory diags) {
this.diagnostic = null;
this.diags = diags;
}
InapplicableMethodException setMessage() {
this.diagnostic = null;
return this;
}
InapplicableMethodException setMessage(String key) {
this.diagnostic = key != null ? diags.fragment(key) : null;
return this;
}
InapplicableMethodException setMessage(String key, Object... args) {
this.diagnostic = key != null ? diags.fragment(key, args) : null;
return this;
}
InapplicableMethodException setMessage(JCDiagnostic diag) {
this.diagnostic = diag;
return this;
}
public JCDiagnostic getDiagnostic() {
return diagnostic;
}
}
private final InapplicableMethodException inapplicableMethodException;
/* ***************************************************************************
* Symbol lookup
@ -1670,25 +1735,18 @@ public class Resolve {
steps = steps.tail;
}
if (sym.kind >= AMBIGUOUS) {
if (site.tsym.isPolymorphicSignatureGeneric()) {
//polymorphic receiver - synthesize new method symbol
//if nothing is found return the 'first' error
MethodResolutionPhase errPhase =
currentResolutionContext.firstErroneousResolutionPhase();
sym = access(currentResolutionContext.resolutionCache.get(errPhase),
pos, location, site, name, true, argtypes, typeargtypes);
env.info.varArgs = errPhase.isVarargsRequired;
} else if (allowMethodHandles) {
MethodSymbol msym = (MethodSymbol)sym;
if (msym.isSignaturePolymorphic(types)) {
env.info.varArgs = false;
sym = findPolymorphicSignatureInstance(env,
site, name, null, argtypes);
return findPolymorphicSignatureInstance(env, sym, argtypes);
}
else {
//if nothing is found return the 'first' error
MethodResolutionPhase errPhase =
currentResolutionContext.firstErroneousResolutionPhase();
sym = access(currentResolutionContext.resolutionCache.get(errPhase),
pos, location, site, name, true, argtypes, typeargtypes);
env.info.varArgs = errPhase.isVarargsRequired;
}
} else if (allowMethodHandles && sym.isPolymorphicSignatureGeneric()) {
//non-instantiated polymorphic signature - synthesize new method symbol
env.info.varArgs = false;
sym = findPolymorphicSignatureInstance(env,
site, name, (MethodSymbol)sym, argtypes);
}
return sym;
}
@ -1701,40 +1759,25 @@ public class Resolve {
* Searches in a side table, not the main scope of the site.
* This emulates the lookup process required by JSR 292 in JVM.
* @param env Attribution environment
* @param site The original type from where the selection takes place.
* @param name The method's name.
* @param spMethod A template for the implicit method, or null.
* @param argtypes The required argument types.
* @param typeargtypes The required type arguments.
* @param spMethod signature polymorphic method - i.e. MH.invokeExact
* @param argtypes The required argument types
*/
Symbol findPolymorphicSignatureInstance(Env<AttrContext> env, Type site,
Name name,
MethodSymbol spMethod, // sig. poly. method or null if none
Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
Symbol spMethod,
List<Type> argtypes) {
Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
site, name, spMethod, argtypes);
long flags = ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE |
(spMethod != null ?
spMethod.flags() & Flags.AccessFlags :
Flags.PUBLIC | Flags.STATIC);
Symbol m = null;
for (Scope.Entry e = polymorphicSignatureScope.lookup(name);
e.scope != null;
e = e.next()) {
Symbol sym = e.sym;
if (types.isSameType(mtype, sym.type) &&
(sym.flags() & Flags.STATIC) == (flags & Flags.STATIC) &&
types.isSameType(sym.owner.type, site)) {
m = sym;
break;
(MethodSymbol)spMethod, argtypes);
for (Symbol sym : polymorphicSignatureScope.getElementsByName(spMethod.name)) {
if (types.isSameType(mtype, sym.type)) {
return sym;
}
}
if (m == null) {
// create the desired method
m = new MethodSymbol(flags, name, mtype, site.tsym);
polymorphicSignatureScope.enter(m);
}
return m;
// create the desired method
long flags = ABSTRACT | HYPOTHETICAL | spMethod.flags() & Flags.AccessFlags;
Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner);
polymorphicSignatureScope.enter(msym);
return msym;
}
/** Resolve a qualified method identifier, throw a fatal error if not

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1320,10 +1320,6 @@ public class ClassReader implements Completer {
sym.flags_field |= PROPRIETARY;
else
proxies.append(proxy);
if (majorVersion >= V51.major &&
proxy.type.tsym == syms.polymorphicSignatureType.tsym) {
sym.flags_field |= POLYMORPHIC_SIGNATURE;
}
}
annotate.later(new AnnotationCompleter(sym, proxies.toList()));
}

View File

@ -983,12 +983,13 @@ public class JavacParser implements Parser {
t = lambdaExpressionOrStatement(variableDeclaratorId(mods, t), pos);
break;
}
} else {
Assert.check((mode & EXPR) != 0);
} else if ((mode & EXPR) != 0) {
mode = EXPR;
JCExpression e = term2Rest(t1, TreeInfo.shiftPrec);
t = F.at(pos1).Binary(op, t, e);
t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
} else {
accept(GT);
}
} else if ((mode & TYPE) != 0 &&
(token.kind == IDENTIFIER || token.kind == ELLIPSIS)) {

View File

@ -134,12 +134,6 @@ compiler.err.array.dimension.missing=\
compiler.err.array.req.but.found=\
array required, but {0} found
compiler.err.assignment.from.super-bound=\
assigning from wildcard {0}
compiler.err.assignment.to.extends-bound=\
assigning to wildcard {0}
compiler.err.attribute.value.must.be.constant=\
attribute value must be constant
@ -223,9 +217,6 @@ compiler.err.call.to.super.not.allowed.in.enum.ctor=\
compiler.err.no.superclass=\
{0} has no superclass
compiler.err.wrong.target.for.polymorphic.signature.definition=\
MethodHandle API building requires -target 7 runtimes or better; current is -target {0}
# 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
compiler.err.concrete.inheritance.conflict=\
methods {0} from {1} and {2} from {3} are inherited with the same signature
@ -779,17 +770,10 @@ compiler.err.io.exception=\
compiler.err.undef.label=\
undefined label: {0}
compiler.err.undetermined.type=\
cannot infer type arguments for {0}
# 0: type, 1: message segment
compiler.err.undetermined.type.1=\
cannot infer type arguments for {0};\n\
reason: {1}
# 0: list of type, 1: message segment
compiler.err.invalid.inferred.types=\
invalid inferred types for {0}; {1}
compiler.misc.invalid.inferred.types=\
invalid inferred types for {0}\n\
reason: {1}
# 0: message segment, 1: unused
compiler.err.cant.apply.diamond=\
@ -797,7 +781,12 @@ compiler.err.cant.apply.diamond=\
# 0: message segment or type, 1: message segment
compiler.err.cant.apply.diamond.1=\
cannot infer type arguments for {0};\n\
cannot infer type arguments for {0}\n\
reason: {1}
# 0: message segment or type, 1: message segment
compiler.misc.cant.apply.diamond.1=\
cannot infer type arguments for {0}\n\
reason: {1}
compiler.err.unreachable.stmt=\
@ -1503,11 +1492,15 @@ compiler.err.not.within.bounds=\
#####
# 0: message segment, 1: type, 2: type
# 0: type, 1: type
compiler.err.prob.found.req=\
{0}\n\
required: {2}\n\
found: {1}
incompatible types\n\
required: {1}\n\
found: {0}
# 0: message segment
compiler.err.prob.found.req.1=\
incompatible types: {0}
# 0: message segment, 1: type, 2: type
compiler.warn.prob.found.req=\
@ -1515,22 +1508,9 @@ compiler.warn.prob.found.req=\
required: {2}\n\
found: {1}
compiler.err.prob.found.req.1=\
{0} {3}\n\
required: {2}\n\
found: {1}
## The following are all possible strings for the first argument ({0}) of the
## above strings.
compiler.misc.incompatible.types=\
incompatible types
# 0: message segment
compiler.misc.incompatible.types.1=\
incompatible types; {0}
# 0: type, 1: type
compiler.misc.inconvertible.types=\
inconvertible types
{0} cannot be converted to {1}
compiler.misc.possible.loss.of.precision=\
possible loss of precision
@ -1545,19 +1525,15 @@ compiler.misc.unchecked.assign=\
compiler.misc.unchecked.cast.to.type=\
unchecked cast
compiler.misc.assignment.from.super-bound=\
assignment from super-bound type {0}
compiler.misc.assignment.to.extends-bound=\
assignment to extends-bound type {0}
# compiler.err.star.expected=\
# ''*'' expected
# compiler.err.no.elem.type=\
# \[\*\] cannot have a type
# 0: type
compiler.misc.try.not.applicable.to.type=\
try-with-resources not applicable to variable type
try-with-resources not applicable to variable type {0}\n\
(expected a variable of type java.lang.AutoCloseable)
#####
@ -1592,8 +1568,11 @@ compiler.misc.type.parameter=\
## The following are all possible strings for the last argument of all those
## diagnostics whose key ends in ".1"
# 0: type, 1: message segment
compiler.misc.undetermined.type=\
undetermined type
cannot infer type arguments for {0}\n\
reason: {1}
compiler.misc.type.variable.has.undetermined.type=\
type variable {0} has undetermined type

View File

@ -1083,6 +1083,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
public List<JCCatch> catchers;
public JCBlock finalizer;
public List<JCTree> resources;
public boolean finallyCanCompleteNormally;
protected JCTry(List<JCTree> resources,
JCBlock body,
List<JCCatch> catchers,

View File

@ -1,2 +1,2 @@
TestCast6979683_BAD34.java:34:49: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Number, boolean
TestCast6979683_BAD34.java:34:49: compiler.err.prob.found.req: java.lang.Number, boolean
1 error

View File

@ -1,2 +1,2 @@
TestCast6979683_BAD35.java:35:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Number, int
TestCast6979683_BAD35.java:35:45: compiler.err.prob.found.req: java.lang.Number, int
1 error

View File

@ -1,2 +1,2 @@
TestCast6979683_BAD36.java:36:58: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Comparable<java.lang.Integer>, int
TestCast6979683_BAD36.java:36:58: compiler.err.prob.found.req: java.lang.Comparable<java.lang.Integer>, int
1 error

View File

@ -1,2 +1,2 @@
TestCast6979683_BAD37.java:37:61: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Comparable<java.lang.Short>, int
TestCast6979683_BAD37.java:37:61: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Comparable<java.lang.Short>, int)
1 error

View File

@ -1,2 +1,2 @@
TestCast6979683_BAD38.java:38:62: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Comparable<java.lang.Character>, float
TestCast6979683_BAD38.java:38:62: compiler.err.prob.found.req: java.lang.Comparable<java.lang.Character>, float
1 error

View File

@ -1,2 +1,2 @@
TestCast6979683_BAD39.java:39:53: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Number, char
TestCast6979683_BAD39.java:39:53: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Number, char)
1 error

View File

@ -1,3 +1,3 @@
T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.intersection.type: 1, T6722234d.A
T6722234d.java:18:20: compiler.err.prob.found.req: compiler.misc.intersection.type: 1, T6722234d.A
- compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, java.lang.Object,T6722234d.I1,T6722234d.I2)}
1 error

View File

@ -1,3 +1,3 @@
T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.intersection.type: 1, T6722234d.A
T6722234d.java:18:20: compiler.err.prob.found.req: compiler.misc.intersection.type: 1, T6722234d.A
- compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, Object,I1,I2)}
1 error

View File

@ -1,4 +1,4 @@
T6400189a.java:14:35: compiler.warn.unchecked.call.mbr.of.raw.type: <T>getAnnotation(java.lang.Class<T>), java.lang.reflect.Constructor
T6400189a.java:14:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.annotation.Annotation, java.lang.annotation.Documented
T6400189a.java:14:35: compiler.err.prob.found.req: java.lang.annotation.Annotation, java.lang.annotation.Documented
1 error
1 warning

View File

@ -1,4 +1,4 @@
T6400189b.java:24:24: compiler.warn.unchecked.call.mbr.of.raw.type: <T>m(T6400189b<T>), T6400189b.B
T6400189b.java:24:24: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Object, java.lang.Integer
T6400189b.java:24:24: compiler.err.prob.found.req: java.lang.Object, java.lang.Integer
1 error
1 warning

View File

@ -1,2 +1,2 @@
BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: (compiler.misc.incompatible.types), int, java.lang.String
BadlyTypedLabel1.java:13:14: compiler.err.prob.found.req: int, java.lang.String
1 error

View File

@ -1,2 +1,2 @@
BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.math.RoundingMode, java.lang.String
BadlyTypedLabel2.java:15:14: compiler.err.prob.found.req: java.math.RoundingMode, java.lang.String
1 error

View File

@ -1,6 +1,6 @@
T6326754.java:44:12: compiler.err.name.clash.same.erasure: TestConstructor(T), TestConstructor(K)
T6326754.java:52:17: compiler.err.name.clash.same.erasure: setT(K), setT(T)
T6326754.java:64:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), T, T
T6326754.java:64:18: compiler.err.prob.found.req: T, T
T6326754.java:70:11: compiler.err.cant.apply.symbol.1: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC<T>, (compiler.misc.arg.length.mismatch)
- compiler.note.unchecked.filename: T6326754.java
- compiler.note.unchecked.recompile

View File

@ -1,4 +1,4 @@
TwrOnNonResource.java:12:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:15:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:18:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
TwrOnNonResource.java:12:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource)
TwrOnNonResource.java:15:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource)
TwrOnNonResource.java:18:30: compiler.err.prob.found.req.1: (compiler.misc.try.not.applicable.to.type: TwrOnNonResource)
3 errors

View File

@ -1,2 +1,2 @@
T6270087neg.java:36:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6270087neg.Foo<V>, T6270087neg.Foo<U>
T6270087neg.java:36:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6270087neg.Foo<V>, T6270087neg.Foo<U>)
1 error

View File

@ -1,4 +1,4 @@
T6557182.java:12:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer>
T6557182.java:12:56: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T, java.lang.Comparable<java.lang.Integer>)
T6557182.java:16:56: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer>
1 error
1 warning

View File

@ -1,8 +1,8 @@
T6665356.java:31:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long>
T6665356.java:35:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number>
T6665356.java:39:65: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>
T6665356.java:43:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long>
T6665356.java:47:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String>
T6665356.java:51:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long>
T6665356.java:55:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String>
T6665356.java:31:55: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long>)
T6665356.java:35:58: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number>)
T6665356.java:39:65: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>)
T6665356.java:43:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long>)
T6665356.java:47:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String>)
T6665356.java:51:55: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long>)
T6665356.java:55:58: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String>)
7 errors

View File

@ -1,8 +1,8 @@
T6795580.java:31:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[]
T6795580.java:35:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[]
T6795580.java:39:67: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[]
T6795580.java:43:59: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[]
T6795580.java:47:62: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[]
T6795580.java:51:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[]
T6795580.java:55:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[]
T6795580.java:31:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[])
T6795580.java:35:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[])
T6795580.java:39:67: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[])
T6795580.java:43:59: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[])
T6795580.java:47:62: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[])
T6795580.java:51:57: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[])
T6795580.java:55:60: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[])
7 errors

View File

@ -1,2 +1,2 @@
T6932571neg.java:39:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6932571neg.S, G
T6932571neg.java:39:19: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T6932571neg.S, G)
1 error

View File

@ -1,2 +1,2 @@
T7005095neg.java:13:25: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T7005095pos.FooImpl, T7005095pos.Foo<T>
T7005095neg.java:13:25: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: T7005095pos.FooImpl, T7005095pos.Foo<T>)
1 error

View File

@ -1,17 +1,17 @@
T7005671.java:12:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), byte[], X[]
T7005671.java:13:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), short[], X[]
T7005671.java:14:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), int[], X[]
T7005671.java:15:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), long[], X[]
T7005671.java:16:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), float[], X[]
T7005671.java:17:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), double[], X[]
T7005671.java:18:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), char[], X[]
T7005671.java:19:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), boolean[], X[]
T7005671.java:23:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], byte[]
T7005671.java:24:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], short[]
T7005671.java:25:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], int[]
T7005671.java:26:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], long[]
T7005671.java:27:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], float[]
T7005671.java:28:31: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], double[]
T7005671.java:29:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], char[]
T7005671.java:30:32: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), X[], boolean[]
T7005671.java:12:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: byte[], X[])
T7005671.java:13:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: short[], X[])
T7005671.java:14:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: int[], X[])
T7005671.java:15:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: long[], X[])
T7005671.java:16:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: float[], X[])
T7005671.java:17:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: double[], X[])
T7005671.java:18:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: char[], X[])
T7005671.java:19:26: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: boolean[], X[])
T7005671.java:23:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], byte[])
T7005671.java:24:30: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], short[])
T7005671.java:25:28: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], int[])
T7005671.java:26:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], long[])
T7005671.java:27:30: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], float[])
T7005671.java:28:31: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], double[])
T7005671.java:29:29: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], char[])
T7005671.java:30:32: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: X[], boolean[])
16 errors

View File

@ -1,8 +1,6 @@
compiler.err.already.annotated # internal compiler error?
compiler.err.already.defined.this.unit # seems to be masked by compiler.err.duplicate.class
compiler.err.annotation.value.not.allowable.type # cannot happen: precluded by complete type-specific tests
compiler.err.assignment.from.super-bound # DEAD
compiler.err.assignment.to.extends-bound # DEAD
compiler.err.cant.apply.symbol
compiler.err.cant.read.file # (apt.JavaCompiler?)
compiler.err.cant.select.static.class.from.param.type
@ -24,7 +22,6 @@ compiler.err.no.annotation.member
compiler.err.no.encl.instance.of.type.in.scope # cannot occur; always followed by assert false;
compiler.err.no.match.entry # UNUSED?
compiler.err.not.annotation.type # cannot occur given preceding checkType
compiler.err.prob.found.req.1 # Check: DEAD, in unused method
compiler.err.proc.bad.config.file # JavacProcessingEnvironment
compiler.err.proc.cant.access # completion failure
compiler.err.proc.cant.access.1 # completion failure, no stack trace
@ -38,12 +35,8 @@ compiler.err.source.cant.overwrite.input.file
compiler.err.stack.sim.error
compiler.err.type.var.more.than.once # UNUSED
compiler.err.type.var.more.than.once.in.result # UNUSED
compiler.err.undetermined.type
compiler.err.unexpected.type
compiler.err.unsupported.cross.fp.lit # Scanner: host system dependent
compiler.err.wrong.target.for.polymorphic.signature.definition # Transitional 292
compiler.misc.assignment.from.super-bound
compiler.misc.assignment.to.extends-bound
compiler.misc.bad.class.file.header # bad class file
compiler.misc.bad.class.signature # bad class file
compiler.misc.bad.const.pool.tag # bad class file
@ -88,7 +81,6 @@ compiler.misc.type.req.exact
compiler.misc.type.variable.has.undetermined.type
compiler.misc.unable.to.access.file # ClassFile
compiler.misc.undecl.type.var # ClassReader
compiler.misc.undetermined.type
compiler.misc.unicode.str.not.supported # ClassReader
compiler.misc.verbose.retro # UNUSED
compiler.misc.verbose.retro.with # UNUSED

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// key: compiler.err.prob.found.req.1
// key: compiler.misc.cant.apply.diamond.1
// key: compiler.misc.infer.no.conforming.instance.exists
// key: compiler.misc.diamond
class CantApplyDiamond1<X> {
CantApplyDiamond1(CantApplyDiamond1<? super X> lz) { }
void test(CantApplyDiamond1<Integer> li) {
CantApplyDiamond1<String> ls = new CantApplyDiamond1<>(li);
}
}

View File

@ -21,9 +21,8 @@
* questions.
*/
// key: compiler.misc.incompatible.types.1
// key: compiler.misc.infer.no.conforming.instance.exists
// key: compiler.err.prob.found.req
// key: compiler.err.prob.found.req.1
class IncompatibleTypes1<V> {
<T extends Integer & Runnable> IncompatibleTypes1<T> m() {

View File

@ -22,7 +22,7 @@
*/
// key: compiler.misc.inconvertible.types
// key: compiler.err.prob.found.req
// key: compiler.err.prob.found.req.1
class InconvertibleTypes {
class Outer<S> {

View File

@ -21,7 +21,8 @@
* questions.
*/
// key: compiler.err.invalid.inferred.types
// key: compiler.err.prob.found.req.1
// key: compiler.misc.invalid.inferred.types
// key: compiler.misc.inferred.do.not.conform.to.bounds
import java.util.*;

View File

@ -22,7 +22,7 @@
*/
// key: compiler.misc.possible.loss.of.precision
// key: compiler.err.prob.found.req
// key: compiler.err.prob.found.req.1
class PossibleLossPrecision {
long l;

View File

@ -22,7 +22,7 @@
*/
// key: compiler.misc.try.not.applicable.to.type
// key: compiler.err.prob.found.req
// key: compiler.err.prob.found.req.1
class ResourceNotApplicableToType {
void m() {

View File

@ -21,7 +21,8 @@
* questions.
*/
// key: compiler.err.undetermined.type.1
// key: compiler.err.prob.found.req.1
// key: compiler.misc.undetermined.type
// key: compiler.misc.no.unique.maximal.instance.exists
class UndeterminedType1<V> {

View File

@ -24,7 +24,6 @@
// key: compiler.misc.where.intersection
// key: compiler.misc.where.description.intersection
// key: compiler.misc.intersection.type
// key: compiler.misc.incompatible.types
// key: compiler.err.prob.found.req
// options: -XDdiags=where
// run: simple

View File

@ -1,2 +1,2 @@
T6207386.java:13:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), X, T6207386.F<? super X>
T6207386.java:13:30: compiler.err.prob.found.req: X, T6207386.F<? super X>
1 error

View File

@ -1,19 +1,19 @@
Neg05.java:19:48: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:19:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
Neg05.java:19:35: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
Neg05.java:20:58: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:20:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
Neg05.java:20:45: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
Neg05.java:21:43: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:21:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
Neg05.java:21:30: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:22:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
Neg05.java:22:43: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:24:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
Neg05.java:24:35: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:25:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
Neg05.java:25:45: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:26:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
Neg05.java:26:30: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:27:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
Neg05.java:27:43: compiler.err.prob.found.req: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
Neg05.java:31:37: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:32:47: compiler.err.improperly.formed.type.inner.raw.param
Neg05.java:33:32: compiler.err.improperly.formed.type.inner.raw.param

View File

@ -1,2 +1,2 @@
Neg06.java:16:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.infer.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
Neg06.java:16:37: compiler.err.prob.found.req.1: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.infer.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>))
1 error

View File

@ -1,2 +1,2 @@
Neg10.java:16:22: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg10.Foo<java.lang.Integer>, Neg10.Foo<java.lang.Number>
Neg10.java:16:22: compiler.err.prob.found.req: Neg10.Foo<java.lang.Integer>, Neg10.Foo<java.lang.Number>
1 error

View File

@ -1,3 +1,3 @@
T6315770.java:16:42: compiler.err.undetermined.type.1: <T>T6315770<T>, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String>
T6315770.java:16:42: compiler.err.prob.found.req.1: (compiler.misc.undetermined.type: <T>T6315770<T>, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable))
T6315770.java:17:40: compiler.err.prob.found.req.1: (compiler.misc.infer.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)
2 errors

View File

@ -1,2 +1,2 @@
T6638712b.java:14:21: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, T, java.lang.String)), <T>T, java.lang.String
T6638712b.java:14:21: compiler.err.prob.found.req.1: (compiler.misc.infer.no.conforming.instance.exists: T, T, java.lang.String)
1 error

View File

@ -1,2 +1,2 @@
T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: X, T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>)), <X>T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>
T6638712e.java:17:27: compiler.err.prob.found.req.1: (compiler.misc.infer.no.conforming.instance.exists: X, T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>)
1 error

View File

@ -1,2 +1,2 @@
T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.util.List<? super java.lang.Integer>, java.util.List<? super java.lang.String>
T6650759m.java:43:36: compiler.err.prob.found.req: java.util.List<? super java.lang.Integer>, java.util.List<? super java.lang.String>
1 error

View File

@ -1,2 +1,2 @@
T7062745neg.java:16:36: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Object, java.lang.Number
T7062745neg.java:16:36: compiler.err.prob.found.req: java.lang.Object, java.lang.Number
1 error

View File

@ -1,2 +1,2 @@
T6886247_2.java:35:28: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.type.captureof: 1, ?, E
T6886247_2.java:35:28: compiler.err.prob.found.req: compiler.misc.type.captureof: 1, ?, E
1 error

View File

@ -1,3 +1,3 @@
Neg06.java:14:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.String, java.lang.Throwable
Neg06.java:14:25: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Integer, java.lang.Throwable
Neg06.java:14:16: compiler.err.prob.found.req: java.lang.String, java.lang.Throwable
Neg06.java:14:25: compiler.err.prob.found.req: java.lang.Integer, java.lang.Throwable
2 errors

View File

@ -1,2 +1,2 @@
Neg07.java:14:56: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Class<compiler.misc.type.captureof: 1, ? extends Neg07.ParentException>, java.lang.Class<? extends Neg07.HasFoo>
Neg07.java:14:56: compiler.err.prob.found.req: java.lang.Class<compiler.misc.type.captureof: 1, ? extends Neg07.ParentException>, java.lang.Class<? extends Neg07.HasFoo>
1 error

View File

@ -0,0 +1,12 @@
/*
* @test /nodynamiccopyright/
* @bug 7157165
*
* @summary Regression: code with disjunctive type crashes javac
* @compile/fail/ref=T7157165.out -XDrawDiagnostics T7157165.java
*
*/
class T7157165 {
Foo<? extends A|B> foo1 = null;
}

View File

@ -0,0 +1,4 @@
T7157165.java:11:20: compiler.err.expected: >
T7157165.java:11:21: compiler.err.expected: ';'
T7157165.java:11:22: compiler.err.illegal.start.of.type
3 errors

View File

@ -327,7 +327,7 @@ public class TestWarnErrorCount extends JavacTestingAbstractProcessor {
Writer out = fo.openWriter();
try {
out.write("class " + name + " {\n"
+ (warn ? " int i = (int) 0;\n" : "")
+ (warn ? " void m() throws Exception { try (AutoCloseable ac = null) { } }" : "")
+ (error ? " ERROR\n" : "")
+ "}\n");
} finally {

View File

@ -1,2 +1,2 @@
CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Object, int
CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req.1: (compiler.misc.inconvertible.types: java.lang.Object, int)
1 error

View File

@ -1,6 +1,6 @@
T6313164.java:12:8: compiler.err.cant.apply.symbol.1: kindname.method, foo1, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
T6313164.java:14:13: compiler.err.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
T6313164.java:15:13: compiler.err.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
T6313164.java:14:13: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164))
T6313164.java:15:13: compiler.err.prob.found.req.1: (compiler.misc.invalid.inferred.types: X, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164))
- compiler.note.unchecked.filename: B.java
- compiler.note.unchecked.recompile
3 errors

View File

@ -1,6 +1,6 @@
T7097436.java:13:20: compiler.warn.varargs.unsafe.use.varargs.param: ls
T7097436.java:14:25: compiler.warn.varargs.unsafe.use.varargs.param: ls
T7097436.java:15:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.util.List<java.lang.String>[], java.lang.String
T7097436.java:16:26: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.util.List<java.lang.String>[], java.lang.Integer[]
T7097436.java:15:20: compiler.err.prob.found.req: java.util.List<java.lang.String>[], java.lang.String
T7097436.java:16:26: compiler.err.prob.found.req: java.util.List<java.lang.String>[], java.lang.Integer[]
2 errors
2 warnings