cnfree / Eclipse-Class-Decompiler

Eclipse Class Decompiler integrates JD, Jad, FernFlower, CFR, Procyon seamlessly with Eclipse and allows Java developers to debug class files without source code directly
http://www.cpupk.com/decompiler
304 stars 91 forks source link

Eclipse Oxygen fails to start after installing ECD #23

Open EVi1b7wO opened 7 years ago

EVi1b7wO commented 7 years ago

Hi,

after installing v2.9.7 in Eclipse Oxygen, Eclipse will refuse to startup for a second time with an NPE at org.sf.feeling.decompiler.SetupRunnable.setupPartListener(SetupRunnable.java:61). Tested earlier versions including v2.9.2 which all suffer by the same Issue.

To restore Eclipse the complete .metadata directory needs to be deleted. I'm running a minimal JDT installation with SVN integration based on the Eclipse Platform Runtime Binary.

!MESSAGE Application error
!STACK 1 org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at org.eclipse.swt.SWT.error(SWT.java:4533) at org.eclipse.swt.SWT.error(SWT.java:4448) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4497) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4110) at org.eclipse.swt.widgets.Display.release(Display.java:4162) at org.eclipse.swt.graphics.Device.dispose(Device.java:235) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:167) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 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:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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:1499) at org.eclipse.equinox.launcher.Main.main(Main.java:1472) Caused by: java.lang.NullPointerException at org.sf.feeling.decompiler.SetupRunnable.setupPartListener(SetupRunnable.java:61) at org.sf.feeling.decompiler.SetupRunnable.run(SetupRunnable.java:43) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182) ... 18 more

cnfree commented 7 years ago

I committed a new version 2.9.9 that fixed this bug. Please update to this version, thanks.

EVi1b7wO commented 7 years ago

Now it's failing with an NPE at another location.

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) [..] Caused by: java.lang.NullPointerException at org.sf.feeling.decompiler.JavaDecompilerPlugin$3.run(JavaDecompilerPlugin.java:407) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)

Should'nt you be using Display.getDefaut().asyncExec in the SetupRunable instead of Display.getDefault().timerExec?

Also may you please update the master branch to the source you are building from? all the latest releases show ae6e8d and that is not the actual source.

Thanks

cnfree commented 7 years ago

I don't know why PlatformUI.getWorkbench( ).getActiveWorkbenchWindow( ) in your eclipse return null value, that's not a normal state.

So I had to use Display.getDefault( ).timerExec:

public void run( )
    {
        try
        {
            if ( PlatformUI.getWorkbench( ) == null
                    || PlatformUI.getWorkbench( ).getActiveWorkbenchWindow( ) == null
                    || PlatformUI.getWorkbench( ).getActiveWorkbenchWindow( ).getActivePage( ) == null )
            {
                Display.getDefault( ).timerExec( 1000, new Runnable( ) {

                    public void run( )
                    {
                        SetupRunnable.this.run( );
                    }
                } );
            }
            else
            {
                checkDecompilerUpdate( );
                checkClassFileAssociation( );
                setupPartListener( );
                checkDecompilerExtension( );
            }
        }
        catch ( Throwable e )
        {
            Logger.debug( e );
        }
    }

And I build a version 2.9.11, you can try it. But I don't make sure that It can work on your eclipse correctly.

For some reasons, I don't commit the decompiler code on this site, you can clone the master branch at https://github.com/cpupk/ecd, thanks.