Generate not-null assertions after getting a field
This commit is contained in:
@@ -420,6 +420,14 @@ public class AsmUtil {
|
||||
genMethodThrow(mv, STUB_EXCEPTION, STUB_EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public static void genNotNullAssertionForField(
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull GenerationState state,
|
||||
@NotNull PropertyDescriptor descriptor
|
||||
) {
|
||||
genNotNullAssertion(v, state, descriptor, "checkFieldIsNotNull");
|
||||
}
|
||||
|
||||
public static void genNotNullAssertionForMethod(
|
||||
@NotNull InstructionAdapter v,
|
||||
@NotNull GenerationState state,
|
||||
|
||||
@@ -982,6 +982,7 @@ public abstract class StackValue {
|
||||
if (getter == null) {
|
||||
v.visitFieldInsn(isStatic ? GETSTATIC : GETFIELD, methodOwner.getInternalName(), descriptor.getName().getName(),
|
||||
this.type.getDescriptor());
|
||||
genNotNullAssertionForField(v, state, descriptor);
|
||||
}
|
||||
else {
|
||||
v.visitMethodInsn(invokeOpcode, methodOwner.getInternalName(), getter.getName(), getter.getDescriptor());
|
||||
|
||||
Reference in New Issue
Block a user