Bug 11037 - DOM/AST: IllegalArgumentException when creating AST
Summary: DOM/AST: IllegalArgumentException when creating AST
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 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-08 12:43 EST by Dirk Baeumer CLA
Modified: 2002-03-08 13:05 EST (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-03-08 12:43:33 EST
Build 20020307

Test code:

import java.util.List;

public class Switch {
	
	public List fList;
	
	public void foo() {
		int i= 10;
		switch (i) {
			case 1:
				List l= null;
				break;
			default:
		}
	}
}


java.lang.IllegalArgumentException: Should not be reached: convert(class 
org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1449)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1758)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1491)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:590)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations
(ASTConverter.java:215)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:159)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:73)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:230)
	at org.eclipse.jdt.internal.corext.dom.JavaElementMapper.perform
(JavaElementMapper.java:40)
	at 
org.eclipse.jdt.internal.corext.refactoring.sef.SelfEncapsulateFieldRefactoring.
checkActivation(SelfEncapsulateFieldRefactoring.java:134)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate
(RefactoringStarter.java:74)
	at 
org.eclipse.jdt.internal.ui.refactoring.actions.SelfEncapsulateFieldAction.run
(SelfEncapsulateFieldAction.java:42)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:452)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
Comment 1 Olivier Thomann CLA 2002-03-08 12:46:46 EST
In general this means it is a missing case. Should be fixed quickly.
Comment 2 Olivier Thomann CLA 2002-03-08 13:03:43 EST
I don't know why I was rejecting the case where a local declaration was a 
statement. This is naturally possible. In this example, List l = null; should 
be converted to a VariableDeclarationStatement.
Fixed and released in HEAD.