Skip to content

Commit

Permalink
Annotate MethodHandle local var as final.
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed Dec 28, 2023
1 parent 1d9d31f commit d7fec39
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ public static void patch(Set<String> modules, Path[] jarPaths, String[] addOpens
// Add-Exports and Add-Opens
try {
// Some hacks
MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(Module.class, MethodHandles.lookup());
MethodHandle handle = lookup.findVirtual(Module.class, "implAddOpensToAllUnnamed", MethodType.methodType(void.class, String.class));
final MethodHandle handle = MethodHandles.privateLookupIn(Module.class, MethodHandles.lookup())
.findVirtual(Module.class, "implAddOpensToAllUnnamed", MethodType.methodType(void.class, String.class));

for (String target : addOpens) {
String[] name = target.split("/", 2); // <module>/<package>
layer.findModule(name[0]).ifPresent(m -> {
Expand Down

0 comments on commit d7fec39

Please sign in to comment.