Skip to main content

javaRuntype: runtime type system for Java

2 replies [Last post]
dfernandez
Offline
Joined: 2007-01-30

javaRuntype 1.0 has just been released.

javaRuntype is a compact library aimed at offering a runtime representation of the Java type system.

This is specially useful in metadata-based systems.

This becomes useful because, on the one hand, Java's java.util.Class objects cannot contain generics information (a "List" object at compile time becomes just "List" at runtime) , and on the other, the java.lang.reflect.Type interface and its related hierarchies, which the JVM uses for defining attributes and method signatures, are second-level citizens in the API, and lack an easy-to-use framework to truly enable the use of types as metadata in Java applications.

See more at: http://www.javaruntype.org

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
peter__lawrey
Offline
Joined: 2005-11-01

Would this be compatible with Java 7's new Type system?

dfernandez
Offline
Joined: 2007-01-30

> Would this be compatible with Java 7's new Type
> system?

At first, and understanding that Java 7's features are still not clear, there is no reason why it shouldn't:

- First, it seems that the only new feature in Java 7 directly regarding the type system will be JSR 308 (annotations on types), and while this is something that (obviously) javaRuntype doesn't allow (yet), it will probably be possible to add in a future if needed.

- It seems that reification of generics will not be included in Java 7. And even if it were, it would depend on the specific implementation that would be included in the API whether this would render javaRuntype redundant or not. Most suggested implementations of this (including the "officially" requested one at http://bugs.sun.com/view_bug.do?bug_id=5098163) were defined as adding generics information to objects instantiated from generic classes, but not to define "types". This is, it would allow you to define that an object is a "List" object, but apparently not to obtain a "List" type object, which looks quite logical as this responsibility would be already covered by the java.lang.reflect.Type hierarchy (see javaRuntype's FAQ at http://www.javaruntype.org/faq.html for a comparison between javaRuntype and java.lang.reflect.Type)...

- And last... javaRuntype works with Java 1.5 or later. Java 7 only works with... Java 7 ;-)

Regards,
Daniel.