Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 572093

Summary: Cleanup configuration page cannot be open
Product: [Eclipse Project] JDT Reporter: Lars Vogel <Lars.Vogel>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, fabrice.tiercelin, kalyan_prasad, Lars.Vogel, loskutov, mjmeijer, noopur_gupta
Version: 4.20   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Lars Vogel CLA 2021-03-19 05:04:18 EDT
Eclipse SDK
Version: 2021-06 (4.20)
Build id: I20210319-0030
OS: Linux, v.5.4.0-67-generic, x86_64 / gtk 3.24.20
Java version: 16

I cannot open the configuration for clean-ups. To check, select multiple project-> Source -> Clean-up -> Configure -> Nothing happens if I click the configure button.
Comment 1 Lars Vogel CLA 2021-03-19 05:07:29 EDT
Same for the preference page for editing a cleanup profile.

I see the following exception in the error log. Maybe related to the merge of the Java 16?

java.lang.IllegalAccessError
	at java.base/java.lang.invoke.MethodHandleResolver.resolveInvokeDynamic(MethodHandleResolver.java:208)
	at org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpTabPage.internalRegisterSlavePreference(CleanUpTabPage.java:180)
	at org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpTabPage.registerSlavePreference(CleanUpTabPage.java:118)
	at org.eclipse.jdt.internal.ui.preferences.cleanup.CodeFormatingTabPage.doCreatePreferences(CodeFormatingTabPage.java:91)
	at org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage.createContents(ModifyDialogTabPage.java:847)
	at org.eclipse.jdt.internal.ui.fix.CleanUpSelectionDialog.addTabPage(CleanUpSelectionDialog.java:230)
	at org.eclipse.jdt.internal.ui.fix.CleanUpSelectionDialog.createDialogArea(CleanUpSelectionDialog.java:155)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:767)
	at org.eclipse.jface.window.Window.create(Window.java:431)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1094)
	at org.eclipse.jface.dialogs.StatusDialog.create(StatusDialog.java:130)
	at org.eclipse.jdt.internal.ui.fix.CleanUpSelectionDialog.create(CleanUpSelectionDialog.java:125)
	at org.eclipse.jface.window.Window.open(Window.java:788)
	at org.eclipse.jdt.internal.ui.fix.CleanUpRefactoringWizard$CleanUpConfigurationPage$2.widgetSelected(CleanUpRefactoringWizard.java:365)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5839)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1429)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5100)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4578)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
	at org.eclipse.jface.window.Window.open(Window.java:799)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.lambda$0(RefactoringWizardOpenOperation.java:190)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$$Lambda$1053/0x000000003d439658.run(Unknown Source)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:209)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:126)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:41)
	at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startCleanupRefactoring(RefactoringExecutionStarter.java:254)
	at org.eclipse.jdt.internal.ui.actions.AllCleanUpsAction.performRefactoring(AllCleanUpsAction.java:71)
	at org.eclipse.jdt.internal.ui.actions.CleanUpAction.runOnMultiple(CleanUpAction.java:209)
	at org.eclipse.jdt.internal.ui.actions.CleanUpAction.run(CleanUpAction.java:116)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:252)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414)
	at org.eclipse.jface.action.ActionContributionItem$$Lambda$413/0x0000000000000000.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5839)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1429)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5100)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4578)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.ui.internal.Workbench$$Lambda$222/0x0000000000000000.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1434)
Caused by: java.lang.IllegalAccessException: Class 'org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpTabPage' no access to: class '[Lorg.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialogTabPage$ButtonPreference;'
	at java.base/java.lang.invoke.MethodHandles$Lookup.checkClassAccess(MethodHandles.java:588)
	at java.base/java.lang.invoke.MethodHandles$Lookup.accessCheckArgRetTypes(MethodHandles.java:944)
	at java.base/java.lang.invoke.MethodHandleResolver.resolveInvokeDynamic(MethodHandleResolver.java:206)
	... 65 more
Comment 2 Kalyan Prasad Tatavarthi CLA 2021-03-19 07:14:42 EDT
I have tried on Windows with 

Eclipse SDK
Version: 2021-06 (4.20)
Build id: I20210319-0030
OS: Windows 10
Java version: 16

