Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package testSuite.classes.forward_field_read_correct;

import liquidjava.specification.Refinement;

public class ReadBefore {
private final Job job = new Job();

@Refinement("_ >= 0")
public int get() {
return job.port;
}

static class Job {
@Refinement("_ >= 0")
int port;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ public <T> void visitCtFieldRead(CtFieldRead<T> fieldRead) {
Predicate.createEquals(Predicate.createVar(Keys.WILDCARD), Predicate.createVar(enumLiteral)));
} else if (tryStaticFinalConstantRefinement(fieldRead)) {
// refinement metadata set by helper
} else if (fieldRead.getVariable().getDeclaration() != null) {
Predicate declared = getRefinementFromAnnotation(fieldRead.getVariable().getDeclaration())
.orElseGet(Predicate::new);
fieldRead.putMetadata(Keys.REFINEMENT, declared.substituteVariable(fieldName, Keys.WILDCARD));
} else {
fieldRead.putMetadata(Keys.REFINEMENT, new Predicate());
// TODO DO WE WANT THIS OR TO SHOW ERROR MESSAGE?
Expand Down
Loading