Skip to content
Browse files

HHH-7514 - Upgrade to Jandex 1.1

  • Loading branch information...
1 parent 4282e23 commit fd8a45b2b246df9343adf2ec0df9acc298f69704 @sebersole sebersole committed Aug 22, 2012
View
1 build.gradle
@@ -1,6 +1,7 @@
apply plugin: 'eclipse'
apply plugin: 'idea'
apply from: "./libraries.gradle"
+
allprojects {
repositories {
mavenCentral()
View
27 hibernate-core/hibernate-core.gradle
@@ -56,19 +56,20 @@ idea {
task jaxb {
ext {
- // output directory
- jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
-
- // input schemas
- cfgXsd = file( 'src/main/resources/org/hibernate/hibernate-configuration-4.0.xsd')
- hbmXsd = file( 'src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd' )
- ormXsd = file( 'src/main/resources/org/hibernate/ejb/orm_2_0.xsd' )
-
- // input bindings
- cfgXjb = file( 'src/main/xjb/hbm-configuration-bindings.xjb' )
- hbmXjb = file( 'src/main/xjb/hbm-mapping-bindings.xjb' )
- ormXjb = file( 'src/main/xjb/orm-bindings.xjb' )
-}
+ // output directory
+ jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
+
+ // input schemas
+ cfgXsd = file( 'src/main/resources/org/hibernate/hibernate-configuration-4.0.xsd')
+ hbmXsd = file( 'src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd' )
+ ormXsd = file( 'src/main/resources/org/hibernate/ejb/orm_2_0.xsd' )
+
+ // input bindings
+ cfgXjb = file( 'src/main/xjb/hbm-configuration-bindings.xjb' )
+ hbmXjb = file( 'src/main/xjb/hbm-mapping-bindings.xjb' )
+ ormXjb = file( 'src/main/xjb/orm-bindings.xjb' )
+ }
+
// configure Gradle up-to-date checking
inputs.files( [cfgXsd, hbmXsd, ormXsd, cfgXjb, hbmXjb, ormXjb] )
outputs.dir( jaxbTargetDir )
View
186 hibernate-core/src/main/java/org/jboss/jandex/CompositeIndex.java
@@ -1,186 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2012, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.jboss.jandex;
-
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Aggregates information from multiple {@link Index} instances.
- *
- * @author John Bailey
- * @author Steve Ebersole
- */
-public class CompositeIndex implements IndexResult {
- private final List<Index> indexes;
-
- public CompositeIndex(Index... indexes) {
- this( Arrays.asList( indexes ) );
- }
-
- public CompositeIndex(List<Index> indexes) {
- this.indexes = indexes;
- }
-
- @Override
- public Collection<AnnotationInstance> getAnnotations(DotName annotationName) {
- final Set<AnnotationInstance> allInstances = new HashSet<AnnotationInstance>();
- for (Index index : indexes) {
- copy( index.getAnnotations( annotationName ), allInstances );
- }
- return Collections.unmodifiableSet( allInstances );
- }
-
- private <T> void copy(Collection<T> source, Collection<T> target) {
- if ( source != null ) {
- target.addAll( source );
- }
- }
-
- @Override
- public Collection<ClassInfo> getKnownClasses() {
- final List<ClassInfo> allKnown = new ArrayList<ClassInfo>();
- for ( Index index : indexes ) {
- copy( index.getKnownClasses(), allKnown );
- }
- return Collections.unmodifiableCollection( allKnown );
- }
-
- @Override
- public ClassInfo getClassByName(DotName className) {
- for ( Index index : indexes ) {
- final ClassInfo info = index.getClassByName( className );
- if ( info != null ) {
- return info;
- }
- }
- return null;
- }
-
- @Override
- public Collection<ClassInfo> getKnownDirectSubclasses(DotName className) {
- final Set<ClassInfo> allKnown = new HashSet<ClassInfo>();
- for ( Index index : indexes ) {
- copy( index.getKnownDirectSubclasses( className ), allKnown );
- }
- return Collections.unmodifiableSet( allKnown );
- }
-
- @Override
- public Set<ClassInfo> getAllKnownSubclasses(final DotName className) {
- final Set<ClassInfo> allKnown = new HashSet<ClassInfo>();
- final Set<DotName> processedClasses = new HashSet<DotName>();
- getAllKnownSubClasses(className, allKnown, processedClasses);
- return allKnown;
- }
-
- private void getAllKnownSubClasses(DotName className, Set<ClassInfo> allKnown, Set<DotName> processedClasses) {
- final Set<DotName> subClassesToProcess = new HashSet<DotName>();
- subClassesToProcess.add(className);
- while (!subClassesToProcess.isEmpty()) {
- final Iterator<DotName> toProcess = subClassesToProcess.iterator();
- DotName name = toProcess.next();
- toProcess.remove();
- processedClasses.add(name);
- getAllKnownSubClasses(name, allKnown, subClassesToProcess, processedClasses);
- }
- }
-
- private void getAllKnownSubClasses(
- DotName name,
- Set<ClassInfo> allKnown,
- Set<DotName> subClassesToProcess,
- Set<DotName> processedClasses) {
- for ( Index index : indexes ) {
- final Collection<ClassInfo> list = index.getKnownDirectSubclasses( name );
- if ( list != null ) {
- for ( final ClassInfo clazz : list ) {
- final DotName className = clazz.name();
- if ( !processedClasses.contains( className ) ) {
- allKnown.add( clazz );
- subClassesToProcess.add( className );
- }
- }
- }
- }
- }
-
- @Override
- public Collection<ClassInfo> getKnownDirectImplementors(DotName className) {
- final Set<ClassInfo> allKnown = new HashSet<ClassInfo>();
- for ( Index index : indexes ) {
- copy( index.getKnownDirectImplementors( className ), allKnown );
- }
- return Collections.unmodifiableSet(allKnown); }
-
- @Override
- public Collection<ClassInfo> getAllKnownImplementors(DotName interfaceName) {
- final Set<ClassInfo> allKnown = new HashSet<ClassInfo>();
- final Set<DotName> subInterfacesToProcess = new HashSet<DotName>();
- final Set<DotName> processedClasses = new HashSet<DotName>();
- subInterfacesToProcess.add( interfaceName );
- while ( !subInterfacesToProcess.isEmpty() ) {
- final Iterator<DotName> toProcess = subInterfacesToProcess.iterator();
- DotName name = toProcess.next();
- toProcess.remove();
- processedClasses.add( name );
- getKnownImplementors( name, allKnown, subInterfacesToProcess, processedClasses );
- }
- return allKnown;
- }
-
- private void getKnownImplementors(
- DotName name,
- Set<ClassInfo> allKnown,
- Set<DotName> subInterfacesToProcess,
- Set<DotName> processedClasses) {
- for (Index index : indexes) {
- final List<ClassInfo> list = index.getKnownDirectImplementors(name);
- if (list != null) {
- for (final ClassInfo clazz : list) {
- final DotName className = clazz.name();
- if (!processedClasses.contains(className)) {
- if ( Modifier.isInterface( clazz.flags() )) {
- subInterfacesToProcess.add(className);
- }
- else {
- if (!allKnown.contains(clazz)) {
- allKnown.add(clazz);
- processedClasses.add(className);
- getAllKnownSubClasses(className, allKnown, processedClasses);
- }
- }
- }
- }
- }
- }
- }
-}
View
56 hibernate-core/src/main/java/org/jboss/jandex/IndexResult.java
@@ -1,56 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2012, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.jboss.jandex;
-
-import java.util.Collection;
-
-/**
- * The basic contract for accessing Jandex indexed information.
- *
- * @author Jason Greene
- * @author Steve Ebersole
- */
-public interface IndexResult {
- public Collection<ClassInfo> getKnownClasses();
-
- public ClassInfo getClassByName(DotName className);
-
- public Collection<ClassInfo> getKnownDirectSubclasses(DotName className);
-
- /**
- * Returns all known (including non-direct) sub classes of the given class. I.e., returns all known classes
- * that are assignable to the given class.
- *
- * @param className The class
- *
- * @return All known subclasses
- */
- public Collection<ClassInfo> getAllKnownSubclasses(final DotName className);
-
- public Collection<ClassInfo> getKnownDirectImplementors(DotName className);
-
- public Collection<ClassInfo> getAllKnownImplementors(final DotName interfaceName);
-
- public Collection<AnnotationInstance> getAnnotations(DotName annotationName);
-}
View
12 ...anager/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java
@@ -56,7 +56,7 @@
import org.jboss.jandex.CompositeIndex;
import org.jboss.jandex.DotName;
import org.jboss.jandex.Index;
-import org.jboss.jandex.IndexResult;
+import org.jboss.jandex.IndexView;
import org.jboss.jandex.Indexer;
import org.jboss.logging.Logger;
@@ -183,7 +183,7 @@ public EntityManagerFactoryBuilderImpl(PersistenceUnitDescriptor persistenceUnit
ScanResult scanResult = scan( bootstrapServiceRegistry );
// 2) building a Jandex index
Set<String> collectedManagedClassNames = collectManagedClassNames( scanResult );
- IndexResult jandexIndex = locateOrBuildJandexIndex( collectedManagedClassNames, scanResult.getPackageNames(), bootstrapServiceRegistry );
+ IndexView jandexIndex = locateOrBuildJandexIndex( collectedManagedClassNames, scanResult.getPackageNames(), bootstrapServiceRegistry );
// 3) building "metadata sources" to keep for later to use in building the SessionFactory
metadataSources = prepareMetadataSources( jandexIndex, collectedManagedClassNames, scanResult, bootstrapServiceRegistry );
@@ -210,7 +210,7 @@ public Configuration getHibernateConfiguration() {
@SuppressWarnings("unchecked")
private MetadataSources prepareMetadataSources(
- IndexResult jandexIndex,
+ IndexView jandexIndex,
Set<String> collectedManagedClassNames,
ScanResult scanResult,
BootstrapServiceRegistry bootstrapServiceRegistry) {
@@ -270,7 +270,7 @@ private MetadataSources prepareMetadataSources(
return collectedNames;
}
- private IndexResult locateOrBuildJandexIndex(
+ private IndexView locateOrBuildJandexIndex(
Set<String> collectedManagedClassNames,
List<String> packageNames,
BootstrapServiceRegistry bootstrapServiceRegistry) {
@@ -279,14 +279,14 @@ private IndexResult locateOrBuildJandexIndex(
// 2) pass that Index along to the metamodel code...
//
// (1) is mocked up here, but JBoss AS does not currently pass in any Index to use...
- IndexResult jandexIndex = (IndexResult) configurationValues.get( JANDEX_INDEX );
+ IndexView jandexIndex = (IndexView) configurationValues.get( JANDEX_INDEX );
if ( jandexIndex == null ) {
jandexIndex = buildJandexIndex( collectedManagedClassNames, packageNames, bootstrapServiceRegistry );
}
return jandexIndex;
}
- private IndexResult buildJandexIndex(Set<String> classNamesSource, List<String> packageNames, BootstrapServiceRegistry bootstrapServiceRegistry) {
+ private IndexView buildJandexIndex(Set<String> classNamesSource, List<String> packageNames, BootstrapServiceRegistry bootstrapServiceRegistry) {
Indexer indexer = new Indexer();
for ( String className : classNamesSource ) {
View
182 libraries.gradle
@@ -1,84 +1,108 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+
// build a map of the dependency artifacts to use. Allows centralized definition of the version of artifacts to
// use. In that respect it serves a role similar to <dependencyManagement> in Maven
ext {
-slf4jVersion = '1.6.1'
-junitVersion = '4.10'
-h2Version = '1.2.145'
-bytemanVersion = '1.5.2'
-infinispanVersion = '5.1.6.FINAL'
-jnpVersion = '5.0.6.CR1'
-
-libraries = [
- // Ant
- ant: 'org.apache.ant:ant:1.8.2',
-
- // Antlr
- antlr: 'antlr:antlr:2.7.7',
-
- // Annotations
- commons_annotations:
- 'org.hibernate.common:hibernate-commons-annotations:4.0.1.Final@jar',
- jandex: 'org.jboss:jandex:1.0.3.Final',
- classmate: 'com.fasterxml:classmate:0.5.4',
-
- // Dom4J
- dom4j: 'dom4j:dom4j:1.6.1@jar',
-
- // Javassist
- javassist: 'org.javassist:javassist:3.15.0-GA',
-
- // javax
- jpa: 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Draft-7plus',
- jta: 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.0.Final',
- validation: 'javax.validation:validation-api:1.0.0.GA',
- jacc: 'org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:1.0.0.Final',
-
- // logging
- logging: 'org.jboss.logging:jboss-logging:3.1.0.GA',
- logging_processor: 'org.jboss.logging:jboss-logging-processor:1.0.0.Final',
-
- // jaxb task
- jaxb: 'com.sun.xml.bind:jaxb-xjc:2.1.6',
- jaxb2_basics: 'org.jvnet.jaxb2_commons:jaxb2-basics:0.6.0',
- jaxb2_ant: 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.0',
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~ testing
-
- // logging for testing
- slf4j_api: "org.slf4j:slf4j-api:${slf4jVersion}",
- slf4j_log4j12: "org.slf4j:slf4j-log4j12:${slf4jVersion}",
- jcl_slf4j: "org.slf4j:jcl-over-slf4j:${slf4jVersion}",
- jcl_api: 'commons-logging:commons-logging-api:99.0-does-not-exist',
- jcl: 'commons-logging:commons-logging:99.0-does-not-exist',
-
-
- junit: "junit:junit:${junitVersion}",
- byteman: "org.jboss.byteman:byteman:${bytemanVersion}",
- byteman_install: "org.jboss.byteman:byteman-install:${bytemanVersion}",
- byteman_bmunit: "org.jboss.byteman:byteman-bmunit:${bytemanVersion}",
- jpa_modelgen: 'org.hibernate:hibernate-jpamodelgen:1.1.1.Final',
- shrinkwrap_api: 'org.jboss.shrinkwrap:shrinkwrap-api:1.0.0-beta-6',
- shrinkwrap: 'org.jboss.shrinkwrap:shrinkwrap-impl-base:1.0.0-beta-6',
- validator: 'org.hibernate:hibernate-validator:4.2.0.Final',
- h2: "com.h2database:h2:${h2Version}",
- jboss_jta: "org.jboss.jbossts:jbossjta:4.16.4.Final",
- xapool: "com.experlog:xapool:1.5.0",
- mockito: 'org.mockito:mockito-core:1.9.0',
-
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ infinsipan
- infinispan: "org.infinispan:infinispan-core:${infinispanVersion}",
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ infinispan test
- infinispan_test: "org.infinispan:infinispan-core:${infinispanVersion}:tests@jar",
- rhq: "org.rhq.helpers:rhq-pluginAnnotations:3.0.4",
- jboss_common_core: "org.jboss:jboss-common-core:2.2.16.GA@jar",
- jnp_client: "org.jboss.naming:jnp-client:${jnpVersion}",
- jnp_server: "org.jboss.naming:jnpserver:${jnpVersion}",
-
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ c3p0
- c3p0: "c3p0:c3p0:0.9.1",
- ehcache: "net.sf.ehcache:ehcache-core:2.4.3",
- proxool: "proxool:proxool:0.8.3",
-
-
- ]
+
+ slf4jVersion = '1.6.1'
+ junitVersion = '4.10'
+ h2Version = '1.2.145'
+ bytemanVersion = '1.5.2'
+ infinispanVersion = '5.1.6.FINAL'
+ jnpVersion = '5.0.6.CR1'
+
+ libraries = [
+ // Ant
+ ant: 'org.apache.ant:ant:1.8.2',
+
+ // Antlr
+ antlr: 'antlr:antlr:2.7.7',
+
+ // Annotations
+ commons_annotations:
+ 'org.hibernate.common:hibernate-commons-annotations:4.0.1.Final@jar',
+ jandex: 'org.jboss:jandex:1.1.0.Alpha1',
+ classmate: 'com.fasterxml:classmate:0.5.4',
+
+ // Dom4J
+ dom4j: 'dom4j:dom4j:1.6.1@jar',
+
+ // Javassist
+ javassist: 'org.javassist:javassist:3.15.0-GA',
+
+ // javax
+ jpa: 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Draft-7plus',
+ jta: 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.0.Final',
+ validation: 'javax.validation:validation-api:1.0.0.GA',
+ jacc: 'org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:1.0.0.Final',
+
+ // logging
+ logging: 'org.jboss.logging:jboss-logging:3.1.0.GA',
+ logging_processor: 'org.jboss.logging:jboss-logging-processor:1.0.0.Final',
+
+ // jaxb task
+ jaxb: 'com.sun.xml.bind:jaxb-xjc:2.1.6',
+ jaxb2_basics: 'org.jvnet.jaxb2_commons:jaxb2-basics:0.6.0',
+ jaxb2_ant: 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.0',
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~ testing
+
+ // logging for testing
+ slf4j_api: "org.slf4j:slf4j-api:${slf4jVersion}",
+ slf4j_log4j12: "org.slf4j:slf4j-log4j12:${slf4jVersion}",
+ jcl_slf4j: "org.slf4j:jcl-over-slf4j:${slf4jVersion}",
+ jcl_api: 'commons-logging:commons-logging-api:99.0-does-not-exist',
+ jcl: 'commons-logging:commons-logging:99.0-does-not-exist',
+
+
+ junit: "junit:junit:${junitVersion}",
+ byteman: "org.jboss.byteman:byteman:${bytemanVersion}",
+ byteman_install: "org.jboss.byteman:byteman-install:${bytemanVersion}",
+ byteman_bmunit: "org.jboss.byteman:byteman-bmunit:${bytemanVersion}",
+ jpa_modelgen: 'org.hibernate:hibernate-jpamodelgen:1.1.1.Final',
+ shrinkwrap_api: 'org.jboss.shrinkwrap:shrinkwrap-api:1.0.0-beta-6',
+ shrinkwrap: 'org.jboss.shrinkwrap:shrinkwrap-impl-base:1.0.0-beta-6',
+ validator: 'org.hibernate:hibernate-validator:4.2.0.Final',
+ h2: "com.h2database:h2:${h2Version}",
+ jboss_jta: "org.jboss.jbossts:jbossjta:4.16.4.Final",
+ xapool: "com.experlog:xapool:1.5.0",
+ mockito: 'org.mockito:mockito-core:1.9.0',
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ infinsipan
+ infinispan: "org.infinispan:infinispan-core:${infinispanVersion}",
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ infinispan test
+ infinispan_test: "org.infinispan:infinispan-core:${infinispanVersion}:tests@jar",
+ rhq: "org.rhq.helpers:rhq-pluginAnnotations:3.0.4",
+ jboss_common_core: "org.jboss:jboss-common-core:2.2.16.GA@jar",
+ jnp_client: "org.jboss.naming:jnp-client:${jnpVersion}",
+ jnp_server: "org.jboss.naming:jnpserver:${jnpVersion}",
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ c3p0
+ c3p0: "c3p0:c3p0:0.9.1",
+ ehcache: "net.sf.ehcache:ehcache-core:2.4.3",
+ proxool: "proxool:proxool:0.8.3",
+
+ ]
}

0 comments on commit fd8a45b

Please sign in to comment.
Something went wrong with that request. Please try again.