Bug 15804 - DOM/AST: wrong Length in cascading if/then/else
Summary: DOM/AST: wrong Length in cascading if/then/else
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-11 07:38 EDT by Dirk Baeumer CLA
Modified: 2002-05-13 13:52 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.