Description
Comparing a value with a constant accessed through a type, directly in an if condition, crashes verification. Seen with a user enum (format == Format.JPG) and with JDK constants (mode != ImageWriteParam.MODE_COPY_FROM_METADATA). Assigning the comparison to a boolean local first works.
Minimal reproducer (no refinements needed)
public class Repro {
enum Format { JPG, PNG }
static String extension(Format format) {
if (format == Format.JPG) {
return "jpg";
}
return "png";
}
public static void main(String[] args) {
System.out.println(extension(Format.PNG));
}
}
Expected
Correct! Passed Verification.
Actual
Error while checking CtIfImpl
on if (format == Format.JPG) {
with Cannot invoke "liquidjava.rj_language.Predicate.substituteVariable(String, String)" because "elemRef" is null
Reproduced on main at 8816186 (liquidjava-verifier 0.0.35), and on 0.0.33.
Context
Found while turning real open-source Java code into study examples for the error-message study: real code hits this constantly, so the examples have to be rewritten around it or cannot be verified. Affects 2 of our examples.
Description
Comparing a value with a constant accessed through a type, directly in an
ifcondition, crashes verification. Seen with a user enum (format == Format.JPG) and with JDK constants (mode != ImageWriteParam.MODE_COPY_FROM_METADATA). Assigning the comparison to a boolean local first works.Minimal reproducer (no refinements needed)
Expected
Correct! Passed Verification.Actual
Reproduced on
mainat 8816186 (liquidjava-verifier 0.0.35), and on 0.0.33.Context
Found while turning real open-source Java code into study examples for the error-message study: real code hits this constantly, so the examples have to be rewritten around it or cannot be verified. Affects 2 of our examples.