[JBoss JIRA] (ROASTER-50) Roaster tries to add Generic Type Variable as a java import
by Yusuf Iskenderoglu (JIRA)
Yusuf Iskenderoglu created ROASTER-50:
-----------------------------------------
Summary: Roaster tries to add Generic Type Variable as a java import
Key: ROASTER-50
URL: https://issues.jboss.org/browse/ROASTER-50
Project: Roaster
Issue Type: Bug
Reporter: Yusuf Iskenderoglu
When you create a new Method with a Type variable, you cannot use it in a parameter, it crashes with:
{code}
Exception in thread "main" java.lang.IllegalArgumentException: Cannot import class without a package [T]
at org.jboss.forge.roaster.model.impl.AbstractJavaSource.addImport(AbstractJavaSource.java:172)
at org.jboss.forge.roaster.model.impl.MethodImpl.addParameter(MethodImpl.java:682)
at de.check24.finance.baufi.roast.main.Roast.parse(Roast.java:225)
{code}
This is due to AbstractJavaSource.requiresImport() not returning false for type variables.
Can you consider this for the next release, too?
Thanks!
Related To: ROASTER-48
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 5 months
[JBoss JIRA] (ROASTER-48) A generic parameterized Method is not possible. Class<T> gets reduced to Class, generic parameter name is not accepted
by Yusuf Iskenderoglu (JIRA)
[ https://issues.jboss.org/browse/ROASTER-48?page=com.atlassian.jira.plugin... ]
Yusuf Iskenderoglu commented on ROASTER-48:
-------------------------------------------
Maybe I should open a new Bug ticket for this.
> 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: Bug
> 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)
9 years, 5 months
[JBoss JIRA] (FORGEPLUGINS-153) Arquillian plugin - setup, missing hint of container name
by Shankar Menon (JIRA)
[ https://issues.jboss.org/browse/FORGEPLUGINS-153?page=com.atlassian.jira.... ]
Shankar Menon commented on FORGEPLUGINS-153:
--------------------------------------------
Works fine in Forge 1.4.4 Final.
> Arquillian plugin - setup, missing hint of container name
> ---------------------------------------------------------
>
> Key: FORGEPLUGINS-153
> URL: https://issues.jboss.org/browse/FORGEPLUGINS-153
> Project: Forge Plugins/Addons
> Issue Type: Bug
> Components: Arquillian Plugin
> Environment: JVM: Oracle 1.7.0_25
> OS: Ubuntu 13.04 64bit
> Arquillian plugin: 1.0.6.Final
> <plugin api-version="1.0.6.Final" name="org.arquillian.forge.arquillian-plugin" slot="1.0.0-SNAPSHOT-270daa6b-2354-40b1-8422-cd487588a50e"/>
> Reporter: Martin Basovnik
>
> Setting up of arquillian plugin is failing. There is no option of supported containers after key {{TAB}} is pressed for {{--containerName}}, but according to instructions [here|http://forge.jboss.org/docs/important_plugins/arquillian-testing.html], there should be. File [containers.json|https://github.com/forge/plugin-arquillian/blob/1.0.6.Fin...] exists but obviously is not used properly. When bad container name is typed, following exception is thrown:
> {noformat}
> ***ERROR*** Exception encountered: (type "set VERBOSE false" to disable stack traces)
> java.lang.RuntimeException: Container not recognized
> at org.jboss.forge.arquillian.ArquillianPlugin.installContainer(ArquillianPlugin.java:156)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at org.jboss.forge.shell.command.Execution.perform(Execution.java:160)
> at org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:109)
> at org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:47)
> at org.jboss.forge.shell.ShellImpl$ExecutorThread.run(ShellImpl.java:796)
> at org.jboss.forge.shell.ShellImpl.execute(ShellImpl.java:819)
> at org.jboss.forge.shell.ShellImpl.doShell(ShellImpl.java:609)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
> at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
> at org.jboss.forge.shell.ShellImpl$Proxy$_$$_WeldClientProxy.doShell(ShellImpl$Proxy$_$$_WeldClientProxy.java)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
> at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
> at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
> at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
> at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
> at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
> at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
> at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
> at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
> at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
> at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
> at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
> at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616)
> at org.jboss.forge.shell.Bootstrap$1.run(Bootstrap.java:186)
> at java.lang.Thread.run(Thread.java:724)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
9 years, 5 months
[JBoss JIRA] (ROASTER-48) A generic parameterized Method is not possible. Class<T> gets reduced to Class, generic parameter name is not accepted
by Yusuf Iskenderoglu (JIRA)
[ https://issues.jboss.org/browse/ROASTER-48?page=com.atlassian.jira.plugin... ]
Yusuf Iskenderoglu commented on ROASTER-48:
-------------------------------------------
it is also impossible to do something like
{code}
newMethod.addParameter("T", "t");
{code}
It then claims there is no imported type *T*
> 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: Bug
> 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)
9 years, 5 months
[JBoss JIRA] (ROASTER-48) A generic parameterized Method is not possible. Class<T> gets reduced to Class, generic parameter name is not accepted
by Yusuf Iskenderoglu (JIRA)
[ https://issues.jboss.org/browse/ROASTER-48?page=com.atlassian.jira.plugin... ]
Yusuf Iskenderoglu commented on ROASTER-48:
-------------------------------------------
Sorry, I accidentally categorized this as a "Feature Request", however actually it is a bug.
Because it is currently impossible to use a Type-Parameter as a method parameter type.
> 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: Bug
> 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)
9 years, 5 months
[JBoss JIRA] (ROASTER-48) A generic parameterized Method is not possible. Class<T> gets reduced to Class, generic parameter name is not accepted
by Yusuf Iskenderoglu (JIRA)
[ https://issues.jboss.org/browse/ROASTER-48?page=com.atlassian.jira.plugin... ]
Yusuf Iskenderoglu updated ROASTER-48:
--------------------------------------
Issue Type: Bug (was: Feature Request)
> 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: Bug
> 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)
9 years, 5 months