Community
Participate
Working Groups
Version: 2.0 Build ID: 200206271827 Running IDE with j2sdk1.4.0_01 and compiling with libs from jdk1.3.1_03 (marked as the default JRE). The IDE throws a NullPointerException during compilation, places the error mark at the fist line of the file (though, that's not where the actual error is) and stops compiling. A dialog box is displayed with the following error: The dialog box is titled: Save problems and the content is: Save could not be completed. Reason: Errors during build. and the Details button reveals: Java.Lang.NullPointerException encountered while running org.eclipse.jdt.internal.core.builder.JavaBuilder Log file error message attached at bottom. Turns out the error is because we had a subclassed exception listed after a superclass exception. I think this compile error should be handled a little better. When compiled from the command line (jdk1.3.1_03) the following error is displayed: com/epolicy/servlet/GetPremiumDetail.java:70: exception com.epolicy.data.LookupException has already been caught catch (LookupException le) { ^ 1 error Shouldn't Eclipse display something similar as opposed to the way it is handling it? Sample code: // LookupException inherits from DataException, 3rd party software // and we weren't aware at the time of the relation. public void myMethod() { //...code... try { //...code... } catch(DataException de) { //...code... } catch(LookupException le) { //...code... } //...code... } When reversed everything is happy. Error in task pane (same as in Eclipse log file): Error Internal compiler error java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.codegen.ObjectCache.hashCode(ObjectCache.java:83) at org.eclipse.jdt.internal.compiler.codegen.ObjectCache.put(ObjectCache.java:95) at org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext.<init>(ExceptionHandlingFlowContext.java:58) at org.eclipse.jdt.internal.compiler.ast.TryStatement.analyseCode(TryStatement.java:92) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode(AbstractMethodDeclaration.java:102) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:440) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:76) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:536) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:337) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:219) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:166) at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:108) at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:181) at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:109) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:392) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:831) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:120) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:176) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:186) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:146) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:831) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:160) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:211) at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:733) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1366) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:78) at org.eclipse.ui.texteditor.AbstractTextEditor.performSaveOperation(AbstractTextEditor.java:2327) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSaveOperation(CompilationUnitEditor.java:664) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave(CompilationUnitEditor.java:712) at org.eclipse.ui.internal.EditorManager$11.run(EditorManager.java:987) at org.eclipse.ui.internal.EditorManager$8.run(EditorManager.java:856) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:299) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:394) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:391) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1105) at org.eclipse.ui.internal.EditorManager.runProgressMonitorOperation(EditorManager.java:862) at org.eclipse.ui.internal.EditorManager.saveEditor(EditorManager.java:992) at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:1922) at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:32) at org.eclipse.jface.action.Action.runWithEvent(Action.java:749) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:361) at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:352) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:775) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:698) at org.eclipse.core.launcher.Main.main(Main.java:534) GetPremiumDetail.java ipronet/src/com/epolicy/servlet line 0 in com.epolicy.servlet
You found a bug in the compiler, however you need more than your test case to reproduce it: - you must first disable the compilation error for unreachable code. ================ package p; public class X { public void myMethod() { System.out.println("starting"); try { if (true) throw new LookupException(); } catch(DataException de) { System.out.println("DataException occurred"); } catch(LookupException le) { System.out.println("LookupException occurred"); } catch(Throwable t) { System.out.println("Throwable occurred"); } System.out.println("finished"); } } class DataException extends Throwable { } class LookupException extends DataException { } ========================
Fixed in latest (HEAD). Shouldn't return from loop diagnosing problems since may leave uninitalized exception types in array.
Verified.
Verified
Verified in 2.1 M1