7002837: Diamond: javac generates diamond inference errors when in 'finder' mode
Javac should disable error messages when analyzing instance creation expression in 'diamond finder' mode Reviewed-by: jjg
This commit is contained in:
parent
7613f7a72c
commit
8644a0bc46
@ -1587,13 +1587,26 @@ public class Attr extends JCTree.Visitor {
|
|||||||
} else if (allowDiamondFinder &&
|
} else if (allowDiamondFinder &&
|
||||||
clazztype.getTypeArguments().nonEmpty() &&
|
clazztype.getTypeArguments().nonEmpty() &&
|
||||||
findDiamonds) {
|
findDiamonds) {
|
||||||
Type inferred = attribDiamond(localEnv,
|
boolean prevDeferDiags = log.deferDiagnostics;
|
||||||
tree,
|
Queue<JCDiagnostic> prevDeferredDiags = log.deferredDiagnostics;
|
||||||
clazztype,
|
Type inferred = null;
|
||||||
mapping,
|
try {
|
||||||
argtypes,
|
//disable diamond-related diagnostics
|
||||||
typeargtypes);
|
log.deferDiagnostics = true;
|
||||||
if (!inferred.isErroneous() &&
|
log.deferredDiagnostics = ListBuffer.lb();
|
||||||
|
inferred = attribDiamond(localEnv,
|
||||||
|
tree,
|
||||||
|
clazztype,
|
||||||
|
mapping,
|
||||||
|
argtypes,
|
||||||
|
typeargtypes);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
log.deferDiagnostics = prevDeferDiags;
|
||||||
|
log.deferredDiagnostics = prevDeferredDiags;
|
||||||
|
}
|
||||||
|
if (inferred != null &&
|
||||||
|
!inferred.isErroneous() &&
|
||||||
inferred.tag == CLASS &&
|
inferred.tag == CLASS &&
|
||||||
types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings) &&
|
types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings) &&
|
||||||
chk.checkDiamond((ClassType)inferred).isEmpty()) {
|
chk.checkDiamond((ClassType)inferred).isEmpty()) {
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 7002837
|
||||||
|
*
|
||||||
|
* @summary Diamond: javac generates diamond inference errors when in 'finder' mode
|
||||||
|
* @author mcimadamore
|
||||||
|
* @compile -Werror -XDfindDiamond T7002837.java
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class T7002837<X extends java.io.Serializable & Comparable<?>> {
|
||||||
|
T7002837() {}
|
||||||
|
{ new T7002837<Integer>(); }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user