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.
This commit is contained in:
Chris Smowton
2023-09-11 22:04:32 +01:00
parent 4b5651bde9
commit c47ba000d6
8 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1 @@
| Test.java:0:0:0:0 | 1 |

View File

@@ -0,0 +1,4 @@
import java
import semmle.code.java.Diagnostics
select any(Diagnostic d | not d.toString().matches("Not rewriting trap file for%"))

View File

@@ -0,0 +1,3 @@
import java
select any(Expr e | e.getType() instanceof ErrorType)

View File

@@ -0,0 +1,6 @@
Test.java:
# 0| [CompilationUnit] Test
# 1| 1: [Class] Test
#-----| -1: (Base Types)
# 1| 0: [TypeAccess] <any>
# 1| 0: [TypeAccess] String

View File

@@ -0,0 +1 @@
semmle/code/java/PrintAst.ql

View File

@@ -0,0 +1 @@
public class Test implements Unavailable<String> { }

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --no-strict-javac-errors --javac-args -source 17 -target 17