8274244: ReportOnImportedModuleAnnotation.java fails on rerun

Reviewed-by: jjg
This commit is contained in:
Joe Darcy 2021-10-05 17:31:57 +00:00
parent 37890650a7
commit c391e59ea6

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,10 @@
* 8235458
* @summary javac shouldn't fail when an annotation processor report a message about an annotation on a module
* javac should process annotated module when imports statement are present
* @library /tools/lib
* @modules jdk.compiler
* @build toolbox.ToolBox
* @run main ReportOnImportedModuleAnnotation
*/
import java.io.PrintWriter;
@ -41,6 +44,8 @@ import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
import toolbox.ToolBox;
public class ReportOnImportedModuleAnnotation {
public static void main(String[] args) throws Exception {
@ -49,6 +54,9 @@ public class ReportOnImportedModuleAnnotation {
final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
// Clean any existing files in output directory
(new ToolBox()).cleanDirectory(testOutputPath);
// Compile annotation and processor modules
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
fileManager.setLocationFromPaths(StandardLocation.MODULE_SOURCE_PATH, List.of(testBasePath.resolve("mods-src1/")));