Bug 15804

Summary: DOM/AST: wrong Length in cascading if/then/else
Product: [Eclipse Project] JDT Reporter: Dirk Baeumer <dirk_baeumer>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Dirk Baeumer CLA 2002-05-11 07:38:33 EDT
Build 20020508

In the following example the start/length of the if/then/else cascade is 
344/258. It should be 344/250.

import java.io.IOException;
import java.net.MalformedURLException;
import java.nio.charset.MalformedInputException;
import java.util.List;

import javax.naming.MalformedLinkException;

class A {
	
	private List field;
	
	public void l() throws IOException, MalformedURLException, 
MalformedLinkException, MalformedInputException {
		if (field != null) {
			throw new IOException();
		} else if (field == null) {
			throw new MalformedURLException();
		} else if (field == null) {
			throw new MalformedLinkException();
		} else {
			throw new MalformedInputException(10);
		}
	}
}
Comment 1 Olivier Thomann CLA 2002-05-13 12:49:43 EDT
This is a result of inconsistent positions returned by the compiler's ast nodes. When I wanted to 
fix the compiler's ast nodes, it was the right way to fix this problem. You refused to do so, because 
you relied on these old positions. Is it still the case?
Fixing the positions inside the AST 
converter is really ugly and I really would like to do it inside the parser.
Comment 2 Dirk Baeumer CLA 2002-05-13 13:06:59 EDT
Since we converted everything to the new AST we should be fine if you start 
changing positions in the old AST.
Comment 3 Olivier Thomann CLA 2002-05-13 13:52:16 EDT
I changed only the positions for the ifStatement. The update in the Parser is clean whereas code in 
the ASTConverter looks more like a hack.
Fixed and released in HEAD.