Verifier crashes on a lambda whose parameter type cannot be resolved (classes not on the classpath)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- Ein halber Tag
- Anfängerfreundlichkeit
- 50/100
Rechercherichtung
The crash is in Context.addVarToContext (Context.java:193), reached from RefinementTypeChecker.visitCtLambda (RefinementTypeChecker.java:423) when a lambda parameter's type is null. Start by reading those two methods and deciding how an unresolved parameter type should be represented. Done when the minimal reproducer with the unresolvable org.example.missing.Request no longer throws and reports the expected verification result.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Impact: verification stops with an internal error on a lambda whose parameter type comes from a class that is not on the classpath: 2 of the 53 real-world files below.
Description
When a lambda is passed to a method of an unresolved type, Spoon cannot infer the lambda parameter's type, and RefinementTypeChecker.visitCtLambda adds the parameter with a null type: Context.addVarToContext then calls getSuperclass() on it (Context.java:193). Same null type in Context as #389 (there through addInstanceVariable, from a unary operator), reached from a different construct. A parameter with an unknown type could be added without supertypes.
Minimal reproducer (org.example.missing is not on the classpath)
import org.example.missing.Request;
public class Repro {
static void print(Request request) {
request.names().forEach(name -> System.out.println(name));
}
}
Expected
Correct! Passed Verification. (with the usual "Java compilation encountered issues" warning).
Actual
Exception in thread "main" java.lang.RuntimeException:
Error while checking CtMethodImpl
on print(Request request) {
at Repro.java:4
with
Error while checking CtBlockImpl
on {
at Repro.java:4
with
Error while checking CtInvocationImpl
on request.names().forEach(name -> System.out.println(name));
at Repro.java:5
with
Error while checking CtLambdaImpl
on (name -> System.out.println(name));
at Repro.java:5
with Cannot invoke "spoon.reflect.reference.CtTypeReference.getSuperclass()" because "type" is null
...
Caused by: java.lang.NullPointerException: Cannot invoke "spoon.reflect.reference.CtTypeReference.getSuperclass()" because "type" is null
at liquidjava.processor.context.Context.addVarToContext(Context.java:193)
at liquidjava.processor.refinement_checker.RefinementTypeChecker.visitCtLambda(RefinementTypeChecker.java:423)
Reproduced on main at ad055b49 (liquidjava-verifier 0.0.35).
Real-world files that hit it
.forEach(header -> builder.withHeader(header, list(originalRequest.getHeaders(header))));— atlassian/openapi-request-validator (file)(e -> new StreamSource(e.getXsdAsStream()))— stvzhou/powsybl-core (file)
Context
Found while running LiquidJava on the original repository files of 53 real-world typestate and refinement bugs (the files our study exercises were simplified from). Each file is verified on its own, as a user would verify one file of a project, so the project's other classes and its dependencies are not on the classpath. Related: #388, #389, #390.
- Vorherrschende Sprache
- Java
- Sterne
- 73
- Forks
- 38
- Ø Merge
- 12 Std. 32 Min.
- Gemergte PRs (30 T.)
- 45
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus liquid-java/liquidjava
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
liquid-java/liquidjava#562 ·
Maintainer antworten meist innerhalb von 1 Tag
-
A float ghost crashes the verifier: "Ghost not implemented for type float"Evtl. vergeben @MohammedZaid1740 hat das vor 7 Tagen übernommen. Offenbug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
liquid-java/liquidjava#443 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug real-world-finding
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
liquid-java/liquidjava#395 ·
Maintainer antworten meist innerhalb von 1 Tag
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatibleEvtl. vergeben @CatarinaGamboa hat das vor 4 Tagen übernommen. Offenbug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 15/100
liquid-java/liquidjava#558 ·
Maintainer antworten meist innerhalb von 1 Tag
-
new T[a][b] gets length b instead of a (unsound)Evtl. vergeben @CatarinaGamboa hat das vor 4 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 30/100
liquid-java/liquidjava#557 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in liquid-java/liquidjava
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 60/100
quelea-projection/Quelea#749 ·
Maintainer antworten meist innerhalb von 1 Tag
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 92/100
erkamyaman/rust-anything#963 ·
Maintainer antworten meist innerhalb von 1 Tag
-
api-diagnostics bug jdbc
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
ClickHouse/clickhouse-java#3464 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 76/100
-
Deferred
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Sanne/incus-spawn#2768 ·
Maintainer antworten meist innerhalb von 1 Tag