Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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.

Đánh giá

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

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.

Mô tả

bug

@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

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<Integer> list = new ArrayList<>();
		list.get(0);
	}
}

This example passes verification as intended, however

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<Integer> 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<java.lang.Integer> list = new java.util.ArrayList<>() | Test2.java:20, 22 
----------------------------------------------------------------------------------------------------------------------------------
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

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.

Issue khác của liquid-java/liquidjava

Tất cả issue của liquid-java/liquidjava

Issue tương tự

Thêm issue về Java

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.