Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 577041

Summary: Inner nested class does not compile
Product: [Eclipse Project] JDT Reporter: Paul Loveridge <luggypm>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: loskutov, mistria, srikanth.sankaran
Version: 4.21   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
Maven example porject none

Description Paul Loveridge CLA 2021-11-03 10:24:07 EDT
Created attachment 287436 [details]
Maven example porject

The following code compiles in NetBeans and Maven but fails in Eclipe:

package foo.bar;

public abstract class InnerAbstactor<T extends ChildAbstractor> {

    public void doSomethingOuter() {
        
    }
    
    public abstract static class ChildAbstractor extends InnerParent { 
        public void doSomethingInner() {
            
        }    
    }
}

You can make this class compile properly by either adding the import:

import foo.bar.InnerAbstractor.ChildAbstractor;

or changing the class declaration to :

public abstract class InnerAbstactor<T extends InnerAbstractor.ChildAbstractor>

However this class compiles file in maven (example project attached).
Comment 1 Andrey Loskutov CLA 2021-11-03 10:35:52 EDT
Yep, still in 4.22 master.
Comment 2 Mickael Istria CLA 2021-11-03 12:10:34 EDT
$ javac foo/bar/Inner*.java
foo/bar/InnerAbstactor.java:3: error: cannot find symbol
public abstract class InnerAbstactor<T extends ChildAbstractor> {
                                               ^
  symbol: class ChildAbstractor
1 error

So it seems like this error is legal according to the compile spec; and Maven and NetBeans are managing to "hide" this error by some other strategy.
Comment 3 Srikanth Sankaran CLA 2023-05-23 03:58:37 EDT
See also https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1069
Comment 4 Srikanth Sankaran CLA 2023-06-01 01:18:55 EDT
See https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1069 - this can be tracked along with that ticket.