[
https://issues.jboss.org/browse/ROASTER-48?page=com.atlassian.jira.plugin...
]
Yusuf Iskenderoglu updated ROASTER-48:
--------------------------------------
Description:
What I need is something like this:
{code}
final MethodSource<JavaClassSource> newMethod =
to.addMethod()
.setName(name)
.setPublic()
.setFinal(true);
newMethod.addTypeVariable("T");
newMethod.setReturnType("T").setBody(localBody +
".as(((Class<T>) as));");
newMethod.addParameter(int.class, "index");
newMethod.addParameter("Class<T>",
"as");
{code}
However, roaster reduces *Class<T>* to *Class*. In that case, the method returns
only "Object", because the type information cannot be deduced anymore, causes
ugly Code on the caller side:
{code}
app().financing.desires(0, Foo.class).programNumber;
vs.
Foo k = (Foo) app().financing.desires(0, Foo.class);
k.programNumber
{code}
Further, a parameter with the name *T* is not accepted at all, even if its defined as a
type variable.
Would be very nice, if you could solve this issue :-)
was:
What I need is something like this:
{code}
final MethodSource<JavaClassSource> newMethod =
to.addMethod()
.setName(name)
.setPublic()
.setFinal(true);
newMethod.addTypeVariable("T");
newMethod.setReturnType("T").setBody(localBody +
".as(((Class<T>) as));");
newMethod.addParameter(int.class, "index");
newMethod.addParameter("Class<T>",
"as");
{code}
However, roaster reduces *Class<T>* to *Class*. In that case, the method returns
only "Object", because the type information cannot be deduced anymore, causes
ugly Code on the caller side:
{code}
app().financing.desires(0, Foo.class).programNumber);
vs.
Foo k = (Foo) app().financing.desires(0, Foo.class);
k.programNumber
{code}
Further, a parameter with the name *T* is not accepted at all, even if its defined as a
type variable.
Would be very nice, if you could solve this issue :-)
A generic parameterized Method is not possible. Class<T> gets
reduced to Class, generic parameter name is not accepted
----------------------------------------------------------------------------------------------------------------------
Key: ROASTER-48
URL:
https://issues.jboss.org/browse/ROASTER-48
Project: Roaster
Issue Type: Feature Request
Reporter: Yusuf Iskenderoglu
What I need is something like this:
{code}
final MethodSource<JavaClassSource> newMethod =
to.addMethod()
.setName(name)
.setPublic()
.setFinal(true);
newMethod.addTypeVariable("T");
newMethod.setReturnType("T").setBody(localBody
+ ".as(((Class<T>) as));");
newMethod.addParameter(int.class, "index");
newMethod.addParameter("Class<T>",
"as");
{code}
However, roaster reduces *Class<T>* to *Class*. In that case, the method returns
only "Object", because the type information cannot be deduced anymore, causes
ugly Code on the caller side:
{code}
app().financing.desires(0, Foo.class).programNumber;
vs.
Foo k = (Foo) app().financing.desires(0, Foo.class);
k.programNumber
{code}
Further, a parameter with the name *T* is not accepted at all, even if its defined as a
type variable.
Would be very nice, if you could solve this issue :-)
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)