Skip to content

Reduce --add-opens list - #8739

Draft
mbien wants to merge 1 commit into
apache:masterfrom
mbien:reduce-add-opens
Draft

mbien wants to merge 1 commit into
apache:masterfrom
mbien:reduce-add-opens

Conversation

@mbien

@mbien mbien commented Aug 18, 2025 •

Copy link
Copy Markdown
Member
  • remove --add-opens flags if possible.
  • some usages (e.g. reflective constructor invocation in FormLAF) allow to change opens into exports when only public API is used
  • add comments to some of the encapsulation breaking usage

spec: https://openjdk.org/jeps/261

NB builds and runs without --add-exports of the jdk.comiler API but I kept those flags since this area has too many edge cases to think through.

more testing is needed, running NB 27 with the following flags right now:

Details
jms_options="-J--enable-native-access=ALL-UNNAMED \
-J--add-opens=java.base/java.net=ALL-UNNAMED \
-J--add-opens=java.base/java.lang=ALL-UNNAMED \
-J--add-opens=java.base/java.security=ALL-UNNAMED \
-J--add-opens=java.base/java.util=ALL-UNNAMED \
-J--add-opens=java.base/java.nio=ALL-UNNAMED \
-J--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED \
-J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED \
-J--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED \
-J--add-opens=java.desktop/javax.swing=ALL-UNNAMED \
-J--add-opens=java.desktop/java.awt=ALL-UNNAMED \
-J--add-opens=java.desktop/java.awt.event=ALL-UNNAMED \
-J--add-exports=java.desktop/sun.awt=ALL-UNNAMED \
-J--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED \
-J--add-exports=java.desktop/com.sun.beans.editors=ALL-UNNAMED \
-J--add-exports=java.desktop/sun.swing=ALL-UNNAMED \
-J--add-exports=java.desktop/sun.awt.im=ALL-UNNAMED \
-J--add-exports=java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED \
-J--add-exports=java.desktop/com.apple.eio=ALL-UNNAMED \
-J--add-exports=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED \
-J--add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED \
-J--add-exports=java.desktop/com.apple.laf=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-J--add-modules=jdk.jshell \
-J--add-opens=jdk.jshell/jdk.jshell=ALL-UNNAMED \
-J--add-exports=jdk.jshell/jdk.internal.jshell.debug=ALL-UNNAMED \
-J--add-exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \
-J--add-exports=jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED \
-J--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED \
-J--add-exports=jdk.internal.opt/jdk.internal.opt=ALL-UNNAMED \
-J--add-exports=java.management/sun.management=ALL-UNNAMED"

@mbien mbien added Code cleanup Label for cleanup done on the Netbeans IDE ci:all-tests [ci] enable all tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Aug 18, 2025
@mbien
mbien force-pushed the reduce-add-opens branch 2 times, most recently from 63b4316 to 58f203a Compare August 22, 2025 06:07
@mbien

mbien commented Aug 22, 2025 •

Copy link
Copy Markdown
Member Author

interesting. org.netbeans.modules.groovy.editor.api.completion.TransformationsCCTest has sometimes one item more on the completion list:

Expected content contains following lines which are missing in actual content:
FIELD      signers                         [PUBLIC]   Object[]

going to revert the golden data change of

groovy/groovy.editor/test/unit/data/testfiles/completion/transformations/singleton3/Singleton3.groovy.testSingleton3_withoutPrefix.21.completion
groovy/groovy.editor/test/unit/data/testfiles/completion/transformations/singleton3/Singleton3.groovy.testSingleton3_withoutPrefix.completion

 - remove --add-opens flags if possible.
 - some usages (e.g. reflective constructor invocation) allow to change
   opens into exports when only public API is used
 - add comments to some of the encapsulation breaking usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build ci:all-tests [ci] enable all tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Code cleanup Label for cleanup done on the Netbeans IDE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant