|
7 | 7 | import jakarta.persistence.Transient;
|
8 | 8 | import net.bytebuddy.asm.Advice;
|
9 | 9 | import net.bytebuddy.description.annotation.AnnotationDescription;
|
| 10 | +import net.bytebuddy.description.method.MethodDescription; |
10 | 11 | import net.bytebuddy.description.modifier.FieldPersistence;
|
11 | 12 | import net.bytebuddy.description.modifier.ModifierContributor;
|
12 | 13 | import net.bytebuddy.description.modifier.Visibility;
|
|
19 | 20 | import java.util.Collection;
|
20 | 21 | import java.util.List;
|
21 | 22 |
|
| 23 | +import net.bytebuddy.matcher.ElementMatcher; |
22 | 24 | import org.hibernate.bytecode.enhance.spi.CollectionTracker;
|
23 | 25 | import org.hibernate.engine.spi.EntityEntry;
|
24 | 26 | import org.hibernate.engine.spi.ManagedEntity;
|
25 | 27 | import org.hibernate.engine.spi.PersistentAttributeInterceptor;
|
26 | 28 |
|
| 29 | +import static net.bytebuddy.matcher.ElementMatchers.isDefaultFinalizer; |
| 30 | + |
27 | 31 | /**
|
28 | 32 | * Extracts constants used by EnhancerImpl.
|
29 | 33 | * This allows integrators to choose reusing this state for multiple enhancement processes,
|
@@ -69,6 +73,9 @@ public final class EnhancerImplConstants {
|
69 | 73 | final TypeDefinition Type_Array_String = TypeDescription.ForLoadedType.of( String[].class );
|
70 | 74 | final TypeDefinition TypeCollectionTracker = TypeDescription.ForLoadedType.of( CollectionTracker.class );
|
71 | 75 |
|
| 76 | + //Frequently used ElementMatchers: |
| 77 | + final ElementMatcher.Junction<MethodDescription> DEFAULT_FINALIZER = isDefaultFinalizer(); |
| 78 | + |
72 | 79 | public EnhancerImplConstants() {
|
73 | 80 | this.adviceLocator = ClassFileLocator.ForClassLoader.of( CodeTemplates.class.getClassLoader() );
|
74 | 81 | this.implementationTrackChange = Advice.to( CodeTemplates.TrackChange.class, adviceLocator )
|
@@ -110,4 +117,8 @@ public EnhancerImplConstants() {
|
110 | 117 | .wrap( StubMethod.INSTANCE );
|
111 | 118 | }
|
112 | 119 |
|
| 120 | + public ElementMatcher<? super MethodDescription> defaultFinalizer() { |
| 121 | + return DEFAULT_FINALIZER; |
| 122 | + } |
| 123 | + |
113 | 124 | }
|
0 commit comments