This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 151986 - Add method TreeMaker.Type(DeclaredType)
Summary: Add method TreeMaker.Type(DeclaredType)
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Rastislav Komara
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-31 14:58 UTC by Marian Petras
Modified: 2009-02-03 10:57 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Petras 2008-10-31 14:58:25 UTC
Add method

    ExpressionTree Type(DeclaredType type)

to class TreeMaker.

This would be useful when creating a TypeParameterTree:

    TreeMaker maker = ...
    DeclaredType extendsType = ...
    TypeParameterTree typeParamTree
            = maker.TypeParameter("T",
                                  Collections.singletonList(maker.Type(extendsType)));

The currently existing method

    Tree Type(TypeMirror type)

returns a Tree but TreeMaker.TypeParameter requires a list of ExpressionTrees as its second argument - so I must cast
the resulting Tree object to ExpressionTree to make it compilable:

    TreeMaker maker = ...
    DeclaredType extendsType = ...
    TypeParameterTree typeParamTree
            = maker.TypeParameter("T",
                                  Collections.singletonList((ExpressionTree) maker.Type(extendsType)));
Comment 1 Rastislav Komara 2009-02-03 10:57:44 UTC
Overtake.