- 
    Bug 
- 
    Resolution: Fixed
- 
     P3 P3
- 
    25
- 
        b06
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8362055 | 25.0.1 | Vicente Arturo Romero Zaldivar | P3 | Resolved | Fixed | b02 | 
| JDK-8361641 | 25 | Vicente Arturo Romero Zaldivar | P3 | Resolved | Fixed | b31 | 
                    javac is failing to compile this code:
abstract class Base<T> {}
abstract class Derived1<T> extends Base<T> {}
abstract class Derived2<T> extends Base<T> {
Derived2(Derived1<T> obj) {}
}
class Test {
Base<String> obj = new Derived2<>(new Derived1<>() { /* not abstract */ }) { /* not abstract */ };
}
issuing error message:
Test.java:8: error: Derived1 is abstract; cannot be instantiated
Base<String> obj = new Derived2<>(new Derived1<>() { /* not abstract */ }) { /* not abstract */ };
basically during speculative attribution the class body of the anonymous classes above is removed to avoid side-effects during the process. It seems like we are checking this condition on a speculative version of the anonymous class
reported in compiler-dev: https://mail.openjdk.org/pipermail/compiler-dev/2025-June/030916.html
abstract class Base<T> {}
abstract class Derived1<T> extends Base<T> {}
abstract class Derived2<T> extends Base<T> {
Derived2(Derived1<T> obj) {}
}
class Test {
Base<String> obj = new Derived2<>(new Derived1<>() { /* not abstract */ }) { /* not abstract */ };
}
issuing error message:
Test.java:8: error: Derived1 is abstract; cannot be instantiated
Base<String> obj = new Derived2<>(new Derived1<>() { /* not abstract */ }) { /* not abstract */ };
basically during speculative attribution the class body of the anonymous classes above is removed to avoid side-effects during the process. It seems like we are checking this condition on a speculative version of the anonymous class
reported in compiler-dev: https://mail.openjdk.org/pipermail/compiler-dev/2025-June/030916.html
- backported by
- 
                    JDK-8361641 An anonymous class is erroneously being classify as an abstract class -           
- Resolved
 
-         
- 
                    JDK-8362055 An anonymous class is erroneously being classify as an abstract class -           
- Resolved
 
-         
- links to
- 
                     Commit(jdk25)
        openjdk/jdk/0e4422b2 Commit(jdk25)
        openjdk/jdk/0e4422b2
- 
                     Commit(master)
        openjdk/jdk/05c9eec8 Commit(master)
        openjdk/jdk/05c9eec8
- 
                     Review(jdk25)
        openjdk/jdk/26191 Review(jdk25)
        openjdk/jdk/26191
- 
                     Review(master)
        openjdk/jdk/26103 Review(master)
        openjdk/jdk/26103
             (1 links to)