liquid-java / liquid-java/liquidjava

State checking for extending abstract classes

未關閉
#131 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

enhancement
主要語言
Java
星號
67
分支
36
平均合併
10 天 18 小時
30 天內合併 PR
3

描述

Currently, reusing state refinements from an abstract superclass in a concrete class is not fully implemented, and gives an error like the one below.
Image

Example for abstract class java.net.URLConnection:

@ExternalRefinementsFor("java.net.URLConnection")
@StateSet({"setup", "connected"})
public interface URLConnectionRefinements {
 
    @StateRefinement(to="setup(this)")
    public void URLConnection(URL url);

    @StateRefinement(from="setup(this)")
    public void setDoInput(boolean doinput);

    @StateRefinement(from="setup(this)", to="connected(this)")
    public void connect();

    @StateRefinement(from="connected(this)")
    public Object getContent();
 
}

Extended in class URLExt:

class URLExt extends URLConnection{

    public URLExt(URL url){
        super(url);
    }

    @Override
    public void connect() throws IOException {
        // TODO Auto-generated method stub
        throw new UnsupportedOperationException("Unimplemented method 'connect'");
    }
    
}```

Tested in:
```java
class Testurl {
    void test() throws URISyntaxException, IOException {

        URLExt u = new URLExt(new URI("http://example.com").toURL());
        u.setDoInput(false); // should not be an error but it is 
        u.getContent(); // should be an error

    }
}

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

使用 URLConnectionRefinements 註解、URLExt 和 Testurl 範例重現該報告。首先追蹤在 URLExt 上呼叫方法時,如何檢查從 java.net.URLConnection 繼承的狀態細化。完成的標準是:setDoInput(false) 被接受,而 getContent() 被拒絕,因為物件尚未達到已連線狀態。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
compilers
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。