|
33 | 33 | import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
34 | 34 | import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
35 | 35 |
|
36 |
| -import javax.annotation.processing.ProcessingEnvironment; |
37 | 36 | import javax.lang.model.element.AnnotationMirror;
|
38 | 37 | import javax.lang.model.element.AnnotationValue;
|
39 | 38 | import javax.lang.model.element.Element;
|
|
51 | 50 | import javax.lang.model.type.TypeMirror;
|
52 | 51 | import javax.lang.model.type.TypeVariable;
|
53 | 52 | import javax.lang.model.type.WildcardType;
|
54 |
| -import javax.lang.model.util.Elements; |
55 | 53 | import javax.lang.model.util.Types;
|
56 | 54 | import javax.tools.Diagnostic;
|
57 | 55 | import java.util.ArrayList;
|
|
86 | 84 | import static org.hibernate.processor.util.TypeUtils.containsAnnotation;
|
87 | 85 | import static org.hibernate.processor.util.TypeUtils.determineAccessTypeForHierarchy;
|
88 | 86 | import static org.hibernate.processor.util.TypeUtils.determineAnnotationSpecifiedAccessType;
|
| 87 | +import static org.hibernate.processor.util.TypeUtils.extendsClass; |
89 | 88 | import static org.hibernate.processor.util.TypeUtils.findMappedSuperClass;
|
90 | 89 | import static org.hibernate.processor.util.TypeUtils.getAnnotationMirror;
|
91 | 90 | import static org.hibernate.processor.util.TypeUtils.getAnnotationValue;
|
92 | 91 | import static org.hibernate.processor.util.TypeUtils.hasAnnotation;
|
| 92 | +import static org.hibernate.processor.util.TypeUtils.implementsInterface; |
93 | 93 | import static org.hibernate.processor.util.TypeUtils.primitiveClassMatchesKind;
|
94 | 94 | import static org.hibernate.processor.util.TypeUtils.propertyName;
|
95 | 95 |
|
@@ -660,41 +660,18 @@ boolean needsDefaultConstructor() {
|
660 | 660 | }
|
661 | 661 |
|
662 | 662 | private boolean isPanacheType(TypeElement type) {
|
663 |
| - return isOrmPanacheType( type ) |
664 |
| - || isReactivePanacheType( type ); |
| 663 | + return context.usesQuarkusOrm() && isOrmPanacheType( type ) |
| 664 | + || context.usesQuarkusReactive() && isReactivePanacheType( type ); |
665 | 665 | }
|
666 | 666 |
|
667 | 667 | private boolean isOrmPanacheType(TypeElement type) {
|
668 |
| - final ProcessingEnvironment processingEnvironment = context.getProcessingEnvironment(); |
669 |
| - final Elements elements = processingEnvironment.getElementUtils(); |
670 |
| - final TypeElement panacheRepositorySuperType = elements.getTypeElement( PANACHE_ORM_REPOSITORY_BASE ); |
671 |
| - final TypeElement panacheEntitySuperType = elements.getTypeElement( PANACHE_ORM_ENTITY_BASE ); |
672 |
| - if ( panacheRepositorySuperType == null || panacheEntitySuperType == null ) { |
673 |
| - return false; |
674 |
| - } |
675 |
| - else { |
676 |
| - final Types types = processingEnvironment.getTypeUtils(); |
677 |
| - // check against a raw supertype of PanacheRepositoryBase, which .asType() is not |
678 |
| - return types.isSubtype( type.asType(), types.getDeclaredType( panacheRepositorySuperType ) ) |
679 |
| - || types.isSubtype( type.asType(), panacheEntitySuperType.asType() ); |
680 |
| - } |
| 668 | + return implementsInterface( type, PANACHE_ORM_REPOSITORY_BASE ) |
| 669 | + || extendsClass( type, PANACHE_ORM_ENTITY_BASE ); |
681 | 670 | }
|
682 | 671 |
|
683 | 672 | private boolean isReactivePanacheType(TypeElement type) {
|
684 |
| - final ProcessingEnvironment processingEnvironment = context.getProcessingEnvironment(); |
685 |
| - final Elements elements = processingEnvironment.getElementUtils(); |
686 |
| - final TypeElement panacheRepositorySuperType = elements.getTypeElement( PANACHE_REACTIVE_REPOSITORY_BASE ); |
687 |
| - final TypeElement panacheEntitySuperType = elements.getTypeElement( PANACHE_REACTIVE_ENTITY_BASE ); |
688 |
| - |
689 |
| - if ( panacheRepositorySuperType == null || panacheEntitySuperType == null ) { |
690 |
| - return false; |
691 |
| - } |
692 |
| - else { |
693 |
| - final Types types = processingEnvironment.getTypeUtils(); |
694 |
| - // check against a raw supertype of PanacheRepositoryBase, which .asType() is not |
695 |
| - return types.isSubtype( type.asType(), types.getDeclaredType( panacheRepositorySuperType ) ) |
696 |
| - || types.isSubtype( type.asType(), panacheEntitySuperType.asType() ); |
697 |
| - } |
| 673 | + return implementsInterface( type, PANACHE_REACTIVE_REPOSITORY_BASE ) |
| 674 | + || extendsClass( type, PANACHE_REACTIVE_ENTITY_BASE ); |
698 | 675 | }
|
699 | 676 |
|
700 | 677 | /**
|
|
0 commit comments