Null pointer issue : JavaImpl in non public class inheriting an interface

27 views
Skip to first unread message

मृदुल मनोहर मिश्र

unread,
Nov 19, 2016, 3:40:51 PM11/19/16
to eclim-dev
Hi,
  I have been getting a NullPointer error whenever I try to execute JavaImpl in a non public (package access class) inheriting an interface. The split window shows all the methods that need to be implemented in new class but as soon as I hit enter, it  throws null pointer error. Here is a skeleton code which will throw the error, interestingly if I implement interface in public class (e.g. TestImpl below) I don't see the error. I am running ArchLinux, PingEclim gives output 'eclim 2.6.0, eclipse 4.6.1). Installed java version is :

aur/jdk 8u112-1 [installed] (719) (11.21)
    Oracle Java Development Kit


Code : 
package org.implerror;

interface Interface1 {
    void method1();
}

class Class1 implements Interface1 {
/* Executing :JavaImpl here */
}

/* Having this skeleton doesn't impact the behavior
public class TestImpl {
    public static void main(String[] args) {

    }
}
*/


NullPointer error:

2016-11-19 12:28:44,211 ERROR [org.eclim.command.Main] Command failed
java.lang.NullPointerException
        at org.eclim.plugin.jdt.command.impl.ImplCommand.getSibling(ImplCommand.java:455)
        at org.eclim.plugin.jdt.command.impl.ImplCommand.insertMethods(ImplCommand.java:359)
        at org.eclim.plugin.jdt.command.impl.ImplCommand.execute(ImplCommand.java:105)
        at org.eclim.command.Main$1.run(Main.java:100)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4528)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4146)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
        at org.eclim.eclipse.EclimApplication.start(EclimApplication.java:128)
        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:673)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
NGSession 2: 127.0.0.1: org.eclim.command.Main exited with status 1

मृदुल मनोहर मिश्र

unread,
Nov 19, 2016, 3:44:39 PM11/19/16
to eclim-dev
Also I have installed eclim via aur.

aur/eclim 2.6.0-1 [installed] (114) (2.37)
    Brings Eclipse functionality to Vim

Thanks,
Mridul

Eric Van Dewoestine

unread,
Nov 27, 2016, 8:23:03 PM11/27/16
to ecli...@googlegroups.com
> ...

So far I can't reproduce this. Based on the error it looks like the
type for the file couldn't be determined, but I can't replicate that
case. Can you try running

:let g:EclimLogLevel = 'trace'

Then run the command again and try to add a method. Then send met the
result of running:

:messages

If you can do this using the same example you provided above, that
would be ideal, so I can compare against my version of that example.

--
eric

मृदुल मनोहर मिश्र

unread,
Dec 4, 2016, 1:44:39 PM12/4/16
to eclim-dev
Thanks for your reply Eric.
I followed the steps mentioned by you and this is what I get:

:messages output on vim:

Messages maintainer: Bram Moolenaar <Br...@vim.org>
"TestImpl.java" 18L, 302C
(0s) system: "/usr/lib/eclipse/plugins/org.eclim_2.6.0/bin/eclim" --nailgun-server localhost --nailgun-port 9091 -editor vim -command projects
(0s) system: "/usr/lib/eclipse/plugins/org.eclim_2.6.0/bin/eclim" --nailgun-server localhost --nailgun-port 9091 -editor vim -command java_impl -p "TIJ4P" -f "src/java/org/implerror/TestImpl.java" -o 107 -e u
tf-8
(0s) system: "/usr/lib/eclipse/plugins/org.eclim_2.6.0/bin/eclim" --nailgun-server localhost --nailgun-port 9091 -editor vim -command java_impl -p "TIJ4P" -f "src/java/org/implerror/TestImpl.java" -t "org.imp
lerror.Class1" -s "org.implerror.Interface1" -m '["method1()"]'
java.lang.NullPointerException
^Iat org.eclim.plugin.jdt.command.impl.ImplCommand.getSibling(ImplCommand.java:455)
^Iat org.eclim.plugin.jdt.command.impl.ImplCommand.insertMethods(ImplCommand.java:359)
^Iat org.eclim.plugin.jdt.command.impl.ImplCommand.execute(ImplCommand.java:105)
^Iat org.eclim.command.Main$1.run(Main.java:100)
^Iat org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
^Iat org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
^Iat org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4528)
^Iat org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4146)
^Iat org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
^Iat org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
^Iat org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
^Iat org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
^Iat org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
^Iat org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
^Iat org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
^Iat org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
^Iat org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
^Iat org.eclim.eclipse.EclimApplication.start(EclimApplication.java:128)
^Iat org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
^Iat org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
^Iat org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
^Iat org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
^Iat org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
^Iat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
^Iat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
^Iat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
^Iat java.lang.reflect.Method.invoke(Method.java:498)
^Iat org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
^Iat org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
^Iat org.eclipse.equinox.launcher.Main.run(Main.java:1519)
^Iat org.eclipse.equinox.launcher.Main.main(Main.java:1492)
while executing command (port: 9091): -editor vim -command java_impl -p "TIJ4P" -f "src/java/org/implerror/TestImpl.java" -t "org.implerror.Class1" -s "org.implerror.Interface1" -m '["method1()"]'
"TestImpl.java" 18L, 302C
"TestImpl.java" 18L, 302C written
(0s) system: "/usr/lib/eclipse/plugins/org.eclim_2.6.0/bin/eclim" --nailgun-server localhost --nailgun-port 9091 -editor vim -command java_src_update -p "TIJ4P" -f "src/java/org/implerror/TestImpl.java" -v 


And the eclim log from the shell:
2016-12-04 10:41:17,072 ERROR [org.eclim.command.Main] Command failed
java.lang.NullPointerException
        at org.eclim.plugin.jdt.command.impl.ImplCommand.getSibling(ImplCommand.java:455)
        at org.eclim.plugin.jdt.command.impl.ImplCommand.insertMethods(ImplCommand.java:359)
        at org.eclim.plugin.jdt.command.impl.ImplCommand.execute(ImplCommand.java:105)
Reply all
Reply to author
Forward
0 new messages