but could not reproduce this issue.
Please provide further information on steps to reproduce this issue.
Comment 3 Andrey Loskutov CLA 2021-03-19 07:24:08 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #2)
> I have tried on Windows with 
> 
> Eclipse SDK
> Version: 2021-06 (4.20)
> Build id: I20210319-0030
> OS: Windows 10
> Java version: 16
> 
> but could not reproduce this issue.
> Please provide further information on steps to reproduce this issue.

Same on I20210319-0030 / Linux / Java 11 & Java 17 ea, no issues.
Comment 4 Lars Vogel CLA 2021-03-19 07:38:58 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #2)
> I have tried on Windows with 
> 
> Eclipse SDK
> Version: 2021-06 (4.20)
> Build id: I20210319-0030
> OS: Windows 10
> Java version: 16
> 
> but could not reproduce this issue.
> Please provide further information on steps to reproduce this issue.

Can you try with openj9?
Comment 5 Kalyan Prasad Tatavarthi CLA 2021-03-19 08:20:58 EDT
(In reply to Lars Vogel from comment #4)
> (In reply to Kalyan Prasad Tatavarthi from comment #2)
> > I have tried on Windows with 
> > 
> > Eclipse SDK
> > Version: 2021-06 (4.20)
> > Build id: I20210319-0030
> > OS: Windows 10
> > Java version: 16
> > 
> > but could not reproduce this issue.
> > Please provide further information on steps to reproduce this issue.
> 
> Can you try with openj9?

I get the below error using OpenJ9

java.lang.IllegalAccessError
	at java.base/java.lang.invoke.MethodHandleResolver.resolveInvokeDynamic(MethodHandleResolver.java:208)
	at org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpTabPage.internalRegisterSlavePreference(CleanUpTabPage.java:180)
	at org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpTabPage.registerSlavePreference(CleanUpTabPage.java:118)
	at org.eclipse.jdt.internal.ui.preferences.cleanup.CodeFormatingTabPage.doCreatePreferences(CodeFormatingTabPage.java:91)

I get the above error for the below steps

select multiple project-> Source -> Clean-up -> Configure -> Edit

But this issue is reproducible using openJ9 java 16
Comment 6 Fabrice Tiercelin CLA 2021-03-19 13:32:47 EDT
Can you try different builds to find the latest working build?
Comment 7 Lars Vogel CLA 2021-03-19 13:58:22 EDT
(In reply to Fabrice Tiercelin from comment #6)
> Can you try different builds to find the latest working build?

Seems to be openj9 version related. If I switch to openJ9 Java 15 this works fine.
Comment 8 Holger Voormann CLA 2021-04-17 05:42:03 EDT
I can confirm that this happens on Windows 10 with the AdoptOpenJDK OpenJ9 Java 16 VM. I have not seen this before with an OpenJ9 Java 15 VM and cannot reproduce it with the current AdoptOpenJDK HotSpot Java 16 VM.

Reported to OpenJ9:
https://github.com/eclipse/openj9/issues/12460

Even if it is not caused by Eclipse, maybe it can be fixed by not using java.util.Observable, which is deprecated since Java 9. E.g. here:
https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/tree/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpTabPage.java?id=9c3704c1e206878551337f43f2c2d6bc73503dda#n180
Comment 9 Holger Voormann CLA 2021-04-23 11:21:36 EDT
In jdk-16.0.1+9_openj9-0.26.0 (<https://github.com/eclipse/openj9/releases/tag/openj9-0.26.0>) the issue is fixed for me (verified with OpenJDK16U-jdk_x64_windows_openj9_16.0.1_9_openj9-0.26.0.zip).

See https://github.com/eclipse/openj9/issues/12460
Comment 10 Noopur Gupta CLA 2021-05-31 03:32:24 EDT
*** Bug 573837 has been marked as a duplicate of this bug. ***
Comment 11 maarten meijer CLA 2021-05-31 03:45:03 EDT
I can confirm that this bug is fixed on MAcOSX when using
java.fullversion=16.0.1+9
JRE 16 Mac OS X amd64-64-Bit Compressed References 20210421_24 (JIT enabled, AOT enabled)
OpenJ9   - b4cc246d9
OMR      - 162e6f729
JCL      - cea22090ecf based on jdk-16.0.1+9
java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-16-openj9.jdk/Contents/Home