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`:
```java
@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`:
```java
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 摘要。