diverse-project / melange

The Melange Language Workbench
http://melange-lang.org
Eclipse Public License 1.0
28 stars 7 forks source link

Integer attribute in aspect generates a corrupted Adapter #21

Closed dvojtise closed 9 years ago

dvojtise commented 9 years ago

in my FsmClockAspect I have an attribute of type Integer

@Aspect(className=FSMClock)
class FSMClockAspect extends NamedElementAspect {
    public Integer numberOfTicks;

this generates a buggy FSMClockAdapter.java with integer in lowercase

 public integer getNumberOfTicks() {
    org.gemoc.sample.tfsm.k3dsa.aspect.FSMClockAspect.numberOfTicks(adaptee) ;
  }

  public void setNumberOfTicks(final integer numberOfTicks) {
    org.gemoc.sample.tfsm.k3dsa.aspect.FSMClockAspect.numberOfTicks(adaptee, numberOfTicks
    ) ;
  }

workaround use int intstead of Integer

fcoulon commented 9 years ago

This bug is probably located here:

def String getPrimitiveIfWrapType(String name) {
        val fqn = QualifiedName::create(name.split("\\."))

        if (#[
                "java.lang.Boolean", "java.lang.Byte",
                "java.lang.Double", "java.lang.Float",
                "java.lang.Integer", "java.lang.Long",
                "java.lang.Short"
            ].contains(fqn.toString))
            return fqn.lastSegment.toString.toLowerCase
        else return name
    }

( in JvmModelInferrerHelper.xtend )