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 249869

Summary: Lookup cannot find classes in methods.
Product: platform Reporter: SirIntellegence
Component: LookupAssignee: Jaroslav Havlin <jhavlin>
Status: NEW ---    
Severity: normal    
Priority: P4    
Version: 8.0.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Example Project

Description SirIntellegence 2015-01-17 00:06:50 UTC
Created attachment 151553 [details]
Example Project

Given the attached project, When the installer in Killer1 restores, it only finds one Provider for the interface Installer.Foo instead of the expected 2 with the annotation, one of them is in a method. I think that either:
a. It should work or
b. The annotation processor of ServiceProvider should raise a compile error if the class in question is in a method or otherwise inaccessible.
Just my 10ยข.
Comment 1 Jaroslav Havlin 2015-03-04 15:03:09 UTC
I'm sorry, annotation of the local (nested in method) class is not processed by annotation processors, i.e. it is not contained in the set returned from RoundEnvironment.getElementsAnnotatedWith(ServiceProvider.class), so it's not easy to detect that it is used incorrectly.

I'm not sure this can be fixed in the near future.
Thank you for reporting.