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

Bug 334307

Summary: [DOM][AST] IllegalArgumentException at setSourceRange(ASTNode.java:2616) with junk
Product: [Eclipse Project] JDT Reporter: Chris West (Faux) <eclipse>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: markus.kell.r, Olivier_Thomann, peblpebl
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
Full stack none

Description Chris West (Faux) CLA 2011-01-13 14:32:45 EST
Build Identifier: I20110111-0800

Entering completely junk code into a _Java_ editor, like:

enum a b;

void b(struct a *)
{
	if (c) {
		enum d;

		if (e())
			f->g;
	}
}

void h(int *) {
}

...causes:
java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2616)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:434)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:255)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToEnumDeclaration(ASTConverter.java:2920)
...

This stops error reporting working properly.

(don't even ask)

Reproducible: Always

Steps to Reproduce:
1. Enter the code into a Java editor.
2. Attempt to mouse-over a bit of red-underlined text.
3. No hover will be provided, and errors will go in the Error Log.
Comment 1 Olivier Thomann CLA 2011-01-13 14:43:43 EST
Ayushman, please take a look time permitting.
The recovery must be completely busted with this code.
Comment 2 Chris West (Faux) CLA 2011-01-13 14:45:47 EST
Created attachment 186771 [details]
Full stack
Comment 3 Peter Larsen CLA 2011-12-05 08:29:24 EST
A co-worker seems to have hit the same bug. However source is not junk (not included).

!SESSION 2011-11-15 10:39:21.037 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.7.0
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product



java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2616)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:501)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:322)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2282)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1520)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2450)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:532)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:183)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2636)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1218)
	at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:280)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:203)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:258)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:518)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:1079)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:170)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:89)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:788)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1244)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:126)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:108)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:89)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:87)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:151)
	at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
	at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:104)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)
Comment 4 Olivier Thomann CLA 2011-12-06 10:00:26 EST
Peterm, could you please isolate a test case that could let us reproduce your issue ?
Comment 5 Eclipse Genie CLA 2020-04-15 11:40:05 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.