Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Remove Keywords from Ghost & Alias Declarations
  • Loading branch information
rcosta358 committed Apr 7, 2026
commit 5cbf73d031d27414a6db1c28d50988d2fdba6cec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import liquidjava.specification.RefinementAlias;

@SuppressWarnings("unused")
@RefinementAlias("type PtGrade(int x) { x >= 0 && x <= 20}")
@RefinementAlias("PtGrade(int x) { x >= 0 && x <= 20}")
public class CorrectAlias {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import liquidjava.specification.RefinementAlias;

@SuppressWarnings("unused")
@RefinementAlias("type Positive(double x) { x > 0}")
@RefinementAlias("type PtGrade(double x) { x >= 0 && x <= 20}")
@RefinementAlias("Positive(double x) { x > 0}")
@RefinementAlias("PtGrade(double x) { x >= 0 && x <= 20}")
public class CorrectAliasMultiple {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class CorrectSearchValueIndexArray {

@RefinementPredicate("ghost int length(int[])")
@RefinementPredicate("int length(int[])")
@Refinement("(_ >= -1) && (_ < length(l))")
public static int getIndexWithValue(
@Refinement("length(l) > 0") int[] l, @Refinement("i >= 0 && i < length(l)") int i, int val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import liquidjava.specification.RefinementAlias;

@SuppressWarnings("unused")
@RefinementAlias("type PtGrade(double x) { x >= 0 && x <= 20}")
@RefinementAlias("PtGrade(double x) { x >= 0 && x <= 20}")
public class ErrorAliasSimple {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import liquidjava.specification.RefinementAlias;

@SuppressWarnings("unused")
@RefinementAlias("type Positive(int x) { x > 0}")
@RefinementAlias("type PtGrade(double x) { x >= 0 && x <= 20}")
@RefinementAlias("Positive(int x) { x > 0}")
@RefinementAlias("PtGrade(double x) { x >= 0 && x <= 20}")
public class ErrorAliasTypeMismatch {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import liquidjava.specification.RefinementPredicate;

public class ErrorGhostArgsTypes {
@RefinementPredicate("ghost boolean open(int)")
@RefinementPredicate("boolean open(int)")
@Refinement("open(4.5) == true")
public int one() {
return 1; // Argument Mismatch Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class ErrorGhostNumberArgs {

@RefinementPredicate("ghost boolean open(int)")
@RefinementPredicate("boolean open(int)")
@Refinement("open(1,2) == true")
public int one() {
return 1; // Argument Mismatch Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class ErrorImplementationSearchValueIntArray {

@RefinementPredicate("ghost int length(int[])")
@RefinementPredicate("int length(int[])")
@Refinement("(_ >= -1) && (_ < length(l))")
public static int getIndexWithValue(
@Refinement("length(l) > 0") int[] l, @Refinement("i >= 0 && i < length(l)") int i, int val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class ErrorSearchValueIntArray {

@RefinementPredicate("ghost int length(int[])")
@RefinementPredicate("int length(int[])")
@Refinement("(_ >= -1) && (_ < length(l))")
public static int getIndexWithValue(
@Refinement("length(l) > 0") int[] l, @Refinement("i >= 0 && i < length(l)") int i, int val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import liquidjava.specification.RefinementAlias;

@RefinementAlias("Positive(int x) { x > 0}")
@RefinementAlias("type CarAcceptableYears(int x) { x > 1800 && x < 2050}")
@RefinementAlias("CarAcceptableYears(int x) { x > 1800 && x < 2050}")
@RefinementAlias("GreaterThan(int x, int y) {x > y}")
public class Car {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@ExternalRefinementsFor("java.io.InputStreamReader")
public interface InputStreamReaderRefs {

@RefinementPredicate("boolean open(InputStreamReader i)")
@RefinementPredicate("boolean open(InputStreamReader)")
@StateRefinement(to = "open(this)")
public void InputStreamReader(InputStream in);

Expand Down
4 changes: 2 additions & 2 deletions liquidjava-verifier/src/main/antlr4/rj/grammar/RJ.g4
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ literal:
//----------------------- Declarations -----------------------

alias:
'type'? ID_UPPER '(' argDeclID ')' '{' pred '}';
ID_UPPER '(' argDeclID ')' '{' pred '}';

ghost:
'ghost'? type ID ('(' argDecl? ')')?;
type ID ('(' argDecl? ')')?;

argDecl:
type ID? (',' argDecl)?;
Expand Down