[hibernate-dev] Do you know of any ASL 2 implementation of...

Mark Hobson markhobson at gmail.com
Thu Jan 29 09:44:11 EST 2009


I haven't gone into supporting type variables, hence I don't perform
type capturing or inference yet, although I would be interested in
adding this.  For an example of what is currently implemented, the
following are from the tests:

Number <: Integer
Object <: Integer
List <: List<Integer>
Collection<Integer> <: List<Integer>
Collection<Integer> <: ArrayList<Integer>
List<Integer> !<: Set<Integer>
List<Number> !<: List<Integer>
List<?> <: List<Integer>
List<? extends Number> <: List<Number>
List<? extends Number> <: List<Integer>
List<? extends Number> !<: List<Object>
List<? super Number> <: List<Number>
List<? super Number> <: List<Object>
List<? super Number> !<: List<Integer>
List<Integer> <: IntegerArrayList

Let me know if you find any existing libraries since I use this in my
other projects.  If there's nothing out there then open-sourcing this
would stop people from having to reinvent the wheel.

Cheers,

Mark

2009/1/29 Emmanuel Bernard <emmanuel at hibernate.org>:
> If I can't find an other alternative that would surely be of help yes :)
>
> Do you know how much of the subtype rules you have implemented?
>
> The one that sounded non trivial to me were around detecting that generic
> are supertypes of others:
>  - containment and equivalence
>  - capture conversion
>  - intersection types
>  - management of bounds
> (using the language of the JSL)
>
>
> On  Jan 29, 2009, at 05:49, Mark Hobson wrote:
>
>> I've written a small utility library that provides methods to work
>> with Types, specifically it contains such a method isAssignable(Type
>> supertype, Type type) that should satisfy your requirements.
>>
>> I've been considering open-sourcing it so would be happy to do so if
>> you were interested?
>>
>> Cheers,
>>
>> Mark
>>
>> 2009/1/29 Emmanuel Bernard <emmanuel at hibernate.org>:
>>>
>>> Specifically a routine like
>>> boolean isSuperType(Type super, Type, sub);
>>> note Type, not Class<?>
>>>
>>> On  Jan 28, 2009, at 21:22, Emmanuel Bernard wrote:
>>>
>>>
>>> http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.10
>>>
>>> Subtyping
>>>
>>> I am looking for an ASL 2 / BSD implementation of the subtyping
>>> resolution
>>> algorithm in Java.
>>>
>>> I am thinking Harmony might have one.
>>>
>>> Anybody knows?
>>>
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>
>>>
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>
>>>
>
>



More information about the hibernate-dev mailing list