Bug 28750 - Compiler crashes with M4
Summary: Compiler crashes with M4
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 28760 28819 28934 28953 28954 28980 29029 29031 29088 29197 29229 29267 30232 30418 30746 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-12-20 10:53 EST by Brad Miller CLA
Modified: 2003-02-06 11:38 EST (History)
13 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Miller CLA 2002-12-20 10:53:47 EST
The following program causes the compiler to crash on either XP or Linux when 
the assert is uncommented:

public class Test {
    class CacheEntry {
        private void add(int i) {
//          assert (i < 0) : "message";
        }
    }
}

The log entries are:

!ENTRY org.eclipse.ui 4 4 Dec 20, 2002 09:24:15.720
!MESSAGE Save Failed
!ENTRY org.eclipse.ui 2 0 Dec 20, 2002 09:24:15.720
!MESSAGE Save Failed
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.ClassFile.addFieldInfo
(ClassFile.java:434)
	at org.eclipse.jdt.internal.compiler.ClassFile.addFieldInfos
(ClassFile.java:579)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode
(TypeDeclaration.java:694)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode
(TypeDeclaration.java:762)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode
(TypeDeclaration.java:709)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode
(TypeDeclaration.java:770)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode
(CompilationUnitDeclaration.java:158)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve
(Compiler.java:591)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process
(CompilationUnitProblemFinder.java:204)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure
(CompilationUnit.java:90)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent
(CompilationUnit.java:664)
	at org.eclipse.jdt.internal.core.WorkingCopy.reconcile
(WorkingCopy.java:446)
	at org.eclipse.jdt.internal.core.WorkingCopy.reconcile
(WorkingCopy.java:421)
	at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.doSaveDo
cument(CompilationUnitDocumentProvider.java:903)
	at org.eclipse.ui.texteditor.AbstractDocumentProvider.saveDocument
(AbstractDocumentProvider.java:454)
	at org.eclipse.ui.texteditor.AbstractTextEditor$11.execute
(AbstractTextEditor.java:2772)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run
(WorkspaceModifyOperation.java:65)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1564)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:79)
	at org.eclipse.ui.texteditor.AbstractTextEditor.performSaveOperation
(AbstractTextEditor.java:2790)
	at 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSaveOperati
on(CompilationUnitEditor.java:849)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave
(CompilationUnitEditor.java:913)
	at org.eclipse.ui.internal.EditorManager$11.run
(EditorManager.java:1032)
	at org.eclipse.ui.internal.EditorManager$8.run(EditorManager.java:901)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:296)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246)
	at org.eclipse.jface.window.ApplicationWindow$1.run
(ApplicationWindow.java:432)
	at org.eclipse.swt.custom.BusyIndicator.showWhile
(BusyIndicator.java:65)
	at org.eclipse.jface.window.ApplicationWindow.run
(ApplicationWindow.java:429)
	at org.eclipse.ui.internal.WorkbenchWindow.run
(WorkbenchWindow.java:1174)
	at org.eclipse.ui.internal.EditorManager.runProgressMonitorOperation
(EditorManager.java:907)
	at org.eclipse.ui.internal.EditorManager.saveEditor
(EditorManager.java:1037)
	at org.eclipse.ui.internal.WorkbenchPage.saveEditor
(WorkbenchPage.java:2143)
	at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:30)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:769)
	at org.eclipse.ui.internal.WWinKeyBindingService.invoke
(WWinKeyBindingService.java:139)
	at org.eclipse.ui.internal.WWinKeyBindingService.pressed
(WWinKeyBindingService.java:120)
	at org.eclipse.ui.internal.WWinKeyBindingService$6.widgetSelected
(WWinKeyBindingService.java:376)
	at org.eclipse.ui.internal.AcceleratorMenu$2.handleEvent
(AcceleratorMenu.java:55)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1446)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1429)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:845)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	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:247)
	at org.eclipse.core.launcher.Main.run(Main.java:703)
	at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 1 Olivier Thomann CLA 2002-12-20 11:32:49 EST
