liquid-java / liquid-java/liquidjava
Refinement Aliases don't work with Interfaces
Chưa có ai nhận issue này.
- 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
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- 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