From 6fb329ae1a0005f87dec0b1d5bc063f11eb0310e Mon Sep 17 00:00:00 2001 From: Victorious3 Date: Fri, 26 Aug 2022 15:13:48 +0200 Subject: [PATCH] Initialize local variables to null --- src/main/java/de/dhbwstuttgart/target/bytecode/Codegen.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/dhbwstuttgart/target/bytecode/Codegen.java b/src/main/java/de/dhbwstuttgart/target/bytecode/Codegen.java index 04bee492..7c781a6c 100755 --- a/src/main/java/de/dhbwstuttgart/target/bytecode/Codegen.java +++ b/src/main/java/de/dhbwstuttgart/target/bytecode/Codegen.java @@ -810,6 +810,9 @@ public class Codegen { generate(state, varDecl.value()); boxPrimitive(state, varDecl.varType()); mv.visitVarInsn(ASTORE, local.index()); + } else { + mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ASTORE, local.index()); } break; }