From 568a16eefaf6c797b1df86d23d5e6c2cc6f8fb2c Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 7 May 2014 11:27:53 -0500 Subject: [PATCH] HHH-9113 - Support for building with Java 8 JDK --- build.gradle | 22 +++++++++++++++++-- .../registry/selector/spi/package-info.java | 2 +- .../internal/SessionFactoryImpl.java | 3 ++- .../source/spi/MetaAttributeContext.java | 3 ++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 7fa4ba63f4..f8bf8854b1 100644 --- a/build.gradle +++ b/build.gradle @@ -98,6 +98,19 @@ subprojects { subProject -> // minimize changes, at least for now (gradle uses 'build' by default).. buildDir = "target" + // disable Java 8's doclint (javadoc validation) tool + if ( JavaVersion.current().isJava8Compatible() ) { + tasks.withType(Javadoc) { + // i give up. For now we simply disable javadoc against Java 8 JDK... + // we also seem to be hitting http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6442982 + // java.lang.ClassCastException: com.sun.tools.javadoc.MethodDocImpl cannot be cast to com.sun.tools.javadoc.AnnotationTypeElementDocImpl + + enabled = false + + // ultimately we will still likely need to tweak the doclint settings + } + } + if ( subProject.name.startsWith( 'release' ) || subProject.name.startsWith( 'documentation' ) ) { return; } @@ -149,7 +162,7 @@ subprojects { subProject -> testRuntime( libraries.h2 ) jaxb( libraries.jaxb ){ - exclude group: "javax.xml.stream" + exclude group: 'javax.xml.stream' } jaxb( libraries.jaxb ) jaxb( libraries.jaxb2_basics ) @@ -157,7 +170,12 @@ subprojects { subProject -> jaxb( libraries.jaxb2_jaxb ) jaxb( libraries.jaxb2_jaxb_xjc ) - animalSniffer ( libraries.animal_sniffer ) + // we need to use asm 5 for java 8 parsing + animalSniffer( libraries.animal_sniffer ) { + exclude group: 'org.ow2.asm' + } + animalSniffer( 'org.ow2.asm:asm-all:5.0.2' ) { force=true } + javaApiSignature ( libraries.java16_signature ) } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java index ccad0b4e71..068554c634 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java @@ -1,4 +1,4 @@ /** - * Defines actual contract used for strategy selection : {@link StrategySelector}. + * SPI package for the {@link org.hibernate.boot.registry.selector.spi.StrategySelector} service. */ package org.hibernate.boot.registry.selector.spi; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 2a6b582e5d..4b4625efbe 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -41,6 +41,7 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import javax.naming.Reference; import javax.naming.StringRefAddr; @@ -203,7 +204,7 @@ public final class SessionFactoryImpl private final transient CurrentSessionContext currentSessionContext; private final transient SQLFunctionRegistry sqlFunctionRegistry; private final transient SessionFactoryObserverChain observer = new SessionFactoryObserverChain(); - private final transient ConcurrentHashMap entityNameResolvers = new ConcurrentHashMap(); + private final transient ConcurrentMap entityNameResolvers = new ConcurrentHashMap(); private final transient QueryPlanCache queryPlanCache; private final transient CacheImplementor cacheAccess; private transient boolean isClosed; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/spi/MetaAttributeContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/spi/MetaAttributeContext.java index 2f9fb8b4ed..0b15399f99 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/spi/MetaAttributeContext.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/spi/MetaAttributeContext.java @@ -26,6 +26,7 @@ package org.hibernate.metamodel.source.spi; import java.util.HashSet; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.hibernate.metamodel.spi.binding.MetaAttribute; @@ -34,7 +35,7 @@ import org.hibernate.metamodel.spi.binding.MetaAttribute; */ public class MetaAttributeContext { private final MetaAttributeContext parentContext; - private final ConcurrentHashMap metaAttributeMap = new ConcurrentHashMap(); + private final ConcurrentMap metaAttributeMap = new ConcurrentHashMap(); public MetaAttributeContext() { this( null );