]
George Gastaldi closed ROASTER-32.
----------------------------------
Assignee: George Gastaldi
Fix Version/s: 2.7.2.Final
Resolution: Done
Good catch! Fixed
MethodSource.addParameter(Class<?>, String) should support
primitive types
--------------------------------------------------------------------------
Key: ROASTER-32
URL:
https://issues.jboss.org/browse/ROASTER-32
Project: Roaster
Issue Type: Bug
Reporter: Jeremie Bresson
Assignee: George Gastaldi
Fix For: 2.7.2.Final
In my opinion passing {{Integer.TYPE}} as first argument in
{{MethodSource.addParameter(Class<?>, String)}} should be valid:
Example:
{code:java}
source.addMethod().setPublic().setName("doSomething").setReturnType(Integer.TYPE).setBody("return
0;").addParameter(Integer.TYPE, "initValue");
{code}
For the moment (version 2.7.1.Final) I get this stacktrace:
{quote}
Exception in thread "main" java.lang.IllegalArgumentException: Cannot import
class without a package [int]
at
org.jboss.forge.roaster.model.impl.AbstractJavaSource.addImport(AbstractJavaSource.java:171)
at org.jboss.forge.roaster.model.impl.MethodImpl.addParameter(MethodImpl.java:671)
at org.jboss.forge.roaster.model.impl.MethodImpl.addParameter(MethodImpl.java:658)
{quote}