Skip to content

Changes needed to work with Java 24 #2623

@merks

Description

@merks

The latest early access version of Java 24, i.e, 24+26 fails to start when -Djava.security.manager=allow is specified. I.e., eclipse quietly fails to start; via the console we see why/how it fails to start:

$eclipse/eclipse.exe -consoleLog 2>&1 | tee log
CompileCommand: exclude org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.getExtendedRange bool exclude = true
WARNING: Using incubator modules: jdk.incubator.vector
Error occurred during initialization of VM
java.lang.Error: A command line option has attempted to allow or enable the Security Manager. Enabling a Security Manager is not supported.
        at java.lang.System.initPhase3(java.base@24-beta/System.java:1948)

That option is specified in the eclipse.ini and is used in quite a few places (in the Platform SDK setup):

image

Even if we were to remove this option from the product, existing installations would retain the option in the eclipse.ini when updating.

Starting with -Djava.security.manager=disallow allows the IDE to start, though it's not so pretty!

$eclipse/eclipse.exe -consoleLog -vmargs -Djava.security.manager=disallow 2>&1 | tee log
CompileCommand: exclude org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.getExtendedRange bool exclude = true
WARNING: Using incubator modules: jdk.incubator.vector
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::staticFieldOffset has been called by org.eclipse.osgi.internal.url.MultiplexingFactory (file:/D:/Users/test38/.p2/pool/plugins/org.eclipse.osgi_3.22.100.v20241127-0924.jar)
WARNING: Please consider reporting this to the maintainers of class org.eclipse.osgi.internal.url.MultiplexingFactory
WARNING: sun.misc.Unsafe::staticFieldOffset will be removed in a future release
Dez. 03, 2024 9:31:20 AM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider org.slf4j.simple.SimpleServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle slf4j.simple
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::loadLibrary has been called by org.eclipse.swt.internal.Library in an unnamed module (file:/D:/Users/test38/sdk-4-35/eclipse/../../.p2/pool/plugins/org.eclipse.swt.win32.win32.x86_64_3.129.0.v20241128-1821.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

WARNING: Annotation classes from the 'javax.inject' or 'javax.annotation' package found.
It is recommended to migrate to the corresponding replacements in the jakarta namespace.
The Eclipse E4 Platform will remove support for those javax-annotations in a future release.
To suppress this warning, set the VM property: -Declipse.e4.inject.javax.warning=false
To disable processing of 'javax' annotations entirely, set the VM property: -Declipse.e4.inject.javax.disabled=true

!SESSION 2024-12-03 09:31:19.320 -----------------------------------------------
eclipse.buildId=4.35.0.I20241201-1800
java.version=24-beta
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.ui.workbench 4 0 2024-12-03 09:31:26.740
!MESSAGE Failed to obtain 'WinDefend' service state
!STACK 0
java.io.IOException: Process timed-out and it was attempted to forcefully termiante it
        at org.eclipse.ui.internal.WindowsDefenderConfigurator.runProcess(WindowsDefenderConfigurator.java:405)
        at org.eclipse.ui.internal.WindowsDefenderConfigurator.runPowershell(WindowsDefenderConfigurator.java:379)
        at org.eclipse.ui.internal.WindowsDefenderConfigurator.isWindowsDefenderServiceRunning(WindowsDefenderConfigurator.java:302)
        at org.eclipse.ui.internal.WindowsDefenderConfigurator.runExclusionCheck(WindowsDefenderConfigurator.java:159)
        at org.eclipse.ui.internal.WindowsDefenderConfigurator.lambda$0(WindowsDefenderConfigurator.java:106)
        at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:187)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

For further testing, I provisioned the Oomph Platform SDK setup using Java 24 and specifying -Djava.security.manager=disallow. That mostly works fine:

image

I think we shouldn't be logging error from Ant when failing to set the security manager is an expected thing.

image

I think in preparation for upcoming releases of Java we should use -Djava.security.manager=disallow and fix any problems related to that.

Note

  • sun.misc.Unsafe will become a bigger problem eventually
  • --enable-native-access=ALL-UNNAMED will eventually be needed
  • WindowsDefenderConfigurator doesn't work

Locate EA versions of Java 24:

https://api.adoptium.net/v3/assets/feature_releases/24/ea?image_type=jdk&jvm_impl=hotspot&project=jdk&vendor=eclipse

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions