8310310: Migrate CreateSymbols tool in make/langtools to Classfile API

Reviewed-by: ihse, jlahoda
This commit is contained in:
Chen Liang 2025-04-09 14:51:15 +00:00
parent 7a7b9ed7fe
commit 4dc9e58906
5 changed files with 360 additions and 1014 deletions

View File

@ -53,7 +53,6 @@ COMPILECREATESYMBOLS_ADD_EXPORTS := \
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
--add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \
# #
# TODO: Unify with jdk.javadoc-gendata. Should only compile this once and share. # TODO: Unify with jdk.javadoc-gendata. Should only compile this once and share.

View File

@ -68,8 +68,7 @@ if [ "`git status --porcelain=v1 .`x" != "x" ] ; then
exit 1 exit 1
fi; fi;
$1/bin/java --add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \ $1/bin/java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
--add-modules jdk.jdeps \ --add-modules jdk.jdeps \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,6 @@
* jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.jvm:+open * jdk.compiler/com.sun.tools.javac.jvm:+open
* jdk.compiler/com.sun.tools.javac.util:+open * jdk.compiler/com.sun.tools.javac.util:+open
* jdk.jdeps/com.sun.tools.classfile:+open
* @build toolbox.ToolBox toolbox.JavacTask toolbox.Task * @build toolbox.ToolBox toolbox.JavacTask toolbox.Task
* @run main CanHandleClassFilesTest * @run main CanHandleClassFilesTest
*/ */
@ -76,8 +75,7 @@ public class CanHandleClassFilesTest {
try (ToolBox.MemoryFileManager mfm = new ToolBox.MemoryFileManager()) { try (ToolBox.MemoryFileManager mfm = new ToolBox.MemoryFileManager()) {
ToolBox tb = new ToolBox(); ToolBox tb = new ToolBox();
new JavacTask(tb) new JavacTask(tb)
.options("--add-exports", "jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED", .options("--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-modules", "jdk.jdeps") "--add-modules", "jdk.jdeps")
@ -102,8 +100,7 @@ public class CanHandleClassFilesTest {
Module targetModule = cl.getUnnamedModule(); Module targetModule = cl.getUnnamedModule();
Stream.of("jdk.compiler/com.sun.tools.javac.api", Stream.of("jdk.compiler/com.sun.tools.javac.api",
"jdk.compiler/com.sun.tools.javac.jvm", "jdk.compiler/com.sun.tools.javac.jvm",
"jdk.compiler/com.sun.tools.javac.util", "jdk.compiler/com.sun.tools.javac.util")
"jdk.jdeps/com.sun.tools.classfile")
.forEach(p -> open(p, targetModule)); .forEach(p -> open(p, targetModule));
var createSymbolsClass = Class.forName("build.tools.symbolgenerator.CreateSymbols", false, cl); var createSymbolsClass = Class.forName("build.tools.symbolgenerator.CreateSymbols", false, cl);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,6 @@
* jdk.compiler/com.sun.tools.javac.jvm * jdk.compiler/com.sun.tools.javac.jvm
* jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.util * jdk.compiler/com.sun.tools.javac.util
* jdk.jdeps/com.sun.tools.classfile
* @clean * * @clean *
* @run main/othervm CreateSymbolsTest * @run main/othervm CreateSymbolsTest
*/ */
@ -107,8 +106,7 @@ public class CreateSymbolsTest {
"--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", "--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"),
"--add-exports", "jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED"),
null, null,
fm.getJavaFileObjectsFromPaths(files) fm.getJavaFileObjectsFromPaths(files)
).call(); ).call();