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

Bug 347646

Summary: ASTRewrite throws IAE in CU with syntax error (missing type declaration body)
Product: [Eclipse Project] JDT Reporter: maninred
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, markus.kell.r, remy.suen, satyam.kandula, srikanth_sankaran
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug
Attachments:
Description Flags
I´ve used the quickfix Add unimplemented methods
none
the error log-stacktracke none

Description maninred CLA 2011-05-30 08:51:52 EDT
Build Identifier: M20110210-1200

I´ve written a Interface that declare two functions that override implemented functions in java, wich themselfs are not defined yet(See screenshot).

A unhandled exception occurs->the error log will be added.

Eclipse 3.6.2 was used and the openjdk6u20 on openSUSE11.4.
Eclipse is executed from your download package and not installed with yast2.

Reproducible: Didn't try

Steps to Reproduce:
1.figuring unskilled around
2.
3.
Comment 1 maninred CLA 2011-05-30 08:53:53 EDT
Created attachment 196890 [details]
I´ve used the quickfix Add unimplemented methods
Comment 2 maninred CLA 2011-05-30 08:54:25 EDT
Created attachment 196891 [details]
the error log-stacktracke
Comment 3 Markus Keller CLA 2011-05-30 12:27:25 EDT
To reproduce, paste this to Package Explorer and then apply the
"Add unimplemented methods" quick fix on Test2:

//------------------------------------------------------------------
public interface ITest {
//	public void write(int wert);
//	public int read();
	public void foo();
}

public class Test implements ITest {

	@Override
	public void write(int wert) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int read() {
		// TODO Auto-generated method stub
		return 0;
	}
	
}

class Test2 implements ITest
//------------------------------------------------------------------


Moving to JDT/Core to add more protection (similar to bug 272711).
Comment 4 Srikanth Sankaran CLA 2012-03-20 11:33:18 EDT
If you plan to include a fix for this in 3.8 M7, please adjust the
target suitably, so it becomes easier to track.
Comment 5 Satyam Kandula CLA 2012-05-14 01:01:42 EDT
Will not be able to contain this in 3.8.
Comment 6 Markus Keller CLA 2012-05-14 06:37:56 EDT
Relevant stack trace:

java.lang.IllegalArgumentException: Document does not match the AST
at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.handleException(ASTRewriteAnalyzer.java:3583)
at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.getPosAfterLeftBrace(ASTRewriteAnalyzer.java:1159)
at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:1605)
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:467)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480)
at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.internalRewriteAST(ASTRewrite.java:271)
at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST(ASTRewrite.java:260)
at org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite.attachChange(CompilationUnitRewrite.java:271)
...
Caused by: org.eclipse.core.runtime.CoreException: End Of File
at org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner.readNext(TokenScanner.java:92)
at org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner.readNext(TokenScanner.java:111)
at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.getPosAfterLeftBrace(ASTRewriteAnalyzer.java:1154)
... 45 more
Comment 7 Eclipse Genie CLA 2019-10-09 03:08:21 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.

If you have further information on the current state of the bug, please add it. 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.