| Summary: | Impossible to process package-level annotations with an AnnotationProcessor | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Yves Bontemps <yves_bontemps> | ||||||||
| Component: | APT | Assignee: | Satyam Kandula <satyam.kandula> | ||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | eclipse, markus.kell.r, Olivier_Thomann, satyam.kandula, srikanth_sankaran | ||||||||
| Version: | 3.7 | Flags: | eclipse:
review+
|
||||||||
| Target Milestone: | 3.8 M7 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows 7 | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Yves Bontemps
Created attachment 200242 [details]
Stack trace
Package-level annotations actually present quite a few problems; because of the way they were specified, there is no way to write an efficient processor that uses them in an incremental compilation situation. (Basically, the compiler can't tell if a package-level annotation exists without searching every element in every fragment of the package, across the entire classpath including jars. In general package-info.java won't have changed in a given compilation, so it won't be recompiled, so it's invisible without a search.) But that doesn't excuse the crash! Thanks for the clear report; I'll try to get this fixed in 3.7.1. Moving to 3.7.2 once available. Too late for 3.7.1 given that there is no patch attached to it. Assigning a target milestone to at least fix the crash for 3.8. Yves, could you please provide a test case that will help us to recreate the issue? Thanks. (In reply to comment #5) > Yves, could you please provide a test case that will help us to recreate the > issue? Any update on this request Yves ? Thanks. If you plan to include a fix for this in 3.8 M7, please adjust the target suitably, so it becomes easier to track. Created attachment 214597 [details]
Patch to fix the exception
Here is a simple patch to just fix the exception during the processing of the annotations.
apt.exe is returning null for the call to getDeclarationsAnnotatedWith() even when the processing file is just package-info.java. Hence, this patch does the same - better than throwing an exception.
Created attachment 214599 [details]
Patch to support annotations on package.
This is a better patch which tries to imitate 'apt' much more further. This still doesn't fix getDeclarationsAnnotatedWith() to return package-info, but handles getPackage() and getAnnotationMirrors() on the package better.
Walter, M7 is next week and we better fix this bug by this week. Sorry for pushing it so late :(. I have included here two patches. If you have sufficient time, can you look at both the patches and give your comments. We can try to give a better support in M7 if we can manage it. If you don't have time, please spare little time :) and do a quick check for the patch in comment 8 (Patch to fix the exception) and see if this is is good enough for 3.8. We could take care of a better fix in 3.9. Thanks in advance. Apologies for slow response - will look these over tomorrow (Friday). The patch to fix the exception looks good. I glanced over the patch to add real support and I don't see anything wrong with it, but I probably would need to spend more time than I did to add much value. (In reply to comment #12) > The patch to fix the exception looks good. > > I glanced over the patch to add real support and I don't see anything wrong > with it, but I probably would need to spend more time than I did to add much > value. Walter, Thanks for your comments. Filed bug 377990 to support the package-level annotation in detail. Released the 'patch to fix the exception' using commit b308074bc5b31f3a5857e47f87565296fbba4a15. Verified for 3.8 M7 using build id: I20120429-2000 |