Skip to content

Commit

Permalink
8309630: Clean up tests that reference deploy modules
Browse files Browse the repository at this point in the history
Backport-of: e8a59843f21e347ba1494290c393ef7b344e3b70
  • Loading branch information
GoeLin committed Apr 3, 2024
1 parent ae3aa72 commit e877941
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, 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
Expand Down Expand Up @@ -50,9 +50,6 @@

public class CheckAccessClassInPackagePermissions {

private static final String[] deployModules = {
"jdk.javaws", "jdk.plugin", "jdk.plugin.server", "jdk.deploy" };

public static void main(String[] args) throws Exception {

// Get the modules in the boot layer loaded by the boot or platform
Expand Down Expand Up @@ -91,16 +88,9 @@ public static void main(String[] args) throws Exception {
// Check if each target module has the right permissions to access
// its qualified exports
Policy policy = Policy.getPolicy();
List<String> deployMods = Arrays.asList(deployModules);
for (Map.Entry<String, List<String>> me : map.entrySet()) {
String moduleName = me.getKey();

// skip deploy modules since they are granted permissions in
// deployment policy file
if (deployMods.contains(moduleName)) {
continue;
}

// is this a module loaded by the platform loader?
Optional<Module> module = bootLayer.findModule(moduleName);
if (!module.isPresent()) {
Expand Down
13 changes: 4 additions & 9 deletions test/jdk/tools/jimage/VerifyJimage.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2023, 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
Expand Down Expand Up @@ -195,18 +195,13 @@ private String toClassName(String entry) {
.replaceAll("\\.class$", "").replace('/', '.');
}

private static Set<String> EXCLUDED_MODULES =
Set.of("javafx.deploy", "jdk.deploy", "jdk.plugin", "jdk.javaws",
// All JVMCI packages other than jdk.vm.ci.services are dynamically
// exported to jdk.internal.vm.compiler
"jdk.internal.vm.compiler"
);
// All JVMCI packages other than jdk.vm.ci.services are dynamically
// exported to jdk.internal.vm.compiler
private static Set<String> EXCLUDED_MODULES = Set.of("jdk.internal.vm.compiler");

private boolean accept(String entry) {
int index = entry.indexOf('/', 1);
String mn = index > 1 ? entry.substring(1, index) : "";
// filter deployment modules

if (mn.isEmpty() || EXCLUDED_MODULES.contains(mn)) {
return false;
}
Expand Down

1 comment on commit e877941

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.