GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — Fix crashes on unresolved types and on empty for bodies by CatarinaGamboa · Pull Request #432 · liquid-java/liquidjava Conversation
Collaborator
Four crashes found by verifying single files of real projects, where the project's other classes and its dependencies are not on the classpath. One commit per cause (#425 and #396 share one). 1. A variable whose type cannot be resolved (#425, #396)import org.example.missing.Cookie; void createAll(Cookie[] cookies) { for (int i = 0; i < cookies.length; i++) cookies[i].create(); // #425 } request.names().forEach(name -> System.out.println(name)); // #396, Request not on the classpath Spoon leaves the type of the array element, and of a lambda parameter whose target type is unknown, unset. 2. A write to a field declared outside the analyzed sources (#426)import org.example.missing.Options; opts.sampleSize = 1; // also opts.sampleSize += 1, and java.awt.Point p; p.x = 3 The field has no declaration, either because its class is not on the classpath or because it is a library field ( 3. A
|
| crash | error reported | passed | |
|---|---|---|---|
| main | 20 (15 of the 53 originals) | 43 | 11 |
| this PR | 1 | 60 | 13 |
GuessingGameServer: the file itself does not parse (if (socket.) followed by a commented-out body).initCause and BufferedReader typestate bugs at their recorded lines) or limitations that main already shows on other files, in code without unresolved types: Invalid refinement expression on char literals, ~ and .length (False error: a[i].length is rejected as an invalid refinement expression #348), Sorts Int and Bool are incompatible on new InetSocketAddress(...), Not Found Error: Constant 'X.Y' could not be found on a constant of an unresolved class (main gives the same), and an Error: null when the result of an unresolved call is passed to a refined parameter (reproduced on main without this PR).Gorgoneion, OpenMetadata PersonaContextBuilder) contain an initCause bug on an exception class that is not on the classpath. Its supertypes, including Throwable, are unknown, so the Throwable spec cannot apply.Known limits:
request.names(() -> positive(0)) passes on main too).obj.f++ on a field of another object crashes on main as well, with or without unresolved types (a.y++, p.x++, -a.y). It will be handled separately.s.getA().f = -1) is now not checked: its declaring type is unknown. Main crashed there.Closes #425, #426, #396, #395.
🤖 Generated with Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
When a class is not on the classpath, Spoon leaves the type of an array element of that class, and of a lambda parameter whose target type is that class, unset. Adding such a variable to the context crashed with a null dereference when looking up its supertypes, and would otherwise crash the SMT translation, which needs a sort for every variable. Such a variable is now typed as Object: it has no supertypes and carries no information. Violations around it are still reported. Fixes #425, fixes #396. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Writing a field whose declaration is not available, such as a field of a class that is not on the classpath (`opts.sampleSize = 1`) or of a library class (`point.x = 3`), crashed with a null dereference when reading the declaration's annotations. Compound assignments such as `opts.sampleSize += 1` took the same path. The write now stands in for the missing declaration, so it is checked like one to a field without a declared refinement, and the ghost field update only runs for fields declared in the analyzed sources, which are the only ones that have one. An instance whose type cannot be resolved is typed as Object, as variables already are, which also makes two supertype lookups repeated after adding an instance redundant. Fixes #426. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`for (...; ...; ...) ;` has no body, so `CtFor.getBody()` is null and looking for a `continue` in it crashed with a null dereference. A missing body is now treated as an empty one: the condition and the update are still checked. `while`, `do` and for-each loops with an empty statement body already verified; the regression covers them too. Fixes #395. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
[Codex review] I checked the unresolved-type fallback at both variable insertion points, the missing field-declaration path for assignments, and the null body handling in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[Claude] Thanks for checking. No changes needed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Verifier crashes on an array read whose element type cannot be resolved (classes not on the classpath)
There was an error while loading. Please reload this page.