Skip to content

Commit

Permalink
8236997: tools/javac tests fail with --illegal-access=deny
Browse files Browse the repository at this point in the history
Correctly exporting packages to tests.

Reviewed-by: jlahoda
  • Loading branch information
asotona authored and lahodaj committed Jan 28, 2020
1 parent a89b838 commit f2013ac
Show file tree
Hide file tree
Showing 28 changed files with 31 additions and 97 deletions.
1 change: 1 addition & 0 deletions test/jdk/java/lang/reflect/Proxy/ProxyGeneratorCombo.java
Expand Up @@ -28,6 +28,7 @@
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.util
Expand Down
5 changes: 1 addition & 4 deletions test/langtools/tools/javac/DefiniteAssignment/T8204610.java
Expand Up @@ -27,10 +27,7 @@
* @summary Compiler confused by parenthesized "this" in final fields assignments
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
Expand Down
5 changes: 1 addition & 4 deletions test/langtools/tools/javac/T7093325.java
Expand Up @@ -29,10 +29,7 @@
* @library /tools/javac/lib
* @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main T7093325
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/T8222949/TestConstantDynamic.java
Expand Up @@ -29,8 +29,7 @@
* @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.jvm
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.util
Expand Down
Expand Up @@ -28,10 +28,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
Expand Down
Expand Up @@ -86,7 +86,7 @@ void run() throws Exception {

List<String> stdout = new toolbox.JavacTask(tb)
.classpath(pluginJar)
.options("-Xplugin:ExtraAttributes")
.options("-XDaccessInternalAPI")
.outdir(Files.createDirectories(Path.of("classes")))
.files(tb.findJavaFiles(src))
.run()
Expand Down
Expand Up @@ -28,10 +28,7 @@
* Smoke test for static interface method hiding
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main InterfaceMethodHidingTest
Expand Down
Expand Up @@ -28,10 +28,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main TestDefaultSuperCall
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/failover/CheckAttributedTree.java
Expand Up @@ -30,8 +30,7 @@
* @modules java.desktop
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
Expand Down
Expand Up @@ -28,10 +28,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @compile -Xlint:all DiamondAndInnerClassTest.java
Expand Down
Expand Up @@ -35,10 +35,7 @@
* @summary Missing check against target-type during applicability inference
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
*
Expand Down
Expand Up @@ -29,10 +29,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main GenericOverrideTest
Expand Down
Expand Up @@ -29,10 +29,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main FunctionalInterfaceConversionTest
Expand Down
5 changes: 1 addition & 4 deletions test/langtools/tools/javac/lambda/LambdaParserTest.java
Expand Up @@ -29,10 +29,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
Expand Down
Expand Up @@ -29,10 +29,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main MethodReferenceParserTest
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/lambda/TestInvokeDynamic.java
Expand Up @@ -31,8 +31,7 @@
* @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.jvm
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.util
Expand Down
Expand Up @@ -27,10 +27,7 @@
* @summary Add stat support to LambdaToMethod
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main TestLambdaToMethodStats
Expand Down
Expand Up @@ -28,10 +28,7 @@
* @library /tools/javac/lib
* @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main TestLambdaBytecode
Expand Down
Expand Up @@ -28,6 +28,7 @@
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
Expand Down
Expand Up @@ -29,10 +29,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
Expand Down
Expand Up @@ -30,10 +30,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @compile TypeInferenceComboTest.java
Expand Down
12 changes: 3 additions & 9 deletions test/langtools/tools/javac/lib/combo/ComboInstance.java
Expand Up @@ -23,10 +23,11 @@

package combo;

import java.lang.reflect.Method;
import javax.tools.StandardJavaFileManager;
import java.util.Optional;

import com.sun.tools.javac.file.BaseFileManager;

/**
* This class is the common superclass of all combo test instances. It defines few helper methods
* to build compilation tasks using the shared context object, as well as entry points for
Expand Down Expand Up @@ -58,14 +59,7 @@ final void run(ComboTestHelper<X>.Env env) {
env.info().lastError = Optional.of(ex);
} finally {
this.env = null;
try {
Class<?> fmClass = env.fileManager().getClass();
Method clear = fmClass.getMethod("clear");
clear.setAccessible(true);
clear.invoke(env.fileManager());
} catch (Exception ex) {
throw new IllegalStateException(ex);
}
((BaseFileManager) env.fileManager()).clear();
}
}

Expand Down
Expand Up @@ -28,10 +28,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main DisjunctiveTypeWellFormednessTest
Expand Down
3 changes: 2 additions & 1 deletion test/langtools/tools/javac/plugin/InternalAPI.java
Expand Up @@ -27,6 +27,7 @@
* @summary Extend support for -XDaccessInternalAPI to plugin modules
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.main
* jdk.jlink
* @build toolbox.ToolBox toolbox.JavacTask toolbox.JarTask
Expand Down Expand Up @@ -127,10 +128,10 @@ void run() throws Exception {
runTests(m -> new Object[] { Path.of(m.getName()) });
}

// -XDaccessInternalAPI has always been supported for classpath plugins
@Test
public void testClassPath(Path base) throws Exception {
List<String> stdout = new JavacTask(tb)
.options("-XDaccessInternalAPI")
.classpath(pluginJar)
.outdir(Files.createDirectories(base.resolve("out")))
.files(tb.findJavaFiles(Path.of("hw")))
Expand Down
5 changes: 1 addition & 4 deletions test/langtools/tools/javac/resolve/BitWiseOperators.java
Expand Up @@ -27,10 +27,7 @@
* @summary Verify that bitwise operators don't allow to mix numeric and boolean operands.
* @library ../lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main BitWiseOperators
Expand Down
5 changes: 1 addition & 4 deletions test/langtools/tools/javac/varargs/7042566/T7042566.java
Expand Up @@ -29,10 +29,7 @@
* @library /tools/javac/lib
* @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main T7042566
Expand Down
5 changes: 1 addition & 4 deletions test/langtools/tools/javac/varargs/warning/Warn4.java
Expand Up @@ -28,10 +28,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main Warn4
Expand Down
5 changes: 1 addition & 4 deletions test/langtools/tools/javac/varargs/warning/Warn5.java
Expand Up @@ -28,10 +28,7 @@
* temporarily workaround combo tests are causing time out in several platforms
* @library /tools/javac/lib
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.comp
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.tree
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build combo.ComboTestHelper
* @run main/othervm Warn5
Expand Down

0 comments on commit f2013ac

Please sign in to comment.