Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 11845

Summary: Internal Compiler Error
Product: [Eclipse Project] JDT Reporter: Michael Schmut <michael>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Zip file containing the test case
none
testcase2.zip none

Description Michael Schmut CLA 2002-03-20 09:21:10 EST
I want to compile a java class file, and i get a NullPointerException and the 
message "Internal compiler error".
Compile the same file with ant build on command line no problem. The complete 
project will build. 
In Eclipse no chance. Deleted the file and checked it out from CVS same 
problem. Changed the file, same problem. 

Using Eclipse Stable Build 14. Feb 2002

Can anyone help??

thx
Michael

The complete traceoutput :
Report for 1 markers:
Marker 1:
  Resource:/gui/panels/ProcessingPanel.java, Line: 0
  Message: Internal compiler error
java.lang.NullPointerException
	at 
org.eclipse.jdt.internal.compiler.lookup.BlockScope.emulateOuterAccess
(BlockScope.java:347)
	at 
org.eclipse.jdt.internal.compiler.ast.MessageSend.manageEnclosingInstanceAccessI
fNecessary(MessageSend.java:130)
	at org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode
(MessageSend.java:43)
	at org.eclipse.jdt.internal.compiler.ast.Block.analyseCode
(Block.java:36)
	at org.eclipse.jdt.internal.compiler.ast.TryStatement.analyseCode
(TryStatement.java:96)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode
(AbstractMethodDeclaration.java:77)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode
(TypeDeclaration.java:147)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.analyseCode
(QualifiedAllocationExpression.java:41)
	at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.analyseCode
(LocalDeclaration.java:43)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode
(AbstractMethodDeclaration.java:77)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode
(TypeDeclaration.java:147)
	at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.analyseCode
(QualifiedAllocationExpression.java:41)
	at org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.analyseCode
(FieldDeclaration.java:55)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode
(TypeDeclaration.java:335)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode
(CompilationUnitDeclaration.java:67)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:527)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:332)
	at org.eclipse.jdt.internal.core.newbuilder.AbstractImageBuilder.compile
(AbstractImageBuilder.java:209)
	at org.eclipse.jdt.internal.core.newbuilder.AbstractImageBuilder.compile
(AbstractImageBuilder.java:156)
	at org.eclipse.jdt.internal.core.newbuilder.BatchImageBuilder.build
(BatchImageBuilder.java:49)
	at org.eclipse.jdt.internal.core.newbuilder.JavaBuilder.buildAll
(JavaBuilder.java:139)
	at org.eclipse.jdt.internal.core.newbuilder.JavaBuilder.build
(JavaBuilder.java:87)
	at org.eclipse.core.internal.events.BuildManager$2.run
(BuildManager.java:351)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:817)
	at org.eclipse.core.runtime.Platform.run(Platform.java:395)
	at org.eclipse.core.internal.events.BuildManager.basicBuild
(BuildManager.java:109)
	at org.eclipse.core.internal.events.BuildManager.basicBuild
(BuildManager.java:174)
	at org.eclipse.core.internal.events.BuildManager.basicBuild
(BuildManager.java:184)
	at org.eclipse.core.internal.events.BuildManager$1.run
(BuildManager.java:133)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:817)
	at org.eclipse.core.runtime.Platform.run(Platform.java:395)
	at org.eclipse.core.internal.events.BuildManager.basicBuild
(BuildManager.java:147)
	at org.eclipse.core.internal.events.BuildManager.build
(BuildManager.java:209)
	at org.eclipse.core.internal.resources.Workspace.endOperation
(Workspace.java:701)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1237)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:78)
	at org.eclipse.ui.texteditor.AbstractTextEditor.performSaveOperation
(AbstractTextEditor.java:1546)
	at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSaveOperatio
n(CompilationUnitEditor.java:609)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave
(CompilationUnitEditor.java:657)
	at org.eclipse.ui.internal.EditorManager$9.run(EditorManager.java:785)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:296)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run
(ProgressMonitorDialog.java:335)
	at org.eclipse.ui.internal.EditorManager.runProgressMonitorOperation
(EditorManager.java:643)
	at org.eclipse.ui.internal.EditorManager.saveEditor
(EditorManager.java:790)
	at org.eclipse.ui.internal.WorkbenchPage.saveEditor
(WorkbenchPage.java:1380)
	at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:32)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:452)
	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:74)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1413)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1205)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:788)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:771)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:777)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319)
	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:151)
	at org.eclipse.core.launcher.Main.run(Main.java:502)
	at org.eclipse.core.launcher.Main.main(Main.java:362)

  Marker type: org.eclipse.jdt.core.problem
  Priority: Normal
Comment 1 Olivier Thomann CLA 2002-03-20 09:46:16 EST
Could you please send us (as an attachment) the source of the file ProcessingPanel.java?
We 
need a reproducable test case in order to be able to fix it. Thanks for the report.
Comment 2 Michael Schmut CLA 2002-03-20 11:01:56 EST
Fixed. Their was a call of private method in the main class from a thread was 
running in an sub class. Removed that line, an no problem to compile it anymore.
Test the same in an other class (same construct) no problem.

Thanks

Michael
Comment 3 Philipe Mulet CLA 2002-03-20 12:07:06 EST
This isn't fixed from our standpoint. The compiler needs to be fixed.
Comment 4 Olivier Thomann CLA 2002-03-20 13:09:17 EST
Could you please provide a more complete test case? The sole source file you sent is not enough. I 
could not reproduce it. For example it would greatly help if you could give us the source that fails 
and then the changes you made to compile it successfully.
Thanks for your help. This is a bug that 
needs to be resolved.
Comment 5 Olivier Thomann CLA 2002-03-21 11:12:34 EST
Created attachment 503 [details]
Zip file containing the test case
Comment 6 Olivier Thomann CLA 2002-03-21 11:15:17 EST
The attachement contains a small test case that points to the problem.

If the class A is 
defined in the Test.java (both classes are in the same package), the problem disappears.
The 
NPE is due to the fact that the compatibleType is null when 
calling:
currentScope.emulateOuterAccess((SourceTypeBinding) compatibleType, 
false); in MessageSend.manageEnclosingInstanceAccessIfNecessary(BlockScope).
Comment 7 Olivier Thomann CLA 2002-03-21 12:15:30 EST
Removing jbInit(); on line 10 fixes the error. I think the compiler wants to report a ambiguity 
between the jbInit() defined in A and jbInit() defined in Test.
Comment 8 Olivier Thomann CLA 2002-03-21 12:19:10 EST
Created attachment 505 [details]
testcase2.zip
Comment 9 Olivier Thomann CLA 2002-03-21 12:21:34 EST
Forgot my second attachement. It was a test for Brian about an error I got when I tried to add the 
first attachement. It is exactly the same test case than the fiorst one.
Comment 10 Philipe Mulet CLA 2002-03-22 05:53:30 EST
Actually the test should compile. The problem comes from the fact that we 
incorrectly record the relative depth of the target method which should be 2, 
but we compute 3 (one level too far --> null target enclosing type).

Fixed the depth bit encoding (forgot to reset depth when reassigning it).
Fixed