Hide Forgot
Description of problem: In the following code, the javac in OpenJDK 1.6.0 gets a compilation error, when the Oracle JDK update 25 does not error on it. /home/andrig/Build/myforkedhibernate4/hibernate-core/hibernate-entitymanager/src/main/java/org/hibernate/ejb/criteria/path/AbstractPathImpl.java:197: invalid inferred types for M; inferred type does not conform to declared bound(s) inferred: java.util.Map<K,V> bound(s): java.util.Map<capture#981 of ?,capture#59 of ?> return (PluralAttributePath<Y>) get( (MapAttribute<X,?,?>) pluralAttribute ); ^ The above is the error from the build, and the code in question is line 197 in org.hibernate.ejb.criteria.path.AbstractPathImpl.java in the Entity Manager, and it looks like the following: return (PluralAttributePath<Y>) get( (MapAttribute<X,?,?>) pluralAttribute ); The larger methods looks as follows: /** * {@inheritDoc} */ @SuppressWarnings({ "unchecked" }) public <Y> Path<Y> get(String attributeName) { if ( ! canBeDereferenced() ) { throw illegalDereference(); } final Attribute attribute = locateAttribute( attributeName ); if ( attribute.isCollection() ) { final PluralAttribute<X,Y,?> pluralAttribute = (PluralAttribute<X,Y,?>) attribute; if ( PluralAttribute.CollectionType.MAP.equals( pluralAttribute.getCollectionType() ) ) { return (PluralAttributePath<Y>) get( (MapAttribute<X,?,?>) pluralAttribute ); } else { return (PluralAttributePath<Y>) get( (PluralAttribute) pluralAttribute ); } } else { return get( (SingularAttribute<X,Y>) attribute ); } } As you can see, the error has to do with compiling around the "generics" stuff. Version-Release number of selected component (if applicable): [andrig@worklaptop path]$ java -version java version "1.6.0_22" OpenJDK Runtime Environment (IcedTea6 1.10.2) (fedora-58.1.10.2.fc15-x86_64) OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode) How reproducible: Every time. Steps to Reproduce: 1.clone the Hibernate 4 Git repository. 2.run ./gradlew -x text clean build 3.See the error... Actual results: Compilation error shown above in the description. Expected results: Should compile cleanly as it does with Oracle JDK 1.6.0_25 Additional info:
FYI, this is fixed in OpenJDK7 btw and packages for it are available in Fedora 16 and rawhide (java-1.7.0-openjdk). I will try to find the specific issue and backport it once I am back from vacation the week after the next.
this issue has been workaround by the patch supplied in https://hibernate.onjira.com/browse/HHH-5789
(In reply to comment #1) > FYI, this is fixed in OpenJDK7 btw and packages for it are available in Fedora > 16 and rawhide (java-1.7.0-openjdk). > > I will try to find the specific issue and backport it once I am back from > vacation the week after the next. This has been fixed.
I tested this with building Hibernate 4 again, and all is well.