8262095: NPE in Flow$FlowAnalyzer.visitApply: Cannot invoke getThrownTypes because tree.meth.type is null
Co-authored-by: Jan Lahoda <jlahoda@openjdk.org> Co-authored-by: Vicente Romero <vromero@openjdk.org> Reviewed-by: jlahoda
This commit is contained in:
parent
e551852801
commit
75d987a0dd
src/jdk.compiler/share/classes/com/sun/tools/javac/comp
test/langtools/tools/javac/lambda/8262095
@ -613,7 +613,10 @@ public class Attr extends JCTree.Visitor {
|
||||
}
|
||||
@Override
|
||||
public void report(DiagnosticPosition pos, JCDiagnostic details) {
|
||||
if (pt == Type.recoveryType) {
|
||||
boolean needsReport = pt == Type.recoveryType ||
|
||||
(details.getDiagnosticPosition() != null &&
|
||||
details.getDiagnosticPosition().getTree().hasTag(LAMBDA));
|
||||
if (needsReport) {
|
||||
chk.basicHandler.report(pos, details);
|
||||
}
|
||||
}
|
||||
|
20
test/langtools/tools/javac/lambda/8262095/T8262095.java
Normal file
20
test/langtools/tools/javac/lambda/8262095/T8262095.java
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8262095
|
||||
* @summary Report diagnostics produced by incorrect lambdas
|
||||
* @compile/fail/ref=T8262095.out -XDrawDiagnostics T8262095.java
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class T8262095 {
|
||||
|
||||
void f(Stream<Entry<Long, List<String>>> stream) {
|
||||
stream.sorted(Entry.comparingByKey()
|
||||
.thenComparing((Map.Entry<Long, List<String>> e) -> e.getValue().hashCode()))
|
||||
.count();
|
||||
}
|
||||
}
|
2
test/langtools/tools/javac/lambda/8262095/T8262095.out
Normal file
2
test/langtools/tools/javac/lambda/8262095/T8262095.out
Normal file
@ -0,0 +1,2 @@
|
||||
T8262095.java:17:42: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.inconvertible.types: java.util.function.Function<java.util.Map.Entry<java.lang.Long,java.util.List<java.lang.String>>,java.lang.Integer>, java.util.function.Function<? super java.util.Map.Entry<K,java.lang.Object>,? extends java.lang.Integer>))
|
||||
1 error
|
Loading…
x
Reference in New Issue
Block a user