Skip to content

Commit

Permalink
Fix build issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
broneill committed Jun 28, 2023
1 parent 0571c4d commit 8308bd1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>cojen-maker</artifactId>
<packaging>jar</packaging>
<name>Maker</name>
<version>2.4.7</version>
<version>2.4.8</version>
<description>
Dynamic Java class file generator.
</description>
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/org/cojen/maker/Switcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public static void switchString(MethodMaker mm, Variable condition,
for (Object matches : hashMatches.values()) {
hashLabels[i++].here();

if (matches instanceof ArrayList list) {
for (var match : list) {
if (matches instanceof ArrayList) {
for (var match : (ArrayList) matches) {
((StringMatch) match).addCheck(condition);
}
} else {
Expand All @@ -96,9 +96,17 @@ public static void switchString(MethodMaker mm, Variable condition,
}
}

private record StringMatch(String key, Label label) {
private static class StringMatch {
final String mKey;
final Label mLabel;

StringMatch(String key, Label label) {
mKey = key;
mLabel = label;
}

void addCheck(Variable condition) {
condition.invoke("equals", key).ifTrue(label);
condition.invoke("equals", mKey).ifTrue(mLabel);
}
}
}
3 changes: 2 additions & 1 deletion src/main/java/org/cojen/maker/TheMethodMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -2370,9 +2370,10 @@ private Type doAddPushOp(Type type, Object value) {
} else {
throw unsupportedConstant(value);
}
} else if (value instanceof Boolean b) {
} else if (value instanceof Boolean) {
if (type != null && type.isObject()) {
constantType = Type.from(Boolean.class);
var b = (Boolean) value;
Type.Field field = constantType.findField(b ? "TRUE" : "FALSE");
addOp(new FieldOp(GETSTATIC, 0, mConstants.addField(field)));
return addConversionOp(constantType, type);
Expand Down

0 comments on commit 8308bd1

Please sign in to comment.