mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 09:04:41 +02:00
8017618: NullPointerException in RichDiagnosticFormatter for bad input program
RDF crashes when diagnostic contains type 'void' Reviewed-by: jjg, vromero
This commit is contained in:
parent
684d5ec76d
commit
7e6f7dcca5
3 changed files with 17 additions and 2 deletions
|
@ -303,8 +303,9 @@ public class RichDiagnosticFormatter extends
|
||||||
conflicts.contains(s))) {
|
conflicts.contains(s))) {
|
||||||
List<Name> l = List.nil();
|
List<Name> l = List.nil();
|
||||||
Symbol s2 = s;
|
Symbol s2 = s;
|
||||||
while (s2.type.getEnclosingType().hasTag(CLASS)
|
while (s2.type.hasTag(CLASS) &&
|
||||||
&& s2.owner.kind == Kinds.TYP) {
|
s2.type.getEnclosingType().hasTag(CLASS) &&
|
||||||
|
s2.owner.kind == Kinds.TYP) {
|
||||||
l = l.prepend(s2.getSimpleName());
|
l = l.prepend(s2.getSimpleName());
|
||||||
s2 = s2.owner;
|
s2 = s2.owner;
|
||||||
}
|
}
|
||||||
|
|
11
langtools/test/tools/javac/lambda/BadNestedLambda.java
Normal file
11
langtools/test/tools/javac/lambda/BadNestedLambda.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 8017618
|
||||||
|
* @summary NullPointerException in RichDiagnosticFormatter for bad input program
|
||||||
|
* @compile/fail/ref=BadNestedLambda.out -XDrawDiagnostics BadNestedLambda.java
|
||||||
|
*/
|
||||||
|
class BadNestedLambda {
|
||||||
|
void test() {
|
||||||
|
Runnable add = (int x) -> (int y) -> x + y;
|
||||||
|
}
|
||||||
|
}
|
3
langtools/test/tools/javac/lambda/BadNestedLambda.out
Normal file
3
langtools/test/tools/javac/lambda/BadNestedLambda.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
BadNestedLambda.java:9:35: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.not.a.functional.intf: void))
|
||||||
|
BadNestedLambda.java:9:24: compiler.err.prob.found.req: (compiler.misc.incompatible.arg.types.in.lambda)
|
||||||
|
2 errors
|
Loading…
Add table
Add a link
Reference in a new issue