I will investigate.
Comment 2 Olivier Thomann CLA 2002-12-20 11:43:15 EST
The bug is due to the fact that two synthetic fields share the same index.
Therefore we got a null in the synthetic fields arrays and we cannot generate
the field info properly.
I will see how to fix it.
Comment 3 Olivier Thomann CLA 2002-12-20 11:49:10 EST
I think the bug is that we put 0 as the index for the assertion synthetic fields
instead of synthetics[FIELD].size().
A fix could be to replace:
		synthField = new SyntheticFieldBinding(
			"$assertionsDisabled".toCharArray(), //$NON-NLS-1$
			BooleanBinding,
			AccDefault | AccStatic | AccSynthetic | AccFinal,
			this,
			Constant.NotAConstant,
			0);
		synthetics[FIELD].put("assertionEmulation", synthField); //$NON-NLS-1$
	
with:

		synthField = new SyntheticFieldBinding(
			"$assertionsDisabled".toCharArray(), //$NON-NLS-1$
			BooleanBinding,
			AccDefault | AccStatic | AccSynthetic | AccFinal,
			this,
			Constant.NotAConstant,
			synthetics[FIELD].size());
		synthetics[FIELD].put("assertionEmulation", synthField); //$NON-NLS-1$
	
in SourceTypeBinding.addSyntheticField(AssertStatement assertStatement,
BlockScope blockScope).

Comment 4 Kent Johnson CLA 2002-12-24 09:59:55 EST
*** Bug 28819 has been marked as a duplicate of this bug. ***
Comment 5 Kent Johnson CLA 2002-12-24 10:00:44 EST
*** Bug 28760 has been marked as a duplicate of this bug. ***
Comment 6 Olivier Thomann CLA 2003-01-02 19:33:41 EST
*** Bug 28934 has been marked as a duplicate of this bug. ***
Comment 7 Olivier Thomann CLA 2003-01-02 19:34:08 EST
*** Bug 28953 has been marked as a duplicate of this bug. ***
Comment 8 Olivier Thomann CLA 2003-01-02 19:34:49 EST
*** Bug 28954 has been marked as a duplicate of this bug. ***
Comment 9 Olivier Thomann CLA 2003-01-04 13:02:15 EST
*** Bug 28980 has been marked as a duplicate of this bug. ***
Comment 10 Philipe Mulet CLA 2003-01-05 18:39:39 EST
How did it ever work ?
Comment 11 Olivier Thomann CLA 2003-01-05 22:15:49 EST
I think it never worked inside an inner class that required its enclosing instance.
I will release the fix tomorrow.
Comment 12 Olivier Thomann CLA 2003-01-06 08:49:33 EST
Fixed and released in 2.1 stream.
Regression test added.
Comment 13 Kent Johnson CLA 2003-01-06 10:41:55 EST
*** Bug 29031 has been marked as a duplicate of this bug. ***
Comment 14 Kent Johnson CLA 2003-01-06 10:43:15 EST
*** Bug 29029 has been marked as a duplicate of this bug. ***
Comment 15 Kent Johnson CLA 2003-01-07 10:30:20 EST
*** Bug 29088 has been marked as a duplicate of this bug. ***
Comment 16 Philipe Mulet CLA 2003-01-09 06:03:27 EST
*** Bug 29197 has been marked as a duplicate of this bug. ***
Comment 17 Olivier Thomann CLA 2003-01-09 13:33:58 EST
*** Bug 29229 has been marked as a duplicate of this bug. ***
Comment 18 Kent Johnson CLA 2003-01-10 10:05:34 EST
*** Bug 29267 has been marked as a duplicate of this bug. ***
Comment 19 Philipe Mulet CLA 2003-01-25 17:13:26 EST
*** Bug 30232 has been marked as a duplicate of this bug. ***
Comment 20 Olivier Thomann CLA 2003-01-28 14:28:00 EST
*** Bug 30418 has been marked as a duplicate of this bug. ***
Comment 21 Olivier Thomann CLA 2003-01-31 17:10:26 EST
*** Bug 30746 has been marked as a duplicate of this bug. ***
Comment 22 David Audel CLA 2003-02-06 11:38:23 EST
Verified.