RFR: 8274244: ReportOnImportedModuleAnnotation.java fails on rerun [v2]

Jonathan Gibbons jjg at openjdk.java.net
Tue Oct 5 17:26:09 UTC 2021


On Mon, 4 Oct 2021 17:26:27 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> In terms of jtreg build tags, semantically this test wants to:
>> 
>> * build annotation processing sources
>> * compile module sources, running build annotation processor
>> 
>> In particular, the test wants to always compile the module sources, even if class files are newer than the module-info.java files. Since the test is not written in terms of those tags, I've added a pre-step which delete any existing class files from the output directory. If needed, some extra care could be taken to only delete files from the one module.
>> 
>> With this addition, the test will pass even when run with an already populated JTwork directory. At present, the test fails since the implicit compilation of module-info.java is *not* done when the class files in the output directory are newer than the sources.
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Respond to review feedbakc.

Marked as reviewed by jjg (Reviewer).

test/langtools/tools/javac/processing/ReportOnImportedModuleAnnotation/ReportOnImportedModuleAnnotation.java line 63:

> 61:         // Clean any existing class files in output directory
> 62:         var tb = new ToolBox();
> 63:         Files.walkFileTree(testOutputPath,

If it is OK to remove the entire directory contents, you could use `tb.cleanDirectory(testOutputPath);`

test/langtools/tools/javac/processing/ReportOnImportedModuleAnnotation/ReportOnImportedModuleAnnotation.java line 73:

> 71:                                            tb.deleteFiles(path);
> 72:                                        } catch (java.io.IOException ioe) {
> 73:                                            ; // ignore

in tests, it my be reasonable to let exceptions percolate all the way up, rather than ignore them.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5802


More information about the compiler-dev mailing list