Skip to content

Commit c47ba00

Browse files
committed
Add test exercising the case of a missing type used as an interface
This induces the TypeEnter phase to create an ErrorType with a parameter, which in turn used to cause a stack overflow in comparing the TypeWrapper objects involved. Note the output remains somewhat broken, exposing an <any> type, but at least the overflow is resolved.
1 parent 4b5651b commit c47ba00

File tree

8 files changed

+17
-0
lines changed

8 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:0:0:0:0 | 1 |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import java
2+
import semmle.code.java.Diagnostics
3+
4+
select any(Diagnostic d | not d.toString().matches("Not rewriting trap file for%"))

java/ql/test/library-tests/errortype-with-params/ErrorTypes.expected

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import java
2+
3+
select any(Expr e | e.getType() instanceof ErrorType)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Test.java:
2+
# 0| [CompilationUnit] Test
3+
# 1| 1: [Class] Test
4+
#-----| -1: (Base Types)
5+
# 1| 0: [TypeAccess] <any>
6+
# 1| 0: [TypeAccess] String
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle/code/java/PrintAst.ql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public class Test implements Unavailable<String> { }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//semmle-extractor-options: --no-strict-javac-errors --javac-args -source 17 -target 17

0 commit comments

Comments
 (0)