8008276: assertion error in com.sun.tools.javac.comp.TransTypes.visitApply
DiagnosticFilter used during speculative attribution is too broad Reviewed-by: jjg
This commit is contained in:
parent
eb68b33185
commit
937b7d2fba
@ -276,14 +276,27 @@ public class DeferredAttr extends JCTree.Visitor {
|
|||||||
* disabled during speculative type-checking.
|
* disabled during speculative type-checking.
|
||||||
*/
|
*/
|
||||||
JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
|
JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
|
||||||
JCTree newTree = new TreeCopier<Object>(make).copy(tree);
|
final JCTree newTree = new TreeCopier<Object>(make).copy(tree);
|
||||||
Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared()));
|
Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared()));
|
||||||
speculativeEnv.info.scope.owner = env.info.scope.owner;
|
speculativeEnv.info.scope.owner = env.info.scope.owner;
|
||||||
final JavaFileObject currentSource = log.currentSourceFile();
|
|
||||||
Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
|
Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
|
||||||
new Log.DeferredDiagnosticHandler(log, new Filter<JCDiagnostic>() {
|
new Log.DeferredDiagnosticHandler(log, new Filter<JCDiagnostic>() {
|
||||||
public boolean accepts(JCDiagnostic t) {
|
public boolean accepts(final JCDiagnostic d) {
|
||||||
return t.getDiagnosticSource().getFile().equals(currentSource);
|
class PosScanner extends TreeScanner {
|
||||||
|
boolean found = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scan(JCTree tree) {
|
||||||
|
if (tree != null &&
|
||||||
|
tree.pos() == d.getDiagnosticPosition()) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
super.scan(tree);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PosScanner posScanner = new PosScanner();
|
||||||
|
posScanner.scan(newTree);
|
||||||
|
return posScanner.found;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
@ -484,6 +484,10 @@ public class JCDiagnostic implements Diagnostic<JavaFileObject> {
|
|||||||
return getIntEndPosition();
|
return getIntEndPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DiagnosticPosition getDiagnosticPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the line number within the source referred to by this diagnostic.
|
* Get the line number within the source referred to by this diagnostic.
|
||||||
* @return the line number within the source referred to by this diagnostic
|
* @return the line number within the source referred to by this diagnostic
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 8008276
|
||||||
|
* @summary assertion error in com.sun.tools.javac.comp.TransTypes.visitApply
|
||||||
|
* @compile/fail/ref=MissingError.out -XDrawDiagnostics MissingError.java
|
||||||
|
*/
|
||||||
|
class MissingError {
|
||||||
|
void test() {
|
||||||
|
mtest(new Bad(){ Integer i = ""; });
|
||||||
|
}
|
||||||
|
|
||||||
|
void mtest(Bad t){ }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bad {
|
||||||
|
String s = 1;
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
MissingError.java:16:16: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
|
||||||
|
MissingError.java:9:37: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer)
|
||||||
|
2 errors
|
Loading…
Reference in New Issue
Block a user