EnumType speed up in initEnumValues()
-------------------------------------
Key: HCANN-21
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HCANN-21
Project: Hibernate Commons Annotations
Issue Type: Patch
Affects Versions: 3.1.0.GA, 3.2.x
Environment: Hibernate 3.5.1, Sun JDK 1.6.0_18
Reporter: Ondrej Medek
Priority: Minor
Attachments: EnumType.java.patch
Hi,
I have simplified and sped up the method EnumType.initEnumValues(). See the attached
patch.
Tested on Sun JDK 1.6.0_18
Note 1: I do not know, why the author (Emmanuel Bernard?) has used reflection. Maybe the
method Class.getEnumConstants() in not implemented by other JREs (IBM, BEA) or he just
didn't know this method.?
Note: the method getEnumConstants() in SUN JRE does use the reflection to look for method
"values()", too, but it's results are cached, so the second call to the
getEnumConstants() is fast. And because the results are cached inside the Enum class
itself, it does not cause any memory leaks like HHH-4317.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira