RFR: 8274244: ReportOnImportedModuleAnnotation.java fails on rerun
Joseph D. Darcy
joe.darcy at oracle.com
Mon Oct 4 17:21:19 UTC 2021
On 10/4/2021 9:34 AM, Jonathan Gibbons wrote:
> On Mon, 4 Oct 2021 00:35:19 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.
> test/langtools/tools/javac/processing/ReportOnImportedModuleAnnotation/ReportOnImportedModuleAnnotation.java line 64:
>
>> 62: File file = path.toFile();
>> 63: if (file.getName().endsWith(".class")) {
>> 64: file.delete();
> This is unlikely to work reliably on Windows, where the delete can be asynchronous. I recommend the use of the `ToolBox` test library class, and `ToolBox.delete`
>
Updated as suggested to use the toolbox; thanks,
-Joe
More information about the compiler-dev
mailing list