3 Replies Latest reply on Mar 11, 2013 5:52 PM by Thomas Frühbeck

    InvalidTypeException when using generic method in subclass

    Thomas Frühbeck Newbie

      Hi,

       

      I get the followin error when compiling:

       

      [ERROR] [INFO] org.jboss.errai.codegen.exception.InvalidTypeException: java.lang.Integer is not assignable from java.lang.Object

      [INFO] in method call: at.tfr.sakila.client.common.StaffReference.setKey([java.lang.Integer])

      [INFO]  at org.jboss.errai.codegen.util.GenUtil.assertAssignableTypes(GenUtil.java:165)

       

      Code looks simple:

       

      @Portable

      public class StaffReference extends EntityReference<Integer> {

       

         public StaffReference() {

         }

         @Override

         public Integer getKey() {

            return key;

         }

         @Override

         public void setKey(Integer key) {

            this.key = key;

         }

       

      @Portable

      public class EntityReference<K> implements Comparable<EntityReference<K>> {

       

         K key;

       

         public EntityReference() {

         }

       

         public K getKey() {

            return key;

         }

       

         public void setKey(K key) {

            this.key = key;

         }

       

      I tried to set  -Derrai.codegen.permissive=true for compiler, then I get:

       

      [INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.

      [INFO]    [ERROR] Errors in '/raid/home/thomas/aerogear-workspace/sakila/target/.generated/org/jboss/errai/marshalling/client/api/MarshallerFactoryImpl.java'

      [INFO]       [ERROR] Line 707:  The method setKey(Integer) in the type EntityReference<Integer> is not applicable for the arguments (Object)

      [INFO]       [ERROR] Line 971:  The method setKey(Integer) in the type EntityReference<Integer> is not applicable for the arguments (Object)

      [INFO]       [ERROR] Line 1096:  The method setKey(Integer) in the type EntityReference<Integer> is not applicable for the arguments (Object)

       

      Is it not possible to use generic properties?