Skip to content

Commit

Permalink
Fix some issues with primitive unboxing. Closes #69 Closes #74
Browse files Browse the repository at this point in the history
  • Loading branch information
LexManos committed Jun 17, 2020
1 parent ba96c2b commit b595383
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 125 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
From f2e544c628b6e1558e4c59c4382ed5aade934228 Mon Sep 17 00:00:00 2001
From d2f6207885de9b82c2d37d87a7ee26328efb6aa1 Mon Sep 17 00:00:00 2001
From: LexManos <LexManos@gmail.com>
Date: Thu, 11 May 2017 03:24:33 -0700
Subject: [PATCH] Fix primitive unboxing causing invocations of wrong
overloaded functions.
Subject: [PATCH] Fix primitive un/boxing issues.


diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
Expand Down Expand Up @@ -30,43 +29,84 @@ index 03a59cb..474ffda 100644
}
}
}
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
index 161f55c..068e44b 100644
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
@@ -566,6 +566,19 @@ public class FunctionExprent extends Exprent {
}

if (funcType <= FUNCTION_I2S) {
+ // We can't directly cast some object types, so we need to make sure the unboxing happens.
+ // The types seem to be inconsistant but there is no harm in forcing the unboxing when not strictly needed.
+ // Type | Works | Doesn't
+ // Integer| LFD | BCS
+ // Long | FD | I
+ // Float | D | IL
+ // Double | | ILF
+ if (lstOperands.get(0).type == Exprent.EXPRENT_INVOCATION) {
+ InvocationExprent inv = (InvocationExprent)lstOperands.get(0);
+ if (inv.isUnboxingCall()) {
+ inv.forceUnboxing(true);
+ }
+ }
return wrapOperandString(lstOperands.get(0), true, indent, tracer).prepend("(" + ExprProcessor.getTypeName(
TYPES[funcType - FUNCTION_I2L]) + ")");
}
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
index d72870e..3c13e14 100644
index d72870e..1c822f3 100644
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
@@ -59,6 +59,7 @@ public class InvocationExprent extends Exprent {
@@ -59,6 +59,8 @@ public class InvocationExprent extends Exprent {
private List<Exprent> lstParameters = new ArrayList<>();
private List<PooledConstant> bootstrapArguments;
private List<VarType> genericArgs = new ArrayList<>();
+ private boolean forceBoxing = false;
+ private boolean forceUnboxing = false;

public InvocationExprent() {
super(EXPRENT_INVOCATION);
@@ -261,7 +262,7 @@ public class InvocationExprent extends Exprent {
@@ -261,10 +263,10 @@ public class InvocationExprent extends Exprent {
}

if (isStatic) {
- if (isBoxingCall() && canIgnoreBoxing) {
+ if (isBoxingCall() && canIgnoreBoxing && !forceBoxing) {
// process general "boxing" calls, e.g. 'Object[] data = { true }' or 'Byte b = 123'
// here 'byte' and 'short' values do not need an explicit narrowing type cast
ExprProcessor.getCastedExprent(lstParameters.get(0), descriptor.params[0], buf, indent, false, false, false, false, tracer);
@@ -310,14 +311,24 @@ public class InvocationExprent extends Exprent {
- ExprProcessor.getCastedExprent(lstParameters.get(0), descriptor.params[0], buf, indent, false, false, false, false, tracer);
+ ExprProcessor.getCastedExprent(lstParameters.get(0), descriptor.params[0], buf, indent, false, false, true, false, tracer);
return buf;
}

@@ -310,16 +312,36 @@ public class InvocationExprent extends Exprent {
TextUtil.writeQualifiedSuper(buf, super_qualifier);
}
else if (instance != null) {
- TextBuffer res = instance.toJava(indent, tracer);
-
if (isUnboxingCall()) {
- if (isUnboxingCall()) {
+ VarType leftType = new VarType(CodeConstants.TYPE_OBJECT, 0, classname);
+ if (isUnboxingCall() && !forceUnboxing) {
// we don't print the unboxing call - no need to bother with the instance wrapping / casting
- buf.append(res);
+ if (instance.type == Exprent.EXPRENT_FUNCTION) {
+ FunctionExprent func = (FunctionExprent)instance;
+ if (func.getFuncType() == FunctionExprent.FUNCTION_CAST && func.getLstOperands().get(1).type == Exprent.EXPRENT_CONST) {
+ ConstExprent _const = (ConstExprent)func.getLstOperands().get(1);
+ if (this.classname.equals(_const.getConstType().value)) {
+ buf.append(func.getLstOperands().get(0).toJava(indent, tracer));
+ return buf;
+ boolean skipCast = false;
+
+ if (func.getLstOperands().get(0).type == Exprent.EXPRENT_VAR) {
+ VarType inferred = func.getLstOperands().get(0).getInferredExprType(leftType);
+ skipCast = inferred.type != CodeConstants.TYPE_OBJECT ||
+ DecompilerContext.getStructContext().instanceOf(inferred.value, this.classname);
+ } else if (this.classname.equals(_const.getConstType().value)) {
+ skipCast = true;
+ }
+
+ if (skipCast) {
+ buf.append(func.getLstOperands().get(0).toJava(indent, tracer));
+ return buf;
+ }
+ }
+ }
Expand All @@ -77,9 +117,11 @@ index d72870e..3c13e14 100644
+ TextBuffer res = instance.toJava(indent, tracer);
+
VarType rightType = instance.getExprType();
VarType leftType = new VarType(CodeConstants.TYPE_OBJECT, 0, classname);
- VarType leftType = new VarType(CodeConstants.TYPE_OBJECT, 0, classname);

@@ -417,8 +428,62 @@ public class InvocationExprent extends Exprent {
if (rightType.equals(VarType.VARTYPE_OBJECT) && !leftType.equals(rightType)) {
buf.append("((").append(ExprProcessor.getCastTypeName(leftType)).append(")");
@@ -417,8 +439,85 @@ public class InvocationExprent extends Exprent {
}
}

Expand All @@ -89,61 +131,84 @@ index d72870e..3c13e14 100644
+ VarType[] types = Arrays.copyOf(descriptor.params, descriptor.params.length);
+ for (int i = start; i < parameters.size(); i++) {
+ Exprent par = parameters.get(i);
+
+ // "unbox" invocation parameters, e.g. 'byteSet.add((byte)123)' or 'new ShortContainer((short)813)'
+ //However, we must make sure we don't accidentally make the call ambiguous.
+ //An example being List<Integer>, remove(Integer.valueOf(1)) and remove(1) are different functions
+ if (par.type == Exprent.EXPRENT_INVOCATION && ((InvocationExprent)par).isBoxingCall()) {
+ InvocationExprent inv = (InvocationExprent)par;
+ Exprent value = inv.lstParameters.get(0);
+ types[i] = value.getExprType(); //Infer?
+ //Unboxing in this case is lossy, so we need to explicitly set the type
+ if (types[i] .typeFamily == CodeConstants.TYPE_FAMILY_INTEGER) {
+ types[i] =
+ if (par.type == Exprent.EXPRENT_INVOCATION) {
+ InvocationExprent inv = (InvocationExprent)par;
+ // "unbox" invocation parameters, e.g. 'byteSet.add((byte)123)' or 'new ShortContainer((short)813)'
+ //However, we must make sure we don't accidentally make the call ambiguous.
+ //An example being List<Integer>, remove(Integer.valueOf(1)) and remove(1) are different functions
+ if (inv.isBoxingCall()) {
+ Exprent value = inv.lstParameters.get(0);
+ types[i] = value.getExprType(); //Infer?
+ //Unboxing in this case is lossy, so we need to explicitly set the type
+ if (types[i].typeFamily == CodeConstants.TYPE_FAMILY_INTEGER) {
+ types[i] =
+ "java/lang/Short".equals(inv.classname) ? VarType.VARTYPE_SHORT :
+ "java/lang/Byte".equals(inv.classname) ? VarType.VARTYPE_BYTE :
+ "java/lang/Integer".equals(inv.classname) ? VarType.VARTYPE_INT :
+ VarType.VARTYPE_CHAR;
+ }
+ }
+
+ int count = 0;
+ StructClass stClass = DecompilerContext.getStructContext().getClass(classname);
+ if (stClass != null) {
+ nextMethod:
+ for (StructMethod mt : stClass.getMethods()) {
+ if (name.equals(mt.getName())) {
+ MethodDescriptor md = MethodDescriptor.parseDescriptor(mt.getDescriptor());
+ if (md.params.length == descriptor.params.length) {
+ for (int x = 0; x < md.params.length; x++) {
+ if (md.params[x].typeFamily != descriptor.params[x].typeFamily &&
+ md.params[x].typeFamily != types[x].typeFamily) {
+ continue nextMethod;
+ }
+ }
+ count++;
+ }
+ }
+ }
+ }
+
+ int count = 0;
+ StructClass stClass = DecompilerContext.getStructContext().getClass(classname);
+ if (stClass != null) {
+ nextMethod:
+ if (count != matches.size()) { //We become more ambiguous? Lets keep the explicit boxing
+ types[i] = descriptor.params[i];
+ inv.forceBoxing = true;
+ } else {
+ value.addBytecodeOffsets(inv.bytecode); //Keep the bytecode for matching/debug
+ parameters.set(i, value);
+ }
+ }
+ // We also need to care about when things are intentionally unboxed to call a different overloaded method,
+ //and skipping unboxing causes us to call ourselves.
+ // EXA:
+ // int compare(Integer a, Integer b) { return this.compare(a.intValue(), b.intValue()); }
+ // int compare(int a, int b) { return a - b; }
+ // Allowing the first function to unbox would cause infinite recursion
+ // Right now it just do a quick check, but a proper check would be to do compiler like inference of argument
+ // types, and check unboxing as needed. Currently it causes some false forces
+ else if (inv.isUnboxingCall() && !inv.shouldForceUnboxing()) {
+ StructClass stClass = DecompilerContext.getStructContext().getClass(classname);
+ for (StructMethod mt : stClass.getMethods()) {
+ if (name.equals(mt.getName())) {
+ if (name.equals(mt.getName()) && !stringDescriptor.equals(mt.getDescriptor())) {
+ MethodDescriptor md = MethodDescriptor.parseDescriptor(mt.getDescriptor());
+ if (md.params.length == descriptor.params.length) {
+ for (int x = 0; x < md.params.length; x++) {
+ if (md.params[x].typeFamily != descriptor.params[x].typeFamily &&
+ md.params[x].typeFamily != types[x].typeFamily) {
+ continue nextMethod;
+ if (md.params[i].type == CodeConstants.TYPE_OBJECT) {
+ if (DecompilerContext.getStructContext().instanceOf(inv.getInstance().getExprType().value, md.params[i].value)) {
+ inv.forceUnboxing(true);
+ break;
+ }
+ }
+ count++;
+ }
+ }
+ }
+ }
+
+ if (count != matches.size()) { //We become more ambiguous? Lets keep the explicit boxing
+ types[i] = descriptor.params[i];
+ inv.forceBoxing = true;
+ }
+ else {
+ value.addBytecodeOffsets(inv.bytecode); //Keep the bytecode for matching/debug
+ parameters.set(i, value);
+ }
+ }
+
+ }
+
+
+ boolean firstParameter = true;
for (int i = start; i < lstParameters.size(); i++) {
if (mask == null || mask.get(i) == null) {
TextBuffer buff = new TextBuffer();
@@ -453,7 +518,7 @@ public class InvocationExprent extends Exprent {
@@ -453,7 +552,7 @@ public class InvocationExprent extends Exprent {
*/

// 'byte' and 'short' literals need an explicit narrowing type cast when used as a parameter
Expand All @@ -152,7 +217,7 @@ index d72870e..3c13e14 100644

// the last "new Object[0]" in the vararg call is not printed
if (buff.length() > 0) {
@@ -506,7 +571,7 @@ public class InvocationExprent extends Exprent {
@@ -506,7 +605,7 @@ public class InvocationExprent extends Exprent {
}

if (paramType == CodeConstants.TYPE_BYTECHAR || paramType == CodeConstants.TYPE_SHORTCHAR) {
Expand All @@ -161,18 +226,26 @@ index d72870e..3c13e14 100644
return true;
}
}
@@ -565,6 +630,10 @@ public class InvocationExprent extends Exprent {
@@ -565,6 +664,18 @@ public class InvocationExprent extends Exprent {
return !isStatic && lstParameters.size() == 0 && classname.equals(UNBOXING_METHODS.get(name));
}

+ public boolean shouldForceBoxing() {
+ return forceBoxing;
+ }
+
+ public void forceUnboxing(boolean value) {
+ this.forceUnboxing = value;
+ }
+
+ public boolean shouldForceUnboxing() {
+ return this.forceUnboxing;
+ }
+
private List<StructMethod> getMatchedDescriptors() {
List<StructMethod> matches = new ArrayList<>();
StructClass cl = DecompilerContext.getStructContext().getClass(classname);
@@ -594,6 +663,8 @@ public class InvocationExprent extends Exprent {
@@ -594,6 +705,8 @@ public class InvocationExprent extends Exprent {
return EMPTY_BIT_SET;
}

Expand All @@ -181,7 +254,7 @@ index d72870e..3c13e14 100644
// check if a call is unambiguous
StructMethod mt = cl.getMethod(InterpreterUtil.makeUniqueKey(name, stringDescriptor));
if (mt != null) {
@@ -603,18 +674,50 @@ public class InvocationExprent extends Exprent {
@@ -603,18 +716,50 @@ public class InvocationExprent extends Exprent {
for (int i = 0; i < md.params.length; i++) {
if (!md.params[i].equals(lstParameters.get(i).getExprType())) {
exact = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 893e1e6fb3798cffacf847abec2b1617897698fa Mon Sep 17 00:00:00 2001
From a05f3907b40a0e9deb19f31882a0b5e944e30b8d Mon Sep 17 00:00:00 2001
From: LexManos <LexManos@gmail.com>
Date: Fri, 16 Feb 2018 22:04:00 -0800
Subject: [PATCH] Enhance Generic Invocations Temporarily.
Expand All @@ -24,7 +24,7 @@ index 4aeda0e..58c3471 100644
left = left.resizeArrayDim(0);
right = right.resizeArrayDim(0);
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
index 161f55c..d15b858 100644
index 068e44b..8f69e43 100644
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
@@ -7,6 +7,8 @@ import org.jetbrains.java.decompiler.code.CodeConstants;
Expand Down Expand Up @@ -66,7 +66,7 @@ index 161f55c..d15b858 100644
}
else { //TODO: Capture generics to make cast better?
this.needsCast = right.type == CodeConstants.TYPE_NULL || !DecompilerContext.getStructContext().instanceOf(right.value, cast.value);
@@ -570,7 +581,7 @@ public class FunctionExprent extends Exprent {
@@ -583,7 +594,7 @@ public class FunctionExprent extends Exprent {
TYPES[funcType - FUNCTION_I2L]) + ")");
}

Expand All @@ -75,7 +75,7 @@ index 161f55c..d15b858 100644
throw new RuntimeException("invalid function");
}

@@ -651,7 +662,7 @@ public class FunctionExprent extends Exprent {
@@ -664,7 +675,7 @@ public class FunctionExprent extends Exprent {
measureBytecode(values, lstOperands);
measureBytecode(values);
}
Expand All @@ -84,36 +84,45 @@ index 161f55c..d15b858 100644
// *****************************************************************************
// IMatchable implementation
// *****************************************************************************
@@ -665,4 +676,4 @@ public class FunctionExprent extends Exprent {
@@ -678,4 +689,4 @@ public class FunctionExprent extends Exprent {
Integer type = (Integer)matchNode.getRuleValue(MatchProperties.EXPRENT_FUNCTYPE);
return type == null || this.funcType == type;
}
-}
\ No newline at end of file
+}
diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
index 3c13e14..50d8799 100644
index 1c822f3..a16aa29 100644
--- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
+++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
@@ -395,6 +395,7 @@ public class InvocationExprent extends Exprent {
@@ -406,6 +406,7 @@ public class InvocationExprent extends Exprent {
isEnum = newNode.classStruct.hasModifier(CodeConstants.ACC_ENUM) && DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_ENUM);
}
}
+ ClassNode currCls = ((ClassNode)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_NODE));
List<StructMethod> matches = getMatchedDescriptors();
BitSet setAmbiguousParameters = getAmbiguousParameters(matches);
StructMethod desc = null;
@@ -455,7 +456,7 @@ public class InvocationExprent extends Exprent {
if (stClass != null) {
nextMethod:
@@ -466,7 +467,7 @@ public class InvocationExprent extends Exprent {
if (stClass != null) {
nextMethod:
for (StructMethod mt : stClass.getMethods()) {
- if (name.equals(mt.getName())) {
+ if (name.equals(mt.getName()) && (currCls == null || canAccess(currCls.classStruct, mt))) {
MethodDescriptor md = MethodDescriptor.parseDescriptor(mt.getDescriptor());
if (md.params.length == descriptor.params.length) {
for (int x = 0; x < md.params.length; x++) {
@@ -500,7 +501,7 @@ public class InvocationExprent extends Exprent {
else if (inv.isUnboxingCall() && !inv.shouldForceUnboxing()) {
StructClass stClass = DecompilerContext.getStructContext().getClass(classname);
for (StructMethod mt : stClass.getMethods()) {
- if (name.equals(mt.getName())) {
+ if (name.equals(mt.getName()) && (currCls == null || canAccess(currCls.classStruct, mt))) {
- if (name.equals(mt.getName()) && !stringDescriptor.equals(mt.getDescriptor())) {
+ if (name.equals(mt.getName()) && (currCls == null || canAccess(currCls.classStruct, mt)) && !stringDescriptor.equals(mt.getDescriptor())) {
MethodDescriptor md = MethodDescriptor.parseDescriptor(mt.getDescriptor());
if (md.params.length == descriptor.params.length) {
for (int x = 0; x < md.params.length; x++) {
@@ -482,6 +483,22 @@ public class InvocationExprent extends Exprent {

if (md.params[i].type == CodeConstants.TYPE_OBJECT) {
@@ -516,6 +517,22 @@ public class InvocationExprent extends Exprent {
}
}

+ if (instance != null && !genArgs.isEmpty()) {
Expand All @@ -135,7 +144,7 @@ index 3c13e14..50d8799 100644

boolean firstParameter = true;
for (int i = start; i < lstParameters.size(); i++) {
@@ -636,27 +653,98 @@ public class InvocationExprent extends Exprent {
@@ -678,27 +695,98 @@ public class InvocationExprent extends Exprent {

private List<StructMethod> getMatchedDescriptors() {
List<StructMethod> matches = new ArrayList<>();
Expand Down
Loading

4 comments on commit b595383

@LexManos
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.16-pre1 Diff:

--- joined.decomp/net/minecraft/client/AbstractOption.java	2020-06-17 12:37:36.000000000 -0700
+++ joined.decomp.test/net/minecraft/client/AbstractOption.java	2020-06-17 16:52:22.000000000 -0700
@@ -30,7 +30,7 @@
    public static final SliderPercentageOption field_216694_a = new SliderPercentageOption("options.biomeBlendRadius", 0.0D, 7.0D, 1.0F, (p_216607_0_) -> {
       return (double)p_216607_0_.field_205217_U;
    }, (p_216660_0_, p_216660_1_) -> {
-      p_216660_0_.field_205217_U = MathHelper.func_76125_a((int)p_216660_1_, 0, 7);
+      p_216660_0_.field_205217_U = MathHelper.func_76125_a((int)p_216660_1_.doubleValue(), 0, 7);
       Minecraft.func_71410_x().field_71438_f.func_72712_a();
    }, (p_216595_0_, p_216595_1_) -> {
       double d0 = p_216595_1_.func_216729_a(p_216595_0_);
@@ -115,7 +115,7 @@
    public static final SliderPercentageOption field_216701_h = new SliderPercentageOption("options.framerateLimit", 10.0D, 260.0D, 10.0F, (p_216672_0_) -> {
       return (double)p_216672_0_.field_74350_i;
    }, (p_216608_0_, p_216608_1_) -> {
-      p_216608_0_.field_74350_i = (int)p_216608_1_;
+      p_216608_0_.field_74350_i = (int)p_216608_1_.doubleValue();
       Minecraft.func_71410_x().func_228018_at_().func_216526_a(p_216608_0_.field_74350_i);
    }, (p_216645_0_, p_216645_1_) -> {
       double d0 = p_216645_1_.func_216729_a(p_216645_0_);
@@ -138,7 +138,7 @@
    public static final SliderPercentageOption field_216704_k = new SliderPercentageOption("options.mipmapLevels", 0.0D, 4.0D, 1.0F, (p_216667_0_) -> {
       return (double)p_216667_0_.field_151442_I;
    }, (p_216585_0_, p_216585_1_) -> {
-      p_216585_0_.field_151442_I = (int)p_216585_1_;
+      p_216585_0_.field_151442_I = (int)p_216585_1_.doubleValue();
    }, (p_216629_0_, p_216629_1_) -> {
       double d0 = p_216629_1_.func_216729_a(p_216629_0_);
       IFormattableTextComponent iformattabletextcomponent = p_216629_1_.func_238238_a_();
@@ -165,7 +165,7 @@
    public static final SliderPercentageOption field_216706_m = new SliderPercentageOption("options.renderDistance", 2.0D, 16.0D, 1.0F, (p_216658_0_) -> {
       return (double)p_216658_0_.field_151451_c;
    }, (p_216579_0_, p_216579_1_) -> {
-      p_216579_0_.field_151451_c = (int)p_216579_1_;
+      p_216579_0_.field_151451_c = (int)p_216579_1_.doubleValue();
       Minecraft.func_71410_x().field_71438_f.func_174979_m();
    }, (p_216664_0_, p_216664_1_) -> {
       double d0 = p_216664_1_.func_216729_a(p_216664_0_);
@@ -174,7 +174,7 @@
    public static final SliderPercentageOption field_238237_p_ = new SliderPercentageOption("options.entityDistanceScaling", 0.5D, 5.0D, 0.25F, (p_238324_0_) -> {
       return (double)p_238324_0_.field_238329_c_;
    }, (p_238256_0_, p_238256_1_) -> {
-      p_238256_0_.field_238329_c_ = (float)p_238256_1_;
+      p_238256_0_.field_238329_c_ = (float)p_238256_1_.doubleValue();
    }, (p_238254_0_, p_238254_1_) -> {
       double d0 = p_238254_1_.func_216729_a(p_238254_0_);
       return p_238254_1_.func_238238_a_().func_230529_a_(new TranslationTextComponent("options.entityDistancePercent", (int)(d0 * 100.0D)));
diff -Nur joined.decomp/net/minecraft/client/shader/Shader.java joined.decomp.test/net/minecraft/client/shader/Shader.java
--- joined.decomp/net/minecraft/client/shader/Shader.java	2020-06-17 12:38:04.000000000 -0700
+++ joined.decomp.test/net/minecraft/client/shader/Shader.java	2020-06-17 16:52:48.000000000 -0700
@@ -55,7 +55,7 @@
 
       for(int i = 0; i < this.field_148048_d.size(); ++i) {
          this.field_148051_c.func_216537_a(this.field_148049_e.get(i), this.field_148048_d.get(i));
-         this.field_148051_c.func_216538_b("AuxSize" + i).func_148087_a((float)this.field_148046_f.get(i), (float)this.field_148047_g.get(i));
+         this.field_148051_c.func_216538_b("AuxSize" + i).func_148087_a((float)this.field_148046_f.get(i).intValue(), (float)this.field_148047_g.get(i).intValue());
       }
 
       this.field_148051_c.func_216538_b("ProjMat").func_195652_a(this.field_148053_h);
diff -Nur joined.decomp/net/minecraft/client/shader/ShaderInstance.java joined.decomp.test/net/minecraft/client/shader/ShaderInstance.java
--- joined.decomp/net/minecraft/client/shader/ShaderInstance.java	2020-06-17 12:38:04.000000000 -0700
+++ joined.decomp.test/net/minecraft/client/shader/ShaderInstance.java	2020-06-17 16:52:48.000000000 -0700
@@ -258,7 +258,7 @@
             } else if (object instanceof Texture) {
                j = ((Texture)object).func_110552_b();
             } else if (object instanceof Integer) {
-               j = object;
+               j = (Integer)object;
             }
 
             if (j != -1) {
diff -Nur joined.decomp/net/minecraft/client/util/SuffixArray.java joined.decomp.test/net/minecraft/client/util/SuffixArray.java
--- joined.decomp/net/minecraft/client/util/SuffixArray.java	2020-06-17 12:38:04.000000000 -0700
+++ joined.decomp.test/net/minecraft/client/util/SuffixArray.java	2020-06-17 16:52:48.000000000 -0700
@@ -58,7 +58,7 @@
          }
 
          public int compare(Integer p_compare_1_, Integer p_compare_2_) {
-            return this.compare(p_compare_1_, p_compare_2_);
+            return this.compare(p_compare_1_.intValue(), p_compare_2_.intValue());
          }
       };
       Swapper swapper = (p_194054_3_, p_194054_4_) -> {
diff -Nur joined.decomp/net/minecraft/nbt/ListNBT.java joined.decomp.test/net/minecraft/nbt/ListNBT.java
--- joined.decomp/net/minecraft/nbt/ListNBT.java	2020-06-17 12:38:48.000000000 -0700
+++ joined.decomp.test/net/minecraft/nbt/ListNBT.java	2020-06-17 16:53:32.000000000 -0700
@@ -48,7 +48,7 @@
          return "TAG_List";
       }
    };
-   private static final ByteSet field_229695_b_ = new ByteOpenHashSet(Arrays.asList(1, 2, 3, 4, 5, 6));
+   private static final ByteSet field_229695_b_ = new ByteOpenHashSet(Arrays.asList((byte)1, (byte)2, (byte)3, (byte)4, (byte)5, (byte)6));
    private final List<INBT> field_74747_a;
    private byte field_74746_b;

@covers1624
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to introduce a few weird primitive casts, notibly the Arrays.asList at the bottom

@LexManos
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is required due to type issues. It's actually a correct change.
asList returns a list of boxed types, we want those boxed types to be Byte not Integer.

@covers1624
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh! I thought javac would be smart enough to figure that one out but apparently not..

Please sign in to comment.