Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

State checking for extending abstract classes

Open
#131 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
compilers

Research direction

Reproduce the report using the URLConnectionRefinements annotations, URLExt, and Testurl example. Start by tracing how inherited state refinements from java.net.URLConnection are checked when methods are invoked on URLExt. Done means setDoInput(false) is accepted while getContent() is rejected because the object has not reached connected state.

Written by the indexing model from the issue text.

Description

enhancement

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

    }
}
Dominant language
Java
Stars
67
Forks
36
Avg merge
10d 18h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from liquid-java/liquidjava

All issues in liquid-java/liquidjava

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.