Skip to content

Commit eecf03b

Browse files
committed
Java: Add test showing missing dispatch for incomplete parameterised type.
1 parent ffc1c62 commit eecf03b

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| Test.java:16:5:16:15 | method(...) | Test.java:11:17:11:22 | method |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import java
2+
import semmle.code.java.dispatch.VirtualDispatch
3+
4+
from MethodCall mc, Method m
5+
where viableImpl(mc) = m
6+
select mc, m

java/ql/test/library-tests/errortype/Test.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ public NoSuchClass test() {
77
return nsc;
88
}
99

10+
static class GenericClass<T> {
11+
public void method() { }
12+
}
13+
14+
public testDispatch() {
15+
GenericClass<String> g1 = new GenericClass<>();
16+
g1.method();
17+
GenericClass<NoSuchClass> g2 = new GenericClass<>();
18+
g2.method();
19+
}
1020
}
1121

1222
// Diagnostic Matches: Unexpected symbol for constructor: new NoSuchClass()

0 commit comments

Comments
 (0)