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.
Not sure exactly when in dev builds I started having this problem. Sometimes, in a valid Java class (or a class with quite unrelated local errors), a use of Outer.this syntax from code in an inner class is flagged as an error. This error sometimes disappears after other edits are made - even just adding and removing and space and saving the file - then comes back. See URL for sample code and workaround. core-main #46f59c7b2f72 is similar.
The log file has errors like this: SEVERE [org.netbeans.modules.java.source.save.ElementOverlay]: No element and no QualIdent WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Incorrect error badges detected, file=.../MavenNbModuleImpl.java. WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Going to recompute root=.../maven.apisupport/src, files in error=[]. INFO [org.netbeans.api.java.source.ElementHandle]: Cannot resolve: ElementHandle[kind=FIELD; sigs=org.netbeans.modules.maven.apisupport.MavenNbModuleImpl$DependencyAdder this Lorg/netbeans/modules/maven/apisupport/MavenNbModuleImpl$DependencyAdder; ] SEVERE [org.netbeans.modules.java.source.save.ElementOverlay]: No element and no QualIdent
*** Bug 200455 has been marked as a duplicate of this bug. ***
The test case in bug #200455 appears to be more reliably reproducible. The root cause seems to be that the anonymous innerclass's type "enclosing type" is the enclosing class when parsing from sources, whereas it is the enclosing method when read from the classfile. This ultimately leads to inability to find the appropriate outter class.
Product Version: NetBeans IDE 7.0.1 (Build 201107282000) Java: 1.6.0_23; Java HotSpot(TM) 64-Bit Server VM 19.0-b09 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) Userdir: C:\Users\Manowar\.netbeans\7.0 I have same problem with E2EDataObject after adding annotation ===== @Messages("Source=&Source") // NOI18N ===== following code becomes annotated with error message "no enclosing instance of type org.netbeans.modules.mobility.end2end.E2EDataObject is in scope": ===== if (E2EDataObject.this.getConfiguration().getServiceType().equals(elem.getServiceType())) { final ServiceGeneratorResult service = elem.generateStubs(Lookups.singleton(E2EDataObject.this)); } ===== But it is valid compilable code.
If it is reproducible, is a fix possible? This bug continues to be a problem for me.
I will try, but the fix may have unpredictable side effects. Actually, I was considering delaying the fix post-7.1.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/9db83f910b14 User: Jesse Glick <jglick@netbeans.org> Log: Warnings, and #200122 workaround.
Created attachment 112770 [details] The current fix attempt. This appears to fix the problem, and causes no immediately obvious problems. May still cause serious unpredictable regressions.
Attempt to fix: http://hg.netbeans.org/main/nb-javac/rev/25da9fc73da8 Integrated to NetBeans proper no later than in: http://hg.netbeans.org/main-silver/rev/d79a38e669d0
*** Bug 207005 has been marked as a duplicate of this bug. ***