Bug 60558 - AST: ast.createInstance(Class nodeClass) should not throw a RuntimeException
Summary: AST: ast.createInstance(Class nodeClass) should not throw a RuntimeException
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Jim des Rivieres CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-30 08:32 EDT by Martin Aeschlimann CLA
Modified: 2004-05-18 13:17 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 Martin Aeschlimann CLA 2004-04-30 08:32:41 EDT
20040430
ast.createInstance(Class nodeClass)
declares to throw a runtime exception. It would be better to throw something
more typed, like a IllegalArgumentException.
Catching a 'RuntimeException' at the caller site is a very bad thing (it
includes NullPointerException ect)
Comment 1 Jim des Rivieres CLA 2004-04-30 10:44:47 EDT
Actually, there are no exceptions that any client should catch; all are 
programming errors. I will revise specs for AST.createInstance(*) to clarify 
that IllegalArgumentException is thrown if client passes a bogus argument.
Comment 2 Jim des Rivieres CLA 2004-04-30 11:18:28 EDT
Also clarified spec for ASTNode.nodeClassForType(int) to say that it throws 
IllegalArgumentException when argument is bogus.
Comment 3 Martin Aeschlimann CLA 2004-04-30 11:20:03 EDT
ok great. I was irritated by the Javadoc comment
Comment 4 Olivier Thomann CLA 2004-05-18 13:17:39 EDT
Verified in 200405180816