Soundness: a to that sets another object's state drops the receiver's frame (x.observe(y) forgets x's state)

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

Maintainer thường phản hồi trong vòng 1 ngày

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
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
compilers, testing-qa

Hướng nghiên cứu

Start by locating getMissingStates and trace how it checks whether a state set is mentioned in a method’s to refinement. Use the FrameOther example to verify that observe preserves the receiver’s state while constraining other. Done means the example no longer verifies an invalid call to close() after observe, while valid post-state constraints on this still work.

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

Mô tả

bug

Problem (soundness). getMissingStates keeps a state set of this unchanged only if to does not mention that set. A state counts as a mention whatever object it is applied to, so a method that changes another object's state forgets the receiver's state.

import liquidjava.specification.*;

@StateSet({"closed", "opened"})
public class FrameOther {
    @StateRefinement(to = "closed(this)")
    public FrameOther() {}

    @StateRefinement(from = "opened(this)", to = "closed(this)")
    public void close() {}

    @StateRefinement(to = "opened(other)")
    public void observe(FrameOther other) {}

    public static void main(String[] args) {
        FrameOther x = new FrameOther();
        FrameOther y = new FrameOther();
        x.observe(y);
        x.close(); // fine only if x is still closed is NOT required; close needs opened(x)
    }
}

This passes verification, but x is still closed when x.close() (from opened) is called. observe's to is opened(other). Because opened appears in it, state1(this) == state1(old(this)) is not added, so x's set is unconstrained after the call.

Fix. A set counts as mentioned only when to constrains it on the post-state receiver, this. That is a state or the set function applied to this, and not to old(this) or another object.

Found while designing #502.

Ngôn ngữ chính
Java
Star
73
Fork
38
Merge trung bình
12 giờ 32 phút
Pull request đã merge (30 ngày)
45

Chuẩn bị môi trường

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.