Community
Participate
Working Groups
I'm getting an NPE while trying to invoke VJET->"Js2Java Code Generation" Context Menu Action: !ENTRY org.eclipse.vjet.eclipse.javatojs.ui 4 0 2013-05-14 00:11:58.204 !MESSAGE !STACK 0 java.lang.NullPointerException at org.eclipse.vjet.eclipse.javatojs.ui.commands.Js2JavaGenerateJob$1.run(Js2JavaGenerateJob.java:83) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327) at org.eclipse.vjet.eclipse.javatojs.ui.commands.Js2JavaGenerateJob.runInWorkspace(Js2JavaGenerateJob.java:125) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Can you provide example .js file you selected? What was selected when you selected Js to java? This command works with vjo.js types such as vjo.ctype('namespace.Foo') .protos({ //> public void doIt(String) doIt:function(a){} }) .endType()
The project itself was selected, not a specific js-file. It is a dependency problem was the reason of org.eclipse.vjet.eclipse.javatojs.core plug-in wasn't activated. In this case, org.eclipse.vjet.eclipse.javatojs.ui.commands.Js2JavaGenerateJob.getGenerator() method returns null (and this method is intended to return null if it cannot find a Generator for any reason), but there is no a check for null for a generator (lines after #82 in org.eclipse.vjet.eclipse.javatojs.ui.commands.Js2JavaGenerateJob.runInWorkspace(). IMHO, the check for null should be added there after, and a suitable message is to be logged in case of getGenerator() returned null. Also, the method org.eclipse.vjet.eclipse.javatojs.ui.commands.ClassloaderUtils.createClassLoader(ClassLoaderKey) hides exceptions inside try-catch and doesn't reports them into a log. IMHO, it's not a good practice, since it makes difficult to find a real reason of not getting the generator object.