Bug 130140

Summary: ASTParser should specify failure for IClassFile without source
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2006-03-02 11:12:46 EST
HEAD

ASTParser#createAST(..) currently throws this exception when called after setSource(IClassFile) for a class file without source attachment.

java.lang.IllegalStateException
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:783)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:616)

createAST(..) specifies that it can throw an ISE at any time, but since this case is fully predictable, I think at least the javadoc of setSource(IClassFile) should warn that the parser will fail if source is not available.

And while you're at the javadocs, there are also 2 glitches in the class doc:
- "// handles JDK 1.0, 1.1, 1.2, 1.3, 1.4, 1.5" should include 1.6
- "settings are automicatically returned to their defaults" should be
  "settings are automatically reset to their defaults"
Comment 1 Olivier Thomann CLA 2006-03-09 20:01:14 EST
Fixed and released in HEAD.
To verify, please check the doc.
Comment 2 Jerome Lanneluc CLA 2006-03-28 08:26:54 EST
Verified for 3.2 M6 using build I20060328-0010