Re: Proposal: Add a type token class for representing generic types

2016-12-16 Thread David Holmes
Hi Gunnar, On 17/12/2016 2:18 AM, Gunnar Morling wrote: Hi, I'd like to suggest the addition of a type token class to the Java class library, to be used for representing generic types such as List. Sounds like something that falls within scope for the generic specialization work in Project

Re: Proposal: Add a type token class for representing generic types

2016-12-16 Thread Steven Schlansker
> On Dec 16, 2016, at 8:18 AM, Gunnar Morling <gun...@hibernate.org> wrote: > > Hi, > > I'd like to suggest the addition of a type token class to the Java > class library, to be used for representing generic types such as > List. I don't have much clout on this list

Proposal: Add a type token class for representing generic types

2016-12-16 Thread Gunnar Morling
Hi, I'd like to suggest the addition of a type token class to the Java class library, to be used for representing generic types such as List. Actual class literals can only represent raw types. But often libraries have the need to apply some sort of configuration to specific generic types, link

Re: Type of Class

2014-02-21 Thread David Holmes
name for this. Currently, you can determine if a class is an interface, annotation, primitive or array, leaving the normal case as a quadruple negative. This leaves such a user-written method vulnerable to any new type of class that gets added in a future JDK: boolean isNormalClass(Class cls

Re: Type of Class

2014-02-21 Thread Stephen Colebourne
On 21 February 2014 08:14, David Holmes david.hol...@oracle.com wrote: Would it be reasonable to add the following methods: - isNestedClass() This would be !isTopLevelClass() but otherwise isAnonymousClass() || isLocalClass() || isMemberClass() - isInnerClass() isAnonymousClass() ||

Re: Type of Class

2014-02-21 Thread Brian Goetz
I understand why you want this, though I think you’ll find that there are still thousands of other things “missing” from reflection. In the Java 1.0 days, the difference between the Java language and the class file was pretty small. So reflection served as both the class file (VM)

Re: Type of Class

2014-02-21 Thread Joe Darcy
On 02/21/2014 07:40 AM, Brian Goetz wrote: I understand why you want this, though I think you’ll find that there are still thousands of other things “missing” from reflection. In the Java 1.0 days, the difference between the Java language and the class file was pretty small. So reflection

Re: Type of Class

2014-02-21 Thread Stephen Colebourne
But is javax.lang.model a plan for JDK 9? To give some idea of the pain in this area, here is the code I ended up with: if (type.isInterface() || type.isAnnotation() || type.isPrimitive() || type.isArray() || type.isEnum() || type.isSynthetic() || Modifier.isAbstract(type.getModifiers()) ||

Type of Class

2014-02-20 Thread Stephen Colebourne
of an isNormalClass() - probably a better name for this. Currently, you can determine if a class is an interface, annotation, primitive or array, leaving the normal case as a quadruple negative. This leaves such a user-written method vulnerable to any new type of class that gets added in a future