Skip to content

Incorrect overriding can mask implementation obligations in subclasses #174

Description

@tdegueul

CLASS_NO_LONGER_CONCRETELY_EXTENSIBLE may miss a subtle case where a package-private abstract method is inherited through a public abstract class in another package:

package p;
public abstract class A {
    void m() {} // Becomes abstract in v2
}

package q;
public abstract class B extends p.A {
    public void m() {}
}

Both API versions compile because q.B is abstract. However, this compiles against v1 and fails against v2:

package client;
public class C extends q.B {}

because q.B.m() does not override p.A.m(): p.A.m() is package-private and q.B is in another package. In v2, p.A.m() remains an abstract obligation that external subclasses of q.B cannot implement.

Roseau currently treats same-erasure subtype methods as overriding without checking package-private visibility, but in this case q.B.m() does not override p.A.m().

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions