2014-12-01 21:24 GMT+01:00 Hardy Ferentschik <hardy(a)hibernate.org>:
Hi,
I think this email of Jason is worth forwarding to hibernate-dev.
Jandex 2 sounds really interesting for all Hibernate projects. To a
certain degree Jandex offers now
a lot of the things Steve tried to do with the reflight stuff. I am not
sure whether Jandex can completely
replace it, but t can be for sure of help. Especially interesting to me is
the fully resolved type information.
In Search we have been talking for a long time to get rid of Commons
Annotations. It is basically already possible
now (using Jandex 1), but it got pushed back so far. Now with Jandex 2 we
definitely should make the switch. Maybe Search 5.1?
Out of interest, what would be the benefit for Search?
Last but not least Validator, there we have been talking about Jandex for
a while as well. The new version would not have
the benefit of being able to remove the dependency to classmate.
I guess you mean it *would have* the benefit, right?
Of course that comes at the price of adding another dependency, so that's
not really an advantage per se for me :)
I think we should have a look at this Beta and provide feedback to Jason if
we find any problems. I am for sure to have a look
at it in the context of Validator.
I find being able to re-use the index generated by the application
container very useful. It would give a nice performance boost out of the
box when using HV on WildFly/EAP.
The type annotation stuff may be useful, but it's not that this information
cannot be accessed via reflection at all. There are known issues with
corner cases, though. So Jandex may improve the situation for us.
Are there other advantages you expect from a HV perspective?
I'm asking to make sure we're on the same page regarding what we expect
from using Jandex in terms of user-visible features/improvements.
--Hardy
----- Forwarded message from Jason Greene -----
I normally don’t spam you guys with Beta announcements, but since many of
you are using Jandex, and this release has significant changes, in
particular additional APIs, I wanted to make sure there was an opportunity
for feedback before going final.
For those unfamiliar with Jandex, it was originally created as an
efficient bytecode based annotation indexer for AS7, but over time has
evolved to also act as a reflection library that does not require
class-loading nor complete linkage (you can analyze partial class graphs).
For those interested in playing with runtime Java 8 Type annotations,
which will likely end up in EE8 APIs, this release will likely be quite
useful to you, since standard Java reflection does not currently expose
this data.
A brief guide for using Jandex is located here:
https://github.com/wildfly/jandex
Full notes are below.
Thanks!
Jandex 2.0
—————
- Binary and Source Compatibility
All previous code *using* Jandex 1.1 should compile and run against 2.0.
However, any code that extended “closed" contracts (e.g.
AnnotationTarget)
will require updating.
- Offline reflective APIs and improvements
All methods and fields, whether annotated or not are all accessible, and
supporting APIs were created to enable access to the information.
Generics information is provided in a familiar pattern similar to Java
reflection but with usability improvements. Type information is fully
resolved.
Method and field access now supports binary searchable. Annotations are
categorized and filtered at various levels.
All need to cast has been eliminated from the framework.
- Implemented offline index persistence
The format is radically different to support the storage of
generics, type annotations, and the aggressive interning used to
reduce memory usage. Monster deployment (713MB of class data)
only requires 26MB of storage. JDK, which has 128MB of class data is
requires only 4.8 MB. Compressing the indexes by including them in a jar
reduces the capacity even further to about 14MB and 2.6 MB respectively.
Loading time is extremely efficient, at 1 second to load the 26MB
index for the monster deployment.
A portability layer is provided to convert the pervious
offline index formats into the new internal model.
- Full Java 8 type annotation support
Java 8 type annotations all you to use annotations almost anywhere.
For example, the following is now allowed:
@A Map<@B Comparable<@F Object @C [] @D [] @E []>, @G List <@H D>>
b;
@H O1.@E O2<@F S, @G T>.@D O3.@A Nested<@B U, @C V> bar6;
A new set of APIs were developed to represent all of this information in
a useful way to the developer
- Detailed class nesting information available
CDI needed a way to determine the enclosing class information for
all types of inner classes. This is all calculated and presented via
a few easy methods
- Memory optimization work
The overhead required to store all offline reflection
info + generics is significant. Implemented a variety of graph
reduction strategies.
End results of a monster deployment containing 713MB of class data
(> 100k classes > 1 million methods) = 120MB of memory usage. The
JDK has 128MB of class data, which Jandex uses
only 20MB of heap to store.
--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat
----- End forwarded message -----
----- End forwarded message -----
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev