Bug 95262 - ASTParser fails with K_CLASS_BODY_DECLARATIONS
Summary: ASTParser fails with K_CLASS_BODY_DECLARATIONS
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-14 07:07 EDT by julien CLA
Modified: 2005-05-27 06:43 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 julien CLA 2005-05-14 07:07:11 EDT
I download M7 and noticed an error with ASTParser. Here is the code:

ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
parser.setSource("private static Category[] values = new Category[]{v1, v2, 
v3};".toCharArray());
ASTNode root = (ASTNode) parser.createAST(null);

It gives the following exception:

java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2583)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:769)
	at org.eclipse.jdt.core.dom.ASTConverter.convert
(ASTConverter.java:1443)
	at 
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment
(ASTConverter.java:2789)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration
(ASTConverter.java:2692)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:874)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateASTForKind
(ASTParser.java:949)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST
(ASTParser.java:716)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:570)
Comment 1 Olivier Thomann CLA 2005-05-16 15:53:59 EDT
Fixed and released in HEAD.
Regression test in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test607.
Comment 2 Frederic Fusier CLA 2005-05-27 06:43:19 EDT
Verified for 3.1 RC1 with build I20050527-0010.