Verifier crashes on `!` (or another unary operator) applied to a call whose type cannot be resolved
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start with the stack trace: OperationsChecker.getUnaryOpRefinements (OperationsChecker.java:179) calls Context.addInstanceToContext (Context.java:164), which reaches Context.addInstanceVariable (Context.java:267) with a null type. Run the minimal Repro snippet from the issue, with org.example.missing absent from the classpath, to reproduce the NullPointerException. Done means the snippet verifies with the compilation warning instead of crashing, and the related reproducers for #388 and #390 are still considered.
由索引模型根據 Issue 內容生成。
描述
Impact: verification stops with an internal error: 3 of the 53 real-world files below.
Description
!x.m() where x's class is not on the classpath: OperationsChecker.getUnaryOpRefinements adds the operand to the context, and Context.addInstanceVariable calls getSuperclass() on its type, which is null.
Minimal reproducer (org.example.missing is not on the classpath)
import org.example.missing.Settings;
public class Repro {
static void start(Settings settings) {
if (!settings.enabled()) {
return;
}
}
}
Expected
Correct! Passed Verification. (with the "Java compilation encountered issues" warning).
Actual
Exception in thread "main" java.lang.RuntimeException:
Error while checking CtMethodImpl
on start(Settings settings) {
at Repro.java:4
with
Error while checking CtBlockImpl
on {
at Repro.java:4
with
Error while checking CtIfImpl
on if (!settings.enabled()) {
at Repro.java:5
with Cannot invoke "spoon.reflect.reference.CtTypeReference.getSuperclass()" because "type" is null
at liquidjava.processor.refinement_checker.TypeChecker.scan(TypeChecker.java:80)
at spoon.reflect.visitor.CtScanner.scan(CtScanner.java:189)
at spoon.reflect.visitor.CtScanner.scan(CtScanner.java:154)
at spoon.reflect.visitor.CtScanner.visitCtClass(CtScanner.java:363)
at liquidjava.processor.refinement_checker.RefinementTypeChecker.visitCtClass(RefinementTypeChecker.java:97)
at spoon.support.reflect.declaration.CtClassImpl.accept(CtClassImpl.java:63)
at liquidjava.processor.RefinementProcessor.lambda$processPackage$3(RefinementProcessor.java:51)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at liquidjava.processor.RefinementProcessor.processPackage(RefinementProcessor.java:50)
at liquidjava.processor.RefinementProcessor.process(RefinementProcessor.java:35)
at liquidjava.processor.RefinementProcessor.process(RefinementProcessor.java:15)
at spoon.support.visitor.ProcessingVisitor.scan(ProcessingVisitor.java:72)
at spoon.support.QueueProcessingManager.process(QueueProcessingManager.java:118)
at spoon.support.QueueProcessingManager.process(QueueProcessingManager.java:132)
at liquidjava.api.CommandLineLauncher.launch(CommandLineLauncher.java:92)
at liquidjava.api.CommandLineLauncher.main(CommandLineLauncher.java:41)
...
Caused by: java.lang.NullPointerException: Cannot invoke "spoon.reflect.reference.CtTypeReference.getSuperclass()" because "type" is null
at liquidjava.processor.context.Context.addInstanceVariable(Context.java:267)
at liquidjava.processor.context.Context.addInstanceToContext(Context.java:164)
at liquidjava.processor.refinement_checker.general_checkers.OperationsChecker.getUnaryOpRefinements(OperationsChecker.java:179)
Reproduced on main at dcfc4eb2 (liquidjava-verifier 0.0.35).
Real-world files that hit it
if (!appProperties.simulator().enabled()) {— skyleedevzero86/carebridge-platform (file)if (!Game.isInNoGUIMode()) {— gurkenlabs/litiengine (file)(!context.isExportedEquipment(identifiable) || extensions.isEmpty()) {— stvzhou/powsybl-core (file)
Context
Found while running LiquidJava on the original repository files of 53 real-world typestate and refinement bugs (the same files as our study exercises, before simplification). Each file is verified on its own, as a user would on one file of a project, so the project's other classes and its dependencies are not on the classpath. On main this crash and the two related ones (#388 binary operator, #389 unary operator, #390 field read) stop verification in 33 of the 53 files.
- 主要語言
- Java
- 星號
- 67
- 分支
- 36
- 平均合併
- 2 天 3 小時
- 30 天內合併 PR
- 29
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
liquid-java/liquidjava 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
liquid-java/liquidjava#388 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 65/100
liquid-java/liquidjava#373 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
liquid-java/liquidjava#321 ·
維護者通常 1 天內回覆
-
bug
難度 3/5 1-2 天 新手友好度 62/100
liquid-java/liquidjava#390 ·
維護者通常 1 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 25/100
liquid-java/liquidjava#381 ·
維護者通常 1 天內回覆
查看 liquid-java/liquidjava 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 82/100
mit-cml/appinventor-sources#4155 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 62/100
Hira-shi/PW1-DAI-Carrel-Egal-Eyer#28 ·
維護者通常 1 天內回覆
-
`GET /v1/event/token/{uuid}` can report a BOM upload as done before policy evaluation and metrics have finished可能已有人在做 @Zargath 今天認領。 未關閉defect in triage
難度 2/5 1-3 小時 新手友好度 72/100
DependencyTrack/dependency-track#7646 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
objectionary/eo-graphs#80 ·