Skip to content

Commit

Permalink
HSEARCH-4096 Always retrieve built-in annotation processors through r…
Browse files Browse the repository at this point in the history
…eflection

And in particular, ignore the bean manager (if any).

Signed-off-by: Yoann Rodière <yoann@hibernate.org>
  • Loading branch information
yrodiere committed Nov 18, 2020
1 parent 8c0f7bc commit 6781d71
Show file tree
Hide file tree
Showing 24 changed files with 50 additions and 26 deletions.
Expand Up @@ -11,6 +11,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.builtin.annotation.processor.impl.AlternativeDiscriminatorProcessor;
import org.hibernate.search.mapper.pojo.bridge.builtin.programmatic.AlternativeBinder;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
Expand All @@ -25,7 +26,7 @@
@Incubating
@Target( { ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = AlternativeDiscriminatorProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = AlternativeDiscriminatorProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface AlternativeDiscriminator {

/**
Expand Down
Expand Up @@ -15,6 +15,7 @@

import org.hibernate.search.engine.backend.types.Projectable;
import org.hibernate.search.engine.backend.types.Sortable;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.builtin.annotation.processor.impl.GeoPointBindingProcessor;
import org.hibernate.search.engine.spatial.GeoPoint;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
Expand Down Expand Up @@ -64,8 +65,8 @@
@Target( { ElementType.METHOD, ElementType.FIELD, ElementType.TYPE })
@Documented
@Repeatable(GeoPointBinding.List.class)
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = GeoPointBindingProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = GeoPointBindingProcessor.class))
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = GeoPointBindingProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = GeoPointBindingProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface GeoPointBinding {

/**
Expand Down
Expand Up @@ -12,6 +12,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.builtin.annotation.processor.impl.LatitudeProcessor;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef;
Expand All @@ -25,7 +26,7 @@
@Retention( RetentionPolicy.RUNTIME )
@Target( { ElementType.METHOD, ElementType.FIELD } )
@Documented
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LatitudeProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LatitudeProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface Latitude {

/**
Expand Down
Expand Up @@ -12,6 +12,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.builtin.annotation.processor.impl.LongitudeProcessor;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef;
Expand All @@ -25,7 +26,7 @@
@Retention( RetentionPolicy.RUNTIME )
@Target( { ElementType.METHOD, ElementType.FIELD } )
@Documented
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LongitudeProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LongitudeProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface Longitude {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef;
Expand All @@ -36,7 +37,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(AssociationInverseSide.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = AssociationInverseSideProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = AssociationInverseSideProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface AssociationInverseSide {

/**
Expand Down
Expand Up @@ -12,6 +12,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.IdentifierBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.IdentifierBridgeRef;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
Expand All @@ -26,7 +27,7 @@
@Documented
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = DocumentIdProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = DocumentIdProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface DocumentId {

/**
Expand Down
Expand Up @@ -18,6 +18,7 @@
import org.hibernate.search.engine.backend.types.Projectable;
import org.hibernate.search.engine.backend.types.Searchable;
import org.hibernate.search.engine.backend.types.TermVector;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
Expand Down Expand Up @@ -46,7 +47,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(FullTextField.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = FullTextFieldProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = FullTextFieldProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface FullTextField {

/**
Expand Down
Expand Up @@ -17,6 +17,7 @@
import org.hibernate.search.engine.backend.types.Projectable;
import org.hibernate.search.engine.backend.types.Searchable;
import org.hibernate.search.engine.backend.types.Sortable;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
Expand All @@ -40,7 +41,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(GenericField.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = GenericFieldProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = GenericFieldProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface GenericField {

/**
Expand Down
Expand Up @@ -12,6 +12,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.RoutingBinderRef;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessorRef;
Expand All @@ -23,7 +24,7 @@
@Documented
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = IndexedProcessor.class))
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = IndexedProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface Indexed {

/**
Expand Down
Expand Up @@ -14,6 +14,7 @@
import java.lang.annotation.Target;

import org.hibernate.search.engine.backend.types.ObjectStructure;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef;
Expand Down Expand Up @@ -98,7 +99,7 @@
@Repeatable(IndexedEmbedded.List.class)
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = IndexedEmbeddedProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = IndexedEmbeddedProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface IndexedEmbedded {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
Expand Down Expand Up @@ -52,7 +53,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(IndexingDependency.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = IndexingDependencyProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = IndexingDependencyProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface IndexingDependency {

/**
Expand Down
Expand Up @@ -18,6 +18,7 @@
import org.hibernate.search.engine.backend.types.Norms;
import org.hibernate.search.engine.backend.types.Sortable;
import org.hibernate.search.engine.backend.types.Projectable;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
Expand Down Expand Up @@ -46,7 +47,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(KeywordField.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = KeywordFieldProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = KeywordFieldProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface KeywordField {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.MarkerBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.programmatic.MarkerBinder;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
Expand All @@ -26,7 +27,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(MarkerBinding.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = MarkerBindingProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = MarkerBindingProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface MarkerBinding {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBinderRef;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
Expand All @@ -31,7 +32,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(NonStandardField.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = NonStandardFieldProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = NonStandardFieldProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface NonStandardField {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.PropertyBridge;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.PropertyBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.programmatic.PropertyBinder;
Expand All @@ -35,7 +36,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(PropertyBinding.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = PropertyBindingProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = PropertyBindingProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface PropertyBinding {

/**
Expand Down
Expand Up @@ -17,6 +17,7 @@
import org.hibernate.search.engine.backend.types.Searchable;
import org.hibernate.search.engine.backend.types.Projectable;
import org.hibernate.search.engine.backend.types.Sortable;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef;
import org.hibernate.search.mapper.pojo.extractor.mapping.annotation.ContainerExtraction;
Expand All @@ -38,7 +39,7 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(ScaledNumberField.List.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = ScaledNumberFieldProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = ScaledNumberFieldProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface ScaledNumberField {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.bridge.TypeBridge;
import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.TypeBinderRef;
import org.hibernate.search.mapper.pojo.bridge.mapping.programmatic.TypeBinder;
Expand All @@ -35,7 +36,7 @@
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(TypeBinding.List.class)
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = TypeBindingProcessor.class))
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = TypeBindingProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface TypeBinding {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.Target;

import org.hibernate.search.annotations.impl.DocumentIdAnnotationProcessor;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef;

Expand All @@ -29,6 +30,6 @@
@Target({ ElementType.METHOD, ElementType.FIELD })
@Documented
@Deprecated
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = DocumentIdAnnotationProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = DocumentIdAnnotationProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface DocumentId {
}
Expand Up @@ -19,6 +19,7 @@
import java.lang.annotation.Target;

import org.hibernate.search.annotations.impl.FieldAnnotationProcessor;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField;
Expand All @@ -42,7 +43,7 @@
@Documented
@Deprecated
@Repeatable(Fields.class)
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = FieldAnnotationProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = FieldAnnotationProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface Field {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.Target;

import org.hibernate.search.annotations.impl.IndexedAnnotationProcessor;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessorRef;

Expand All @@ -24,7 +25,7 @@
@Target( ElementType.TYPE )
@Documented
@Deprecated
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = IndexedAnnotationProcessor.class))
@TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = IndexedAnnotationProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface Indexed {
/**
* @return The filename of the index. Default to empty string
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.Target;

import org.hibernate.search.annotations.impl.IndexedEmbeddedAnnotationProcessor;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef;

Expand All @@ -27,7 +28,7 @@
@Target({ ElementType.FIELD, ElementType.METHOD })
@Documented
@Deprecated
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = IndexedEmbeddedAnnotationProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = IndexedEmbeddedAnnotationProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface IndexedEmbedded {

/**
Expand Down
Expand Up @@ -13,6 +13,7 @@
import java.lang.annotation.Target;

import org.hibernate.search.annotations.impl.LatitudeAnnotationProcessor;
import org.hibernate.search.engine.environment.bean.BeanRetrieval;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef;

Expand All @@ -29,7 +30,7 @@
@Target( { ElementType.FIELD, ElementType.METHOD } )
@Documented
@Deprecated
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LatitudeAnnotationProcessor.class))
@PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LatitudeAnnotationProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR))
public @interface Latitude {
/**
* @return the name of the spatial field (defined in @Spatial.name)
Expand Down

0 comments on commit 6781d71

Please sign in to comment.