mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
6857948: Calling a constructor with a doubly bogus argument causes an internal error
Problem when constructor resolution returns an erroneous symbol Reviewed-by: jjg
This commit is contained in:
parent
156e82c164
commit
fa2cb78a09
3 changed files with 30 additions and 7 deletions
|
@ -1594,7 +1594,9 @@ public class Attr extends JCTree.Visitor {
|
||||||
localEnv.info.varArgs = false;
|
localEnv.info.varArgs = false;
|
||||||
tree.constructor = rs.resolveConstructor(
|
tree.constructor = rs.resolveConstructor(
|
||||||
tree.pos(), localEnv, clazztype, argtypes, typeargtypes);
|
tree.pos(), localEnv, clazztype, argtypes, typeargtypes);
|
||||||
tree.constructorType = checkMethod(clazztype,
|
tree.constructorType = tree.constructor.type.isErroneous() ?
|
||||||
|
syms.errType :
|
||||||
|
checkMethod(clazztype,
|
||||||
tree.constructor,
|
tree.constructor,
|
||||||
localEnv,
|
localEnv,
|
||||||
tree.args,
|
tree.args,
|
||||||
|
|
18
langtools/test/tools/javac/6857948/T6857948.java
Normal file
18
langtools/test/tools/javac/6857948/T6857948.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 6857948
|
||||||
|
* @summary 6857948: Calling a constructor with a doubly bogus argument causes an internal error
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
*
|
||||||
|
* @compile/fail/ref=T6857948.out -XDrawDiagnostics T6857948.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
Foo(String v) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
public static void main() {
|
||||||
|
Foo f = new Foo("Hello!",nosuchfunction()) {};
|
||||||
|
}
|
||||||
|
}
|
3
langtools/test/tools/javac/6857948/T6857948.out
Normal file
3
langtools/test/tools/javac/6857948/T6857948.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , kindname.class, Test
|
||||||
|
T6857948.java:16:50: compiler.err.cant.apply.symbol: kindname.constructor, Foo, java.lang.String, compiler.misc.no.args, kindname.class, Foo, null
|
||||||
|
2 errors
|
Loading…
Add table
Add a link
Reference in a new issue