@@ -63,7 +63,7 @@ else if ( !persistentField.hasAnnotation( Id.class )
6363 && !( persistentField .getType ().asErasure ().isAssignableTo ( Collection .class )
6464 && enhancementContext .isMappedCollection ( persistentField ) ) ) {
6565 implementation = new InlineDirtyCheckingHandler ( implementation , managedCtClass ,
66- persistentField .asDefined (), enhancementContext .isLazyLoadable (persistentField ) );
66+ persistentField .asDefined (), enhancementContext .isLazyLoadable ( persistentField ) );
6767 }
6868
6969 if ( enhancementContext .isCompositeClass ( persistentField .getType ().asErasure () )
@@ -102,40 +102,40 @@ public Size apply(
102102 Context implementationContext ,
103103 MethodDescription instrumentedMethod ) {
104104
105- // Skip comparaison when lazy not loaded
106- Label uninitializedLazy = new Label ();
105+ // Skip comparison when lazy not loaded
106+ final Label uninitializedLazy = new Label ();
107107
108- if (checkLazyUninitialized ) {
108+ if ( checkLazyUninitialized ) {
109109 // No dirty check is required for non initialized lazy fields.
110- Label skipUnitializedCheckWithPersistentAttributeInterceptor = new Label ();
111- Label skipUnitializedCheck = new Label ();
110+ final Label skipUninitializedCheckWithPersistentAttributeInterceptor = new Label ();
111+ final Label skipUninitializedCheck = new Label ();
112112
113- // if (value !== null || value !== false || value !== 0 || ...) => np
113+ // if ( value !== null || value !== false || value !== 0 || ... ) => no need to detect lazy values
114114 methodVisitor .visitVarInsn ( Type .getType ( persistentField .getType ().asErasure ().getDescriptor () ).getOpcode ( Opcodes .ILOAD ), 1 );
115115 if ( persistentField .getType ().isPrimitive () ) {
116116 if ( persistentField .getType ().represents ( long .class ) ) {
117- methodVisitor .visitInsn ( Opcodes .LCONST_0 );
117+ methodVisitor .visitInsn ( Opcodes .LCONST_0 );
118118 methodVisitor .visitInsn ( Opcodes .LCMP );
119- methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUnitializedCheck );
119+ methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUninitializedCheck );
120120 }
121121 else if ( persistentField .getType ().represents ( float .class ) ) {
122- methodVisitor .visitInsn ( Opcodes .FCONST_0 );
122+ methodVisitor .visitInsn ( Opcodes .FCONST_0 );
123123 methodVisitor .visitInsn ( Opcodes .FCMPL );
124- methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUnitializedCheck );
124+ methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUninitializedCheck );
125125 }
126126 else if ( persistentField .getType ().represents ( double .class ) ) {
127- methodVisitor .visitInsn ( Opcodes .DCONST_0 );
127+ methodVisitor .visitInsn ( Opcodes .DCONST_0 );
128128 methodVisitor .visitInsn ( Opcodes .DCMPL );
129- methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUnitializedCheck );
129+ methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUninitializedCheck );
130130 }
131131 else {
132- methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUnitializedCheck );
132+ methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUninitializedCheck );
133133 }
134134 }
135135 else {
136- methodVisitor .visitJumpInsn ( Opcodes .IFNONNULL , skipUnitializedCheck );
136+ methodVisitor .visitJumpInsn ( Opcodes .IFNONNULL , skipUninitializedCheck );
137137 }
138-
138+
139139 // if ( this.$$_hibernate_getInterceptor() != null )
140140 methodVisitor .visitVarInsn ( Opcodes .ALOAD , 0 );
141141 methodVisitor .visitMethodInsn (
@@ -149,19 +149,19 @@ else if ( persistentField.getType().represents( double.class ) ) {
149149 methodVisitor .visitInsn ( Opcodes .DUP );
150150
151151 // if ( this.$$_hibernate_getInterceptor() == null ) => no dirty check
152- methodVisitor .visitJumpInsn ( Opcodes .IFNULL , skipUnitializedCheckWithPersistentAttributeInterceptor );
152+ methodVisitor .visitJumpInsn ( Opcodes .IFNULL , skipUninitializedCheckWithPersistentAttributeInterceptor );
153153
154- // if ( !this.$$_hibernate_getInterceptor() instanceof LazyAttributeLoadingInterceptor) => no dirty check
154+ // if ( !this.$$_hibernate_getInterceptor() instanceof LazyAttributeLoadingInterceptor ) => no dirty check
155155 methodVisitor .visitInsn ( Opcodes .DUP );
156- methodVisitor .visitTypeInsn ( Opcodes .INSTANCEOF , Type .getInternalName (LazyAttributeLoadingInterceptor .class ) );
157- methodVisitor .visitJumpInsn ( Opcodes .IFEQ , skipUnitializedCheckWithPersistentAttributeInterceptor );
158- methodVisitor .visitTypeInsn ( Opcodes .CHECKCAST , Type .getInternalName (LazyAttributeLoadingInterceptor .class ) );
159-
160- // call interceptor.isAttributeLoaded(fieldName)
156+ methodVisitor .visitTypeInsn ( Opcodes .INSTANCEOF , Type .getInternalName ( LazyAttributeLoadingInterceptor .class ) );
157+ methodVisitor .visitJumpInsn ( Opcodes .IFEQ , skipUninitializedCheckWithPersistentAttributeInterceptor );
158+ methodVisitor .visitTypeInsn ( Opcodes .CHECKCAST , Type .getInternalName ( LazyAttributeLoadingInterceptor .class ) );
159+
160+ // call interceptor.isAttributeLoaded( fieldName )
161161 methodVisitor .visitLdcInsn ( persistentField .getName () );
162162 methodVisitor .visitMethodInsn (
163163 Opcodes .INVOKEVIRTUAL ,
164- Type .getInternalName (LazyAttributeLoadingInterceptor .class ),
164+ Type .getInternalName ( LazyAttributeLoadingInterceptor .class ),
165165 "isAttributeLoaded" ,
166166 Type .getMethodDescriptor (
167167 Type .BOOLEAN_TYPE ,
@@ -170,20 +170,20 @@ else if ( persistentField.getType().represents( double.class ) ) {
170170 false
171171 );
172172
173- // When field is not initialized, Comparaison is useless
174- // if (interceptor.isAttributeLoaded(fieldName) ) goto skipUnitializedCheck
175- methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUnitializedCheck );
176-
177- // Sure that the lazy is not initialized. No need for comparaison , directly set dirty
173+ // When field is not initialized, comparison is useless
174+ // if ( interceptor.isAttributeLoaded( fieldName ) ) goto skipUninitializedCheck
175+ methodVisitor .visitJumpInsn ( Opcodes .IFNE , skipUninitializedCheck );
176+
177+ // Sure that the lazy is not initialized. No need for comparison , directly set dirty
178178 methodVisitor .visitJumpInsn ( Opcodes .GOTO , uninitializedLazy );
179-
180- methodVisitor .visitLabel ( skipUnitializedCheckWithPersistentAttributeInterceptor );
179+
180+ methodVisitor .visitLabel ( skipUninitializedCheckWithPersistentAttributeInterceptor );
181181 if ( implementationContext .getClassFileVersion ().isAtLeast ( ClassFileVersion .JAVA_V6 ) ) {
182- methodVisitor .visitFrame ( Opcodes .F_SAME1 , 0 , null , 1 , new Object []{Type .getInternalName (PersistentAttributeInterceptor .class )} );
182+ methodVisitor .visitFrame ( Opcodes .F_SAME1 , 0 , null , 1 , new Object []{Type .getInternalName ( PersistentAttributeInterceptor .class )} );
183183 }
184184 methodVisitor .visitInsn ( Opcodes .POP );
185185
186- methodVisitor .visitLabel ( skipUnitializedCheck );
186+ methodVisitor .visitLabel ( skipUninitializedCheck );
187187 if ( implementationContext .getClassFileVersion ().isAtLeast ( ClassFileVersion .JAVA_V6 ) ) {
188188 methodVisitor .visitFrame ( Opcodes .F_SAME , 0 , null , 0 , null );
189189 }
@@ -234,11 +234,10 @@ else if ( persistentField.getType().represents( double.class ) ) {
234234 );
235235 branchCode = Opcodes .IFNE ;
236236 }
237-
238237 Label skip = new Label ();
239238 methodVisitor .visitJumpInsn ( branchCode , skip );
240239
241- methodVisitor .visitLabel (uninitializedLazy );
240+ methodVisitor .visitLabel ( uninitializedLazy );
242241 if ( implementationContext .getClassFileVersion ().isAtLeast ( ClassFileVersion .JAVA_V6 ) ) {
243242 methodVisitor .visitFrame ( Opcodes .F_SAME , 0 , null , 0 , null );
244243 }
0 commit comments