Bug 40995 - NPE in ast.ExplicitConstructorCall.analyseCode
Summary: NPE in ast.ExplicitConstructorCall.analyseCode
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 41642 41711 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-31 08:44 EDT by Dani Megert CLA
Modified: 2003-08-28 05:55 EDT (History)
2 users (show)

See Also:


Attachments
Edited Source file from org.eclipse.jdt.ui, which evokes NPE if selection is around line 160 (66.50 KB, application/octet-stream)
2003-08-13 04:00 EDT, Markus Keller CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2003-07-31 08:44:26 EDT
I20030730

Getting lots of these in my log

!ENTRY org.eclipse.jdt.core 4 4 Jul 31, 2003 12:34:10.775
!MESSAGE Exception occurred during problem detection: 
!STACK 0
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall.analyseCode(ExplicitConstructorCall.java:69)
	at
org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.analyseCode(ConstructorDeclaration.java:92)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:615)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:211)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCode(TypeDeclaration.java:597)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDeclaration.java:251)
	at
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:77)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:595)
	at
org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:172)
	at
org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:139)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:198)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:448)
	at
org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:881)
	at
org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:48)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.execute(JavaModelOperation.java:365)
	at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:704)
	at org.eclipse.jdt.internal.core.JavaElement.runOperation(JavaElement.java:484)
	at
org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:994)
	at
org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:970)
	at
org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:963)
	at
org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.getElementForInputAt(JavaBrowsingPart.java:1294)
	at
org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.setSelectionFromEditor(JavaBrowsingPart.java:1146)
	at
org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.selectionChanged(JavaBrowsingPart.java:698)
	at
org.eclipse.ui.internal.AbstractSelectionService$4.run(AbstractSelectionService.java:178)
	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1015)
	at org.eclipse.core.runtime.Platform.run(Platform.java:420)
	at
org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:176)
	at
org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:76)
	at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2099)
	at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2052)
	at org.eclipse.jface.text.TextViewer$4.run(TextViewer.java:2031)
	at org.eclipse.swt.widgets.Display.runTimer(Display.java:2230)
	at org.eclipse.swt.widgets.Display.messageProc(Display.java:1764)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1338)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1876)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1680)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1663)
	at
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
	at org.eclipse.core.launcher.Main.run(Main.java:747)
	at org.eclipse.core.launcher.Main.main(Main.java:583)
Comment 1 Olivier Thomann CLA 2003-07-31 08:54:48 EDT
Would you have a test case to reproduce it?
Comment 2 Dani Megert CLA 2003-07-31 08:55:44 EDT
No, found it in .log (many of those) but nothing in the UI.
Comment 3 Olivier Thomann CLA 2003-07-31 09:14:42 EDT
Do you get this if you do a full build of jdt/ui code?
You can try removing your .log file and start a full build. If you get it 
again, let me know. I will try to reproduce it on my side.
Thanks.
Comment 4 Dani Megert CLA 2003-07-31 09:44:54 EDT
I have auto-build on. I think it happened while editing code and then the other
views tried to update.

I rebuilt all, but the NPE did not happen again.
Comment 5 Olivier Thomann CLA 2003-07-31 10:25:14 EDT
This error occured while compiling the constructor of a member class. I suspect 
that the constructor is calling a super constructor. Without further details, 
it is difficult to fix it or reproduce it.
It definitely happened during the reconciling. If you have a change to see it 
again, please provide a test case.
Comment 6 Dani Megert CLA 2003-07-31 10:31:01 EDT
I was editing constructors in the file DefaultInformationControl. But they call
this(...) not super(...).

Comment 7 Olivier Thomann CLA 2003-07-31 10:36:35 EDT
The problem occurs in a constructor of a member type according to the stack 
trace.
Comment 8 Markus Keller CLA 2003-08-13 04:00:27 EDT
Created attachment 5730 [details]
Edited Source file from org.eclipse.jdt.ui, which evokes NPE if selection is around line 160

Maybe I have a test case:

The attachment is a copy & paste snapshot of my editing of the file
InstanceMethodMover.java.

I was editing around line 160, when the Error Log started to fill up with the
stack trace from the bug description. Afterwards, I couldn't even save the file
("Save could not be completed" because of NPE), and each time, an additional
NPE was logged shortly after the editor got focus again.

Note: when I remove the opening brace at the end of line 160, it stops logging
errors.

Build id: 200308060800
Comment 9 Markus Keller CLA 2003-08-13 04:10:02 EDT
Additional environment info:
- auto-build off
- Preferences > Java > Work in Progress:
  - "Smart Semicolon" on
  - "Smart Opening Brace" on

Suggest increasing severity, since NPE on save should not happen.
Comment 10 Olivier Thomann CLA 2003-08-13 13:37:48 EDT
Reproduced. I will investigate.
Comment 11 Olivier Thomann CLA 2003-08-13 16:00:40 EDT
I found a problem in the recovery that might be responsible for this problem.
The problem is the creation of a default constructor for interfaces. An
interface cannot have a constructor. Removing it fixed the problem.
I need to isolate a small test case to add it to the regression tests.
Comment 12 Olivier Thomann CLA 2003-08-13 17:17:39 EDT
Fixed and released in HEAD.
Comment 13 Olivier Thomann CLA 2003-08-18 11:06:05 EDT
*** Bug 41642 has been marked as a duplicate of this bug. ***
Comment 14 Olivier Thomann CLA 2003-08-20 08:37:00 EDT
*** Bug 41711 has been marked as a duplicate of this bug. ***
Comment 15 David Audel CLA 2003-08-28 05:55:13 EDT
Verified.