liquid-java / liquid-java/liquidjava

Refinement Aliases don't work with Interfaces

Đang mở
#50 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug
Ngôn ngữ chính
Java
Star
67
Fork
36
Merge trung bình
10 ngày 18 giờ
Pull request đã merge (30 ngày)
3

Mô tả

`@RefinementAlias` works as intended for classes and abstract classes but when attempting to use them for interfaces, LiquidJava is not able to correctly compare states

Example
-
```java
import liquidjava.specification.*;
import java.util.ArrayList;

@ExternalRefinementsFor("java.util.ArrayList")
@Ghost("int x")
@RefinementAlias("IsZero(ArrayList t) {size(t) == 0}")
public abstract class Test1 {

@StateRefinement(to = "IsZero(this)")
public abstract void ArrayList();

@StateRefinement(from = "(IsZero(this))")
public abstract int get(int index);

}

class T1 {

public static void main(String[] args) {
ArrayList list = new ArrayList<>();
list.get(0);
}
}
```
This example passes verification as intended, however
```java
import liquidjava.specification.*;
import java.util.ArrayList;

@ExternalRefinementsFor("java.util.ArrayList")
@Ghost("int x")
@RefinementAlias("IsZero(ArrayList t) {size(t) == 0}")
public interface Test2 {

@StateRefinement(to = "IsZero(this)")
public abstract void ArrayList();

@StateRefinement(from = "(IsZero(this))")
public abstract int get(int index);

}

class T1 {

public static void main(String[] args) {
ArrayList list = new ArrayList<>();
list.get(0);
}
}
```
This one fails, the only difference is the latter is declared as an interface and not an abstract class.

The error given is
-
```
______________________________________________________
Failed to check state transitions when calling list.get(0) in:

list.get(0)

Expected possible states:(IsZero(this))

State found:
----------------------------------------------------------------------------------------------------------------------------------
∀#list_6:ArrayList, (IsZero(#list_6)) && x(#list_6) == x(old(#list_6))
----------------------------------------------------------------------------------------------------------------------------------

Instance translation table:
----------------------------------------------------------------------------------------------------------------------------------
| Variable Name | Created in | File
----------------------------------------------------------------------------------------------------------------------------------
| #list_6 | java.util.ArrayList list = new java.util.ArrayList<>() | Test2.java:20, 22
----------------------------------------------------------------------------------------------------------------------------------
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy hai ví dụ Java từ issue và so sánh việc xử lý refinement aliases đối với các khai báo lớp trừu tượng và interface. Theo dõi các đường đi chuyển trạng thái và xử lý interface để xác định tại sao interface tạo ra sự không khớp trạng thái được hiển thị; hoàn thành có nghĩa là ví dụ interface được xác minh nhất quán với ví dụ lớp trừu tượng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
compilers
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.