Generics and abstract methods not properly supported in sofware model

software-model

(remo) #1

Hi

I’m using the model model api. It works well in general, but I have two issues:

  1. I have two abstract classes A and B. Both marked with @Managed. B extends A. And both implement some @Unmanaged method:

    @Managed
    public abstract class A{

     @Unmanaged
     public abstract Document toXml() ;
    

    }

    @Managed
    public abstract class B extends A{

     @Unmanaged
         @Override
     public Document toXml() {
     	// do something
     }
    

    }

This way it is not working. I need to implement toXml in A as well (for example just return null). Otherwise a stackoverflow happens.

  1. Generics are not working:

    public interface DataSourceModel {
    public ModelMap getBeans();
    }

Instead I have to use ModelMap as return type of the getBeans method.

My environment:
Gradle Version: 2.13
Operating System: Win10

Regards Remo


(Chris Doré) #2

I don’t think what you are trying to do is supported. From the @Managed javadoc:

Abstract classes

A managed type can be implemented as an abstract class. All property getters and setters must be declared abstract (with the exception of calculated read-only properties). The class cannot contain instance variables, constructors, or any methods that are not a getter or setter.

The key part being that all methods must be getters or setters. @Unmanaged is intended to be used with property getters.

Chris


(remo) #3

yes, I believe so as well. But it would be helpful if those two would be supported.


(Chris Doré) #4

OK, I misunderstood your question. I thought you wanted help making that work with the current implementation, not that you were making feature suggestions.