The method you're after is TypeUtils.isAssignable. I'm interested in
fleshing out this library in future, keeping the focus on pure type
operations. I'd like to implement full type inference and type
capturing in line with the JLS as I've had a requirement for this in
the past. Do let me know if you have any comments or suggestions.
Cheers,
Mark
2009/1/30 Emmanuel Bernard <emmanuel(a)hibernate.org>:
all good.
On Jan 30, 2009, at 09:46, Mark Hobson wrote:
> Cool, I'll aim to create the project as soon as I get a free moment.
> Extra hands would be appreciated so I can't see a problem with giving
> you commit access. Copyright isn't an issue as I work for my own
> company :)
>
> I'll post the URL once it's up there. Likely to be after the weekend
> if that's alright?
>
> Cheers,
>
> Mark
>
> 2009/1/30 Emmanuel Bernard <emmanuel(a)hibernate.org>:
>>
>> That's fine, you can go host it on google-code under the ASL 2. That way
>> we
>> can use it as a source level or jar level dependency.
>>
>> It would be nice to get commit access so we can participate in enhancing
>> the
>> support coverage.
>>
>>
Jboss.org might have some benefits as a forge but the .org team is very
>> busy
>> at the moment, so creating a new project would be a bit low in priority.
>> Google code is quite nice and clean.
>>
>> BTW before dropping the code, make sure you have the copyright rights (if
>> you developed that for a company, you might have to ask them).
>>
>> Thanks!
>>
>> Emmanuel
>>
>> On Jan 30, 2009, at 05:04, Mark Hobson wrote:
>>
>>> ASL 2.0 is fine with me. I was thinking about hosting it somewhere
>>> like Google Code since there's a few open-source projects that I've
>>> seen which could benefit from it. Let me know, I can create a project
>>> and you can give it a spin.
>>>
>>> Cheers,
>>>
>>> Mark
>>>
>>> 2009/1/30 Emmanuel Bernard <emmanuel(a)hibernate.org>:
>>>>
>>>> Cool, that's already a nice start.
>>>> Let me see if I find something.
>>>>
>>>> Would you be OK to contribute it under the ASL 2.0 license to us?
>>>>
>>>> On Jan 29, 2009, at 09:44, Mark Hobson wrote:
>>>>
>>>>> 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(a)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(a)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(a)lists.jboss.org
>>>>>>>>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> hibernate-dev mailing list
>>>>>>>> hibernate-dev(a)lists.jboss.org
>>>>>>>>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>