Do package-infos need to be reset between annotation processing rounds?
jonathan.gibbons at oracle.com
Wed Dec 6 00:46:35 UTC 2017
What about the case where an annotation processor generates the
package-info.java file? Is that a case where it is important to reinit
the packge symbol correctly, so that the newly generated code is read?
On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote:
> I have a question about the logic in JavacProcessingEnvironment's
> treeCleaner that resets package-info state between annotation
> processing rounds .
> JDK-8193037 describes an issue where package-infos loaded from the
> classpath are reset by treeCleaner. Those symbols doesn't get
> reinitialized correctly, and package annotations are not visible
> during subsequent annotation processing rounds.
> I wondered if the logic was only meant to apply to package-infos being
> compiled from source in the current compilation (similar to how
> module-infos are handle by treeCleaner), but I'm having trouble
> understanding when that logic is necessary. Commenting out
> `node.packge.package_info.reset();` and `node.packge.reset();` in
> treeCleaner doesn't break any jtreg tests. Does anyone have examples
> where that code is needed? I'd like to add a regression test to ensure
> the fix for JDK-8193037 doesn't interfere with the original purpose of
> that code.
More information about the compiler-dev