Bug 10761 - ast api: why TypeName not Type as subnode of ClassInstanceCreation?
Summary: ast api: why TypeName not Type as subnode of ClassInstanceCreation?
Status: RESOLVED INVALID
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: Jim des Rivieres CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-05 09:22 EST by Adam Kiezun CLA
Modified: 2002-03-08 10:17 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 Adam Kiezun CLA 2002-03-05 09:22:18 EST
why is TypeName a subnode of ClassInstanceCreation?
i was expecting Type instead
Comment 1 Jim des Rivieres CLA 2002-03-05 12:06:07 EST
Because the only thing that is allowed in a ClassInstanceCreation expression
is the name of a reference type. Primitive types are not legitimate (not
instantiable), and array types are instantiated in separate ArrayCreation 
expression nodes that are structurally dissimilar to ClassInstanceCreation.
Comment 2 Adam Kiezun CLA 2002-03-05 12:12:40 EST
sorry, i mean SimpleType, not Type
Comment 3 Jim des Rivieres CLA 2002-03-05 19:39:17 EST
The least general abstract node type, like Name and Type, is generally used 
where ever possible. So, for example, the superclass and superinterfaces 
properties of a TypeDeclaration are declared Name (abstract) rather than 
SimpleType (concrete) or a Type (abstract, but too general).

Likewise, the name property of a ClassInstanceCreation node is declared as Name,
rather than SimpleType or Type.
Comment 4 Adam Kiezun CLA 2002-03-06 04:50:23 EST
in this case, a class being abstract or not is simply an implementation detail 
for me - as a user of that API i see no difference at all.
so, while i presume there were arguments for that decision, this one seems 
faulty. 

when i traverse an ast trying to find all places where types are referenced i 
expected that visiting Type and QualifiedName nodes would be sufficient to see 
all nodes. currently, i also have to visit ClassInstanceCreation and look 
inside those nodes.

that being said - i can live with the current solution, no problems :)
Comment 5 Olivier Thomann CLA 2002-03-08 10:17:03 EST
Closed. Not a bug.