This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206957

Summary: WorkingCopy.rewrite strips off qualifying prefix on annotation
Product: java Reporter: Jesse Glick <jglick>
Component: SourceAssignee: Jan Lahoda <jlahoda>
Status: VERIFIED FIXED    
Severity: normal CC: ttokoly
Priority: P3    
Version: 7.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 206954    

Description Jesse Glick 2012-01-05 19:14:44 UTC
As part of bug #206954 I am writing an editor hint which creates a @NavigatorPanel.Registration and adds it to a class implementing NavigatorPanel. I create a new ModifiersTree with the annotation, whose toString is e.g.

@org.netbeans.spi.navigator.NavigatorPanel.Registration(mimeType = "image/png")

and call WorkingCopy.rewrite. But the result is e.g.

...
import org.netbeans.spi.navigator.NavigatorPanel;
...
@Registration(mimeType = "image/png")
public class ImageNavigatorPanel implements NavigatorPanel {...}

which does not compile until you add the "NavigatorPanel." prefix or Fix Imports to import the nested type.

This happens whether or not I call GeneratorUtilities.importFQNs.

I suspect that the problem is that the annotation is a member of the annotated element's supertype. But of course the annotation would only become in scope as a result of this if it were inside the class body.
Comment 1 Quality Engineering 2012-01-07 16:20:47 UTC
Integrated into 'main-golden', will be available in build *201201070601* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a5bd98efcecc
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #206957: elements visible through extends/implements are visible only inside class body
Comment 2 Jan Lahoda 2012-02-17 15:34:23 UTC
And also:
http://hg.netbeans.org/main/rev/6f289938ea71
Comment 3 Jan Lahoda 2012-02-17 15:35:15 UTC
*** Bug 208333 has been marked as a duplicate of this bug. ***
Comment 4 ttokoly 2012-08-20 12:24:57 UTC
Product Version: NetBeans IDE Dev (Build 201208190001)
Java: 1.7.0_06; Java HotSpot(TM) Client VM 23.2-b09
System: Windows 7 version 6.1 running on x86; Cp1250; en_US (nb)

Verified.