HHH-17778 rename JPAMetaModelEntityProcessor -> HibernateProcessor

This commit is contained in:
Gavin King 2024-03-01 21:49:38 +01:00
parent 1c46c0060f
commit 7636d78feb
18 changed files with 42 additions and 41 deletions

View File

@ -227,7 +227,7 @@ task generateEnversStaticMetamodel(
options.compilerArgs = [ options.compilerArgs = [
"-proc:only", "-proc:only",
"-processor", "-processor",
"org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor" "org.hibernate.jpamodelgen.HibernateProcessor"
] ]
// put static metamodel classes back out to the source tree since they're version controlled. // put static metamodel classes back out to the source tree since they're version controlled.

View File

@ -88,7 +88,7 @@
* *
* @Dependent * @Dependent
* @StaticMetamodel(BookRepository.class) * @StaticMetamodel(BookRepository.class)
* @Generated("org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor") * @Generated("org.hibernate.jpamodelgen.HibernateProcessor")
* public class BookRepository_ implements BookRepository { * public class BookRepository_ implements BookRepository {
* *
* *

View File

@ -177,7 +177,7 @@ public final class ClassWriter {
} }
generatedAnnotation generatedAnnotation
.append( "\"" ) .append( "\"" )
.append( JPAMetaModelEntityProcessor.class.getName() ) .append( HibernateProcessor.class.getName() )
.append( "\"" ); .append( "\"" );
if ( context.addGeneratedDate() ) { if ( context.addGeneratedDate() ) {
generatedAnnotation generatedAnnotation

View File

@ -103,7 +103,7 @@ public final class Context {
final Map<String, String> options = processingEnvironment.getOptions(); final Map<String, String> options = processingEnvironment.getOptions();
String persistenceXmlOption = options.get( JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION ); String persistenceXmlOption = options.get( HibernateProcessor.PERSISTENCE_XML_OPTION );
if ( persistenceXmlOption != null ) { if ( persistenceXmlOption != null ) {
if ( !persistenceXmlOption.startsWith("/") ) { if ( !persistenceXmlOption.startsWith("/") ) {
persistenceXmlOption = "/" + persistenceXmlOption; persistenceXmlOption = "/" + persistenceXmlOption;
@ -114,7 +114,7 @@ public final class Context {
persistenceXmlLocation = DEFAULT_PERSISTENCE_XML_LOCATION; persistenceXmlLocation = DEFAULT_PERSISTENCE_XML_LOCATION;
} }
String ormXmlOption = options.get( JPAMetaModelEntityProcessor.ORM_XML_OPTION ); String ormXmlOption = options.get( HibernateProcessor.ORM_XML_OPTION );
if ( ormXmlOption != null ) { if ( ormXmlOption != null ) {
ormXmlFiles = new ArrayList<>(); ormXmlFiles = new ArrayList<>();
for ( String ormFile : ormXmlOption.split( "," ) ) { for ( String ormFile : ormXmlOption.split( "," ) ) {
@ -128,8 +128,8 @@ public final class Context {
ormXmlFiles = emptyList(); ormXmlFiles = emptyList();
} }
lazyXmlParsing = parseBoolean( options.get( JPAMetaModelEntityProcessor.LAZY_XML_PARSING ) ); lazyXmlParsing = parseBoolean( options.get( HibernateProcessor.LAZY_XML_PARSING ) );
logDebug = parseBoolean( options.get( JPAMetaModelEntityProcessor.DEBUG_OPTION ) ); logDebug = parseBoolean( options.get( HibernateProcessor.DEBUG_OPTION ) );
} }
public ProcessingEnvironment getProcessingEnvironment() { public ProcessingEnvironment getProcessingEnvironment() {

View File

@ -35,15 +35,15 @@ import java.util.Set;
import static java.lang.Boolean.parseBoolean; import static java.lang.Boolean.parseBoolean;
import static javax.lang.model.util.ElementFilter.fieldsIn; import static javax.lang.model.util.ElementFilter.fieldsIn;
import static javax.lang.model.util.ElementFilter.methodsIn; import static javax.lang.model.util.ElementFilter.methodsIn;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.ADD_GENERATED_ANNOTATION; import static org.hibernate.jpamodelgen.HibernateProcessor.ADD_GENERATED_ANNOTATION;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.ADD_GENERATION_DATE; import static org.hibernate.jpamodelgen.HibernateProcessor.ADD_GENERATION_DATE;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.ADD_SUPPRESS_WARNINGS_ANNOTATION; import static org.hibernate.jpamodelgen.HibernateProcessor.ADD_SUPPRESS_WARNINGS_ANNOTATION;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.DEBUG_OPTION; import static org.hibernate.jpamodelgen.HibernateProcessor.DEBUG_OPTION;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.FULLY_ANNOTATION_CONFIGURED_OPTION; import static org.hibernate.jpamodelgen.HibernateProcessor.FULLY_ANNOTATION_CONFIGURED_OPTION;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.LAZY_XML_PARSING; import static org.hibernate.jpamodelgen.HibernateProcessor.LAZY_XML_PARSING;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.ORM_XML_OPTION; import static org.hibernate.jpamodelgen.HibernateProcessor.ORM_XML_OPTION;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION; import static org.hibernate.jpamodelgen.HibernateProcessor.PERSISTENCE_XML_OPTION;
import static org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.SUPPRESS_JAKARTA_DATA_METAMODEL; import static org.hibernate.jpamodelgen.HibernateProcessor.SUPPRESS_JAKARTA_DATA_METAMODEL;
import static org.hibernate.jpamodelgen.util.Constants.*; import static org.hibernate.jpamodelgen.util.Constants.*;
import static org.hibernate.jpamodelgen.util.TypeUtils.containsAnnotation; import static org.hibernate.jpamodelgen.util.TypeUtils.containsAnnotation;
import static org.hibernate.jpamodelgen.util.TypeUtils.getAnnotationMirror; import static org.hibernate.jpamodelgen.util.TypeUtils.getAnnotationMirror;
@ -82,7 +82,7 @@ import static org.hibernate.jpamodelgen.util.TypeUtils.isClassOrRecordType;
ADD_SUPPRESS_WARNINGS_ANNOTATION, ADD_SUPPRESS_WARNINGS_ANNOTATION,
SUPPRESS_JAKARTA_DATA_METAMODEL SUPPRESS_JAKARTA_DATA_METAMODEL
}) })
public class JPAMetaModelEntityProcessor extends AbstractProcessor { public class HibernateProcessor extends AbstractProcessor {
/** /**
* Debug logging from the processor * Debug logging from the processor

View File

@ -5,6 +5,7 @@
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
/** /**
* The main package of this annotation processor. The actual processor class is {@link JPAMetaModelEntityProcessor}. * The main package of this annotation processor.
* The actual processor class is {@link org.hibernate.jpamodelgen.HibernateProcessor}.
*/ */
package org.hibernate.jpamodelgen; package org.hibernate.jpamodelgen;

View File

@ -1 +1 @@
org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor,isolating org.hibernate.jpamodelgen.HibernateProcessor,isolating

View File

@ -10,4 +10,4 @@
# License: GNU Lesser General Public License (LGPL), version 2.1 or later. # License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. # See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
# #
org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor org.hibernate.jpamodelgen.HibernateProcessor

View File

@ -28,7 +28,7 @@ public class GeneratedAnnotationTest extends CompilationTest {
// need to check the source because @Generated is not a runtime annotation // need to check the source because @Generated is not a runtime annotation
String metaModelSource = getMetaModelSourceAsString( TestEntity.class ); String metaModelSource = getMetaModelSourceAsString( TestEntity.class );
String generatedString = "@Generated(\"org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor\")"; String generatedString = "@Generated(\"org.hibernate.jpamodelgen.HibernateProcessor\")";
assertTrue( "@Generated should be added to the metamodel.", metaModelSource.contains( generatedString ) ); assertTrue( "@Generated should be added to the metamodel.", metaModelSource.contains( generatedString ) );
} }
} }

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.generatedannotation; package org.hibernate.jpamodelgen.test.generatedannotation;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestForIssue; import org.hibernate.jpamodelgen.test.util.TestForIssue;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
@ -25,7 +25,7 @@ public class GenerationDateTest extends CompilationTest {
@Test @Test
@TestForIssue(jiraKey = "METAGEN-73") @TestForIssue(jiraKey = "METAGEN-73")
@WithClasses(TestEntity.class) @WithClasses(TestEntity.class)
@WithProcessorOption(key = JPAMetaModelEntityProcessor.ADD_GENERATION_DATE, value = "true") @WithProcessorOption(key = HibernateProcessor.ADD_GENERATION_DATE, value = "true")
public void testGeneratedAnnotationGenerated() { public void testGeneratedAnnotationGenerated() {
assertMetamodelClassGeneratedFor( TestEntity.class ); assertMetamodelClassGeneratedFor( TestEntity.class );
@ -33,7 +33,7 @@ public class GenerationDateTest extends CompilationTest {
String metaModelSource = getMetaModelSourceAsString( TestEntity.class ); String metaModelSource = getMetaModelSourceAsString( TestEntity.class );
dumpMetaModelSourceFor( TestEntity.class ); dumpMetaModelSourceFor( TestEntity.class );
String generatedString = "@Generated(value = \"org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor\", date = \""; String generatedString = "@Generated(value = \"org.hibernate.jpamodelgen.HibernateProcessor\", date = \"";
assertTrue( "@Generated should also contain the date parameter.", metaModelSource.contains( generatedString ) ); assertTrue( "@Generated should also contain the date parameter.", metaModelSource.contains( generatedString ) );
} }

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.generatedannotation; package org.hibernate.jpamodelgen.test.generatedannotation;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestForIssue; import org.hibernate.jpamodelgen.test.util.TestForIssue;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
@ -24,7 +24,7 @@ public class SkipGeneratedAnnotationTest extends CompilationTest {
@Test @Test
@TestForIssue(jiraKey = "METAGEN-79") @TestForIssue(jiraKey = "METAGEN-79")
@WithClasses(TestEntity.class) @WithClasses(TestEntity.class)
@WithProcessorOption(key = JPAMetaModelEntityProcessor.ADD_GENERATED_ANNOTATION, value = "false") @WithProcessorOption(key = HibernateProcessor.ADD_GENERATED_ANNOTATION, value = "false")
public void testGeneratedAnnotationGenerated() { public void testGeneratedAnnotationGenerated() {
assertMetamodelClassGeneratedFor( TestEntity.class ); assertMetamodelClassGeneratedFor( TestEntity.class );

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.persistence21; package org.hibernate.jpamodelgen.test.persistence21;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestForIssue; import org.hibernate.jpamodelgen.test.util.TestForIssue;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
@ -25,7 +25,7 @@ public class Jpa21DescriptorTest extends CompilationTest {
@Test @Test
@TestForIssue(jiraKey = "METAGEN-92") @TestForIssue(jiraKey = "METAGEN-92")
@WithClasses(Snafu.class) @WithClasses(Snafu.class)
@WithProcessorOption(key = JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION, @WithProcessorOption(key = HibernateProcessor.PERSISTENCE_XML_OPTION,
value = "org/hibernate/jpamodelgen/test/persistence21/persistence.xml") value = "org/hibernate/jpamodelgen/test/persistence21/persistence.xml")
public void testMetaModelGeneratedForXmlConfiguredEntity() { public void testMetaModelGeneratedForXmlConfiguredEntity() {
assertMetamodelClassGeneratedFor( Snafu.class ); assertMetamodelClassGeneratedFor( Snafu.class );

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.supresswarnings; package org.hibernate.jpamodelgen.test.supresswarnings;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestForIssue; import org.hibernate.jpamodelgen.test.util.TestForIssue;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
@ -24,7 +24,7 @@ public class SuppressWarningsAnnotationGeneratedTest extends CompilationTest {
@Test @Test
@TestForIssue(jiraKey = "METAGEN-50") @TestForIssue(jiraKey = "METAGEN-50")
@WithClasses(TestEntity.class) @WithClasses(TestEntity.class)
@WithProcessorOption(key = JPAMetaModelEntityProcessor.ADD_SUPPRESS_WARNINGS_ANNOTATION, value = "true") @WithProcessorOption(key = HibernateProcessor.ADD_SUPPRESS_WARNINGS_ANNOTATION, value = "true")
public void testSuppressedWarningsAnnotationGenerated() { public void testSuppressedWarningsAnnotationGenerated() {
assertMetamodelClassGeneratedFor( TestEntity.class ); assertMetamodelClassGeneratedFor( TestEntity.class );

View File

@ -17,7 +17,7 @@ import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager; import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider; import javax.tools.ToolProvider;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;
@ -115,13 +115,13 @@ public class CompilationStatement extends Statement {
options.add( "-d" ); options.add( "-d" );
options.add( TestUtil.getOutBaseDir( testClass ).getAbsolutePath() ); options.add( TestUtil.getOutBaseDir( testClass ).getAbsolutePath() );
options.add( "-processor" ); options.add( "-processor" );
options.add( JPAMetaModelEntityProcessor.class.getName() ); options.add( HibernateProcessor.class.getName() );
// pass orm files if specified // pass orm files if specified
if ( !xmlMappingFiles.isEmpty() ) { if ( !xmlMappingFiles.isEmpty() ) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append( ANNOTATION_PROCESSOR_OPTION_PREFIX ); builder.append( ANNOTATION_PROCESSOR_OPTION_PREFIX );
builder.append( JPAMetaModelEntityProcessor.ORM_XML_OPTION ); builder.append( HibernateProcessor.ORM_XML_OPTION );
builder.append( "=" ); builder.append( "=" );
for ( String ormFile : xmlMappingFiles ) { for ( String ormFile : xmlMappingFiles ) {
builder.append( ormFile ); builder.append( ormFile );

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.xmlmapped; package org.hibernate.jpamodelgen.test.xmlmapped;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestForIssue; import org.hibernate.jpamodelgen.test.util.TestForIssue;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
@ -31,7 +31,7 @@ import static org.hibernate.jpamodelgen.test.util.TestUtil.assertSuperClassRelat
Mammal.class, Mammal.class,
Superhero.class Superhero.class
}) })
@WithProcessorOption(key = JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION, @WithProcessorOption(key = HibernateProcessor.PERSISTENCE_XML_OPTION,
value = "org/hibernate/jpamodelgen/test/xmlmapped/persistence.xml") value = "org/hibernate/jpamodelgen/test/xmlmapped/persistence.xml")
public class XmlMappingTest extends CompilationTest { public class XmlMappingTest extends CompilationTest {
@Test @Test

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.xmlmetacomplete.multiplepus; package org.hibernate.jpamodelgen.test.xmlmetacomplete.multiplepus;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.TestForIssue; import org.hibernate.jpamodelgen.test.util.TestForIssue;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
@ -23,7 +23,7 @@ public class XmlMetaDataCompleteMultiplePersistenceUnitsTest extends Compilation
@Test @Test
@WithClasses(Dummy.class) @WithClasses(Dummy.class)
@WithProcessorOption(key = JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION, @WithProcessorOption(key = HibernateProcessor.PERSISTENCE_XML_OPTION,
value = "org/hibernate/jpamodelgen/test/xmlmetacomplete/multiplepus/persistence.xml") value = "org/hibernate/jpamodelgen/test/xmlmetacomplete/multiplepus/persistence.xml")
public void testMetaModelGenerated() { public void testMetaModelGenerated() {
// only one of the xml files in the example uses 'xml-mapping-metadata-complete', hence annotation processing // only one of the xml files in the example uses 'xml-mapping-metadata-complete', hence annotation processing

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.xmlmetacomplete.singlepu; package org.hibernate.jpamodelgen.test.xmlmetacomplete.singlepu;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
import org.hibernate.jpamodelgen.test.util.WithProcessorOption; import org.hibernate.jpamodelgen.test.util.WithProcessorOption;
@ -20,7 +20,7 @@ import static org.hibernate.jpamodelgen.test.util.TestUtil.assertNoSourceFileGen
public class XmlMetaDataCompleteSinglePersistenceUnitTest extends CompilationTest { public class XmlMetaDataCompleteSinglePersistenceUnitTest extends CompilationTest {
@Test @Test
@WithClasses(org.hibernate.jpamodelgen.test.xmlmetacomplete.multiplepus.Dummy.class) @WithClasses(org.hibernate.jpamodelgen.test.xmlmetacomplete.multiplepus.Dummy.class)
@WithProcessorOption(key = JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION, @WithProcessorOption(key = HibernateProcessor.PERSISTENCE_XML_OPTION,
value = "org/hibernate/jpamodelgen/test/xmlmetacomplete/singlepu/persistence.xml") value = "org/hibernate/jpamodelgen/test/xmlmetacomplete/singlepu/persistence.xml")
public void testNoMetaModelGenerated() { public void testNoMetaModelGenerated() {
// the xml mapping files used in the example say that the xml data is meta complete. For that // the xml mapping files used in the example say that the xml data is meta complete. For that

View File

@ -6,7 +6,7 @@
*/ */
package org.hibernate.jpamodelgen.test.xmlonly; package org.hibernate.jpamodelgen.test.xmlonly;
import org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor; import org.hibernate.jpamodelgen.HibernateProcessor;
import org.hibernate.jpamodelgen.test.util.CompilationTest; import org.hibernate.jpamodelgen.test.util.CompilationTest;
import org.hibernate.jpamodelgen.test.util.WithClasses; import org.hibernate.jpamodelgen.test.util.WithClasses;
import org.hibernate.jpamodelgen.test.util.WithProcessorOption; import org.hibernate.jpamodelgen.test.util.WithProcessorOption;
@ -19,7 +19,7 @@ import static org.hibernate.jpamodelgen.test.util.TestUtil.assertPresenceOfField
* @author Hardy Ferentschik * @author Hardy Ferentschik
*/ */
@WithClasses({ Car.class, Course.class, Option.class, Period.class, Teacher.class, Tire.class, XmlOnly.class }) @WithClasses({ Car.class, Course.class, Option.class, Period.class, Teacher.class, Tire.class, XmlOnly.class })
@WithProcessorOption(key = JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION, @WithProcessorOption(key = HibernateProcessor.PERSISTENCE_XML_OPTION,
value = "org/hibernate/jpamodelgen/test/xmlonly/persistence.xml") value = "org/hibernate/jpamodelgen/test/xmlonly/persistence.xml")
public class XmlOnlyTest extends CompilationTest { public class XmlOnlyTest extends CompilationTest {
@Test @Test