Skip to content

Commit af93729

Browse files
committed
Fix NPE When Invoking Methods on Object Fields
1 parent d91f256 commit af93729

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/object_checkers

‎liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/object_checkers/AuxStateHandler.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,8 @@ public static String prepareInvocationTarget(TypeChecker tc, CtElement target2,
594594
// v--------- field read
595595
// means invocation is in a form of `t.method(args)`
596596
String name = v.getVariable().getSimpleName();
597+
if (v instanceof CtFieldRead<?>)
598+
name = String.format(Formats.THIS, name);
597599
Optional<VariableInstance> invocationCallee = tc.getContext().getLastVariableInstance(name);
598600
if (invocationCallee.isPresent()) {
599601
invocation.putMetadata(Keys.TARGET, invocationCallee.get());

0 commit comments

Comments
 (0)