@@ -87,6 +87,8 @@ public Class<? extends Annotation> annotationType() {
8787 };
8888 }
8989
90+ private static final AnnotationDescription TRANSIENT_ANNOTATION = AnnotationDescription .Builder .ofType ( Transient .class ).build ();
91+
9092 protected final ByteBuddyEnhancementContext enhancementContext ;
9193 private final ByteBuddyState byteBuddyState ;
9294
@@ -218,7 +220,7 @@ private DynamicType.Builder<?> doEnhance(DynamicType.Builder<?> builder, TypeDes
218220 if ( collectionFields .isEmpty () ) {
219221 builder = builder .implement ( SelfDirtinessTracker .class )
220222 .defineField ( EnhancerConstants .TRACKER_FIELD_NAME , DirtyTracker .class , FieldPersistence .TRANSIENT , Visibility .PRIVATE )
221- .annotateField ( AnnotationDescription . Builder . ofType ( Transient . class ). build () )
223+ .annotateField ( TRANSIENT_ANNOTATION )
222224 .defineMethod ( EnhancerConstants .TRACKER_CHANGER_NAME , void .class , Visibility .PUBLIC )
223225 .withParameters ( String .class )
224226 .intercept ( implementationTrackChange )
@@ -239,9 +241,9 @@ private DynamicType.Builder<?> doEnhance(DynamicType.Builder<?> builder, TypeDes
239241 //TODO es.enableInterfaceExtendedSelfDirtinessTracker ? Careful with consequences..
240242 builder = builder .implement ( ExtendedSelfDirtinessTracker .class )
241243 .defineField ( EnhancerConstants .TRACKER_FIELD_NAME , DirtyTracker .class , FieldPersistence .TRANSIENT , Visibility .PRIVATE )
242- .annotateField ( AnnotationDescription . Builder . ofType ( Transient . class ). build () )
244+ .annotateField ( TRANSIENT_ANNOTATION )
243245 .defineField ( EnhancerConstants .TRACKER_COLLECTION_NAME , CollectionTracker .class , FieldPersistence .TRANSIENT , Visibility .PRIVATE )
244- .annotateField ( AnnotationDescription . Builder . ofType ( Transient . class ). build () )
246+ .annotateField ( TRANSIENT_ANNOTATION )
245247 .defineMethod ( EnhancerConstants .TRACKER_CHANGER_NAME , void .class , Visibility .PUBLIC )
246248 .withParameters ( String .class )
247249 .intercept ( implementationTrackChange )
@@ -347,7 +349,7 @@ else if ( enhancementContext.isCompositeClass( managedCtClass ) ) {
347349 FieldPersistence .TRANSIENT ,
348350 Visibility .PRIVATE
349351 )
350- .annotateField ( AnnotationDescription . Builder . ofType ( Transient . class ). build () )
352+ .annotateField ( TRANSIENT_ANNOTATION )
351353 .defineMethod (
352354 EnhancerConstants .TRACKER_COMPOSITE_SET_OWNER ,
353355 void .class ,
@@ -424,7 +426,7 @@ private static DynamicType.Builder<?> addFieldWithGetterAndSetter(
424426 String setterName ) {
425427 return builder
426428 .defineField ( fieldName , type , Visibility .PRIVATE , FieldPersistence .TRANSIENT )
427- .annotateField ( AnnotationDescription . Builder . ofType ( Transient . class ). build () )
429+ .annotateField ( TRANSIENT_ANNOTATION )
428430 .defineMethod ( getterName , type , Visibility .PUBLIC )
429431 .intercept ( FieldAccessor .ofField ( fieldName ) )
430432 .defineMethod ( setterName , void .class , Visibility .PUBLIC )
0 commit comments