@@ -159,8 +159,11 @@ private void addGetFieldHandlerMethod(ClassFile classfile)
159
159
code .addOpcode (Opcode .ARETURN );
160
160
minfo .setCodeAttribute (code .toCodeAttribute ());
161
161
minfo .setAccessFlags (AccessFlag .PUBLIC );
162
- StackMapTable smt = MapMaker .make (classPool , minfo );
163
- minfo .getCodeAttribute ().setAttribute (smt );
162
+ CodeAttribute codeAttribute = minfo .getCodeAttribute ();
163
+ if (codeAttribute != null ) {
164
+ StackMapTable smt = MapMaker .make (classPool , minfo );
165
+ codeAttribute .setAttribute (smt );
166
+ }
164
167
classfile .addMethod (minfo );
165
168
}
166
169
@@ -185,8 +188,11 @@ private void addSetFieldHandlerMethod(ClassFile classfile)
185
188
code .addOpcode (Opcode .RETURN );
186
189
minfo .setCodeAttribute (code .toCodeAttribute ());
187
190
minfo .setAccessFlags (AccessFlag .PUBLIC );
188
- StackMapTable smt = MapMaker .make (classPool , minfo );
189
- minfo .getCodeAttribute ().setAttribute (smt );
191
+ CodeAttribute codeAttribute = minfo .getCodeAttribute ();
192
+ if (codeAttribute != null ) {
193
+ StackMapTable smt = MapMaker .make (classPool , minfo );
194
+ codeAttribute .setAttribute (smt );
195
+ }
190
196
classfile .addMethod (minfo );
191
197
}
192
198
@@ -269,8 +275,11 @@ private void addReadMethod(ClassFile classfile, FieldInfo finfo)
269
275
270
276
minfo .setCodeAttribute (code .toCodeAttribute ());
271
277
minfo .setAccessFlags (AccessFlag .PUBLIC );
272
- StackMapTable smt = MapMaker .make (classPool , minfo );
273
- minfo .getCodeAttribute ().setAttribute (smt );
278
+ CodeAttribute codeAttribute = minfo .getCodeAttribute ();
279
+ if (codeAttribute != null ) {
280
+ StackMapTable smt = MapMaker .make (classPool , minfo );
281
+ codeAttribute .setAttribute (smt );
282
+ }
274
283
classfile .addMethod (minfo );
275
284
}
276
285
@@ -337,8 +346,11 @@ private void addWriteMethod(ClassFile classfile, FieldInfo finfo)
337
346
338
347
minfo .setCodeAttribute (code .toCodeAttribute ());
339
348
minfo .setAccessFlags (AccessFlag .PUBLIC );
340
- StackMapTable smt = MapMaker .make (classPool , minfo );
341
- minfo .getCodeAttribute ().setAttribute (smt );
349
+ CodeAttribute codeAttribute = minfo .getCodeAttribute ();
350
+ if (codeAttribute != null ) {
351
+ StackMapTable smt = MapMaker .make (classPool , minfo );
352
+ codeAttribute .setAttribute (smt );
353
+ }
342
354
classfile .addMethod (minfo );
343
355
}
344
356
@@ -364,9 +376,8 @@ private void transformInvokevirtualsIntoPutAndGetfields(ClassFile classfile)
364
376
pos = transformInvokevirtualsIntoGetfields (classfile , iter , pos );
365
377
pos = transformInvokevirtualsIntoPutfields (classfile , iter , pos );
366
378
}
367
-
368
379
StackMapTable smt = MapMaker .make (classPool , minfo );
369
- minfo . getCodeAttribute () .setAttribute (smt );
380
+ codeAttr .setAttribute (smt );
370
381
}
371
382
}
372
383
0 commit comments