Skip to content

Commit

Permalink
Merge pull request #37873 from dmlloyd/fix-levels
Browse files Browse the repository at this point in the history
Choose correct level field value and type to avoid non-resolution error
  • Loading branch information
geoand authored Dec 21, 2023
2 parents 2b3320a + 9aee1db commit 2fd3b96
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,23 @@ private static BiFunction<MethodCreator, FieldDescriptor, BranchResult> generate
}

private static ResultHandle getLogManagerLevelIntValue(String levelName, BytecodeCreator method) {
final ResultHandle infoLevel = method.readStaticField(
FieldDescriptor.of(org.jboss.logmanager.Level.class, levelName, org.jboss.logmanager.Level.class));
FieldDescriptor fd;
switch (levelName) {
case "FATAL":
case "ERROR":
case "WARN":
case "INFO":
case "DEBUG":
case "TRACE":
fd = FieldDescriptor.of(org.jboss.logmanager.Level.class, levelName, org.jboss.logmanager.Level.class);
break;
default:
fd = FieldDescriptor.of(Level.class, levelName, Level.class);
break;
}
final ResultHandle levelVal = method.readStaticField(fd);
return method
.invokeVirtualMethod(MethodDescriptor.ofMethod(Level.class, "intValue", int.class), infoLevel);
.invokeVirtualMethod(MethodDescriptor.ofMethod(Level.class, "intValue", int.class), levelVal);
}

private static void generateDefaultLoggingLogger(Level minLevel, ClassOutput output) {
Expand Down

0 comments on commit 2fd3b96

Please sign in to comment.