Skip to content

Commit 5c41517

Browse files
authored
Merge pull request #32679 from Ladicek/logging-panache-stack-discipline
Logging with Panache: fix LocalVariablesSorter usage
2 parents ef1db03 + f7fb241 commit 5c41517

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void visitMethodInsn(int opcode, String owner, String name, String descri
137137
locals = new int[numArgs];
138138
for (int i = numArgs - 1; i >= 0; i--) {
139139
locals[i] = newLocal(argTypes[i]);
140-
super.visitVarInsn(argTypes[i].getOpcode(Opcodes.ISTORE), locals[i]);
140+
visitor.visitVarInsn(argTypes[i].getOpcode(Opcodes.ISTORE), locals[i]);
141141
}
142142
}
143143

@@ -162,7 +162,7 @@ public void visitMethodInsn(int opcode, String owner, String name, String descri
162162
// stack: [logger arg1 arg2 arg3] locals: {l1 = arg4}
163163
// stack: [logger arg1 arg2 arg3 arg4] locals: {}
164164
for (int i = 0; i < numArgs; i++) {
165-
super.visitVarInsn(argTypes[i].getOpcode(Opcodes.ILOAD), locals[i]);
165+
visitor.visitVarInsn(argTypes[i].getOpcode(Opcodes.ILOAD), locals[i]);
166166
}
167167
}
168168

integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java

+8
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,12 @@ public void doSomething() {
4040
Log.error("Hello Error", error);
4141
}
4242

43+
// https://github.com/quarkusio/quarkus/issues/32663
44+
public void reproduceStackDisciplineIssue() {
45+
String result;
46+
String now = "now";
47+
48+
Log.infov("{0} {1}", "number", 42);
49+
Log.info("string " + now);
50+
}
4351
}

integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public class LoggingWithPanacheTest {
4040
"[ERROR] four: foo | bar | baz | quux",
4141
"[WARN] foo | bar | baz | quux: io.quarkus.logging.NoStackTraceTestException",
4242
"[ERROR] Hello Error: io.quarkus.logging.NoStackTraceTestException",
43-
"[INFO] Hi!");
43+
"[INFO] Hi!",
44+
"[INFO] number 42",
45+
"[INFO] string now");
4446
});
4547

4648
@Inject
@@ -50,5 +52,7 @@ public class LoggingWithPanacheTest {
5052
public void test() {
5153
bean.doSomething();
5254
new LoggingEntity().something();
55+
56+
bean.reproduceStackDisciplineIssue();
5357
}
5458
}

0 commit comments

Comments
 (0)