Skip to content

Commit

Permalink
Fix some assertion errors
Browse files Browse the repository at this point in the history
Not much use having assertions which you don't expect to succeed
  • Loading branch information
Chocohead committed Mar 21, 2023
1 parent 9c0b3b8 commit 3c46aea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ private void pairUp(String className, List<MethodComparison> commonMethods, List

if (lostMethod == null) {
if (gainedMethod == null) {
assert Objects.equals(lost.getFullName(), gained.getFullName());
assert Objects.equals(lost.getFullName(), gained.getFullName()) || commonMethods.stream().anyMatch(method -> gained.name.equals(method.node.name) && gained.desc.equals(method.node.desc)):
"Expected lost lambda '" + lost.getFullName() + "' to equal gained lambda '" + gained.getFullName() + '\'';
continue;
} else {
throw new IllegalStateException("Couldn't find original method for lambda: " + lost.getFullName());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.modmuss50.optifabric.patcher.fixes;

import java.util.Arrays;
import java.util.ListIterator;

import org.objectweb.asm.Opcodes;
Expand Down Expand Up @@ -41,7 +42,8 @@ public void fix(ClassNode classNode, ClassNode old) {
if (trailingBoolean) end--;
boolean trailingRenderLayer = RemappingUtils.getClassName("class_1921").equals(args[end].getInternalName());
if (trailingRenderLayer) end--;
assert "net/minecraftforge/client/model/data/IModelData".equals(args[end].getInternalName());
assert "net/minecraftforge/client/model/data/IModelData".equals(args[end].getInternalName()) || "net/minecraftforge/client/model/data/ModelData".equals(args[end].getInternalName()):
"Expected Forge (I)ModelData, found: '" + args[end] + "' from " + Arrays.toString(args);
end--;
assert end > 0 && Type.BOOLEAN == args[end - 1].getSort();
boolean nativeRandom = "java/util/Random".equals(args[end].getInternalName());
Expand Down

0 comments on commit 3c46aea

Please sign in to comment.