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 96336 - Provide method for resolving parameterized ElementHandle
Summary: Provide method for resolving parameterized ElementHandle
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Rastislav Komara
Depends on:
Reported: 2007-02-22 16:55 UTC by Martin Adamek
Modified: 2009-02-03 10:57 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Martin Adamek 2007-02-22 16:55:28 UTC
Please consider providing method similar to ElementHandle.asTyped in following
example on line 4. 

 1| public static ElementHandle<TypeElement> getTypeElementHandle() {
 2|   ElementHandle<? extends Element> elementHandle = getElementHandle();
 3|   if (ElementKind.CLASS == elementHandle.getKind()) {
 4|     return elementHandle.asTyped(TypeElement.class);
 5|   }
 6|   return null;
 7| }

It would be useful for API user to get parameterized TypeElement without
unchecked cast, which is now only option. I have to use this unchecked cast on
line 4:
return (ElementHandle<TypeElement>) elementHandle;
Comment 1 Rastislav Komara 2009-02-03 10:57:38 UTC