<div dir="ltr"><div>Hi,</div><div><br></div><div>Following previous discussions please find enclosed a patch for the issue referenced in JDK-8235458.</div><div><br></div><div>When the compiler initiates the annotation processing environment it scans all compilation units to discover whether there are some with annotations to process and create the first round of annotation processing. This is done in the JavacProcessingEnvironment (line 1090 in the Round constructor), module info files are filtered within the getModuleInfoFiles() method (line 1515) but this method currently assumes a module info files always starts with a module declaration even though import statements can be present first according to the Java language specification as a result an annotated module with import statements is ignored during annotation processing.</div><div><br></div><div>In order to fix the issue, I've had to loop over the unit defs to ignore any import statements until I found either a module tag in which case I can include the module in the list of modules info files to process or any other tag in which case I ignore the unit which is not a module.</div><div><br></div><div><div>You'll find a jtreg test in the patch as well, I've actually created three modules for the test: <br></div><div>- annotation: which defines a simple module annotation</div><div>- processor: which provides the annotation processor reporting a message on the annotated module</div><div>- mod: which contains a module annotated with the previous annotation with import statements<br></div><div><br></div><div>The test is successful when the it runs without errors and the annotation is properly processed by the compiler.</div><div><br></div><div>I
 didn't find a way to use jtreg tags to compile modules, so I've decided
 to compile everything programmatically in the test main() method.<br></div><div><br></div><div>Please let me know if I can be of <span lang="en">any further assistance.</span></div></div></div>