JDK-8027263 : Incorrect type path for inner types
  • Type: Sub-task
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2013-10-24
  • Updated: 2013-10-25
  • Resolved: 2013-10-25
Description
In the following code:

class Outer {
    public static class Inner {}
}
public class Test {
    public Object meth() { return new Outer.@X Inner(); }
}

The type path of the annotation @X is empty.  It should be [INNER_TYPE].

Note that in the slightly different code

class Outer {
    public class Inner {}
}
public class Test {
    public Object meth() { Outer o = new Outer(); return o.new @X Inner(); }
}

The type path is correct.
Comments
Closed in light of Werner's explanation
25-10-2013

I don't think this error report is valid. In the first case, "Outer" is just a scoping mechanism and we do not generate INNER_TYPE for scoping mechanism. This should be clarified with the JLS before being changed.
24-10-2013