Browse Source

Fixed using signature instead of description when checking if a bridge methos is necessary

kindlich 4 years ago
parent
commit
f9d96e18de
No known key found for this signature in database

+ 4
- 1
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/JavaExpressionVisitor.java View File

@@ -1961,6 +1961,7 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
1961 1961
 		final String signature;
1962 1962
 		final String[] interfaces;
1963 1963
 		final String className = context.getLambdaCounter();
1964
+		final String descriptor;
1964 1965
 		
1965 1966
 		{//Fill the info above
1966 1967
 			final StorageTag actualStorage = expression.type.getActualStorage();
@@ -1970,10 +1971,12 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
1970 1971
 				
1971 1972
 				//Should be the same, should it not?
1972 1973
 				signature = context.getMethodSignature(expression.header);
1974
+				descriptor = context.getMethodDescriptor(expression.header);
1973 1975
 				interfaces = new String[]{Type.getInternalName(functionalInterfaceMethod.getDeclaringClass())};
1974 1976
 			} else {
1975 1977
 				//Normal way, no casting to functional interface
1976 1978
 				signature = context.getMethodSignature(expression.header);
1979
+				descriptor = context.getMethodDescriptor(expression.header);
1977 1980
 				interfaces = new String[]{context.getInternalName(new FunctionTypeID(null, expression.header).stored(UniqueStorageTag.INSTANCE))};
1978 1981
 			}
1979 1982
 		}
@@ -1989,7 +1992,7 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
1989 1992
 		final JavaWriter functionWriter;
1990 1993
 		
1991 1994
 		//Bridge method!!!
1992
-		if (!Objects.equals(methodInfo.descriptor, signature)) {
1995
+		if (!Objects.equals(methodInfo.descriptor, descriptor)) {
1993 1996
 			final JavaMethod bridgeMethodInfo = new JavaMethod(methodInfo.cls, methodInfo.kind, methodInfo.name, methodInfo.compile, methodInfo.descriptor, methodInfo.modifiers | JavaModifiers.BRIDGE | JavaModifiers.SYNTHETIC, methodInfo.genericResult, methodInfo.typeParameterArguments);
1994 1997
 			final JavaWriter bridgeWriter = new JavaWriter(expression.position, lambdaCW, bridgeMethodInfo, null, methodInfo.descriptor, null, "java/lang/Override");
1995 1998
 			bridgeWriter.start();

Loading…
Cancel
Save