Browse Source

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

kindlich 5 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
 		final String signature;
1961
 		final String signature;
1962
 		final String[] interfaces;
1962
 		final String[] interfaces;
1963
 		final String className = context.getLambdaCounter();
1963
 		final String className = context.getLambdaCounter();
1964
+		final String descriptor;
1964
 		
1965
 		
1965
 		{//Fill the info above
1966
 		{//Fill the info above
1966
 			final StorageTag actualStorage = expression.type.getActualStorage();
1967
 			final StorageTag actualStorage = expression.type.getActualStorage();
1970
 				
1971
 				
1971
 				//Should be the same, should it not?
1972
 				//Should be the same, should it not?
1972
 				signature = context.getMethodSignature(expression.header);
1973
 				signature = context.getMethodSignature(expression.header);
1974
+				descriptor = context.getMethodDescriptor(expression.header);
1973
 				interfaces = new String[]{Type.getInternalName(functionalInterfaceMethod.getDeclaringClass())};
1975
 				interfaces = new String[]{Type.getInternalName(functionalInterfaceMethod.getDeclaringClass())};
1974
 			} else {
1976
 			} else {
1975
 				//Normal way, no casting to functional interface
1977
 				//Normal way, no casting to functional interface
1976
 				signature = context.getMethodSignature(expression.header);
1978
 				signature = context.getMethodSignature(expression.header);
1979
+				descriptor = context.getMethodDescriptor(expression.header);
1977
 				interfaces = new String[]{context.getInternalName(new FunctionTypeID(null, expression.header).stored(UniqueStorageTag.INSTANCE))};
1980
 				interfaces = new String[]{context.getInternalName(new FunctionTypeID(null, expression.header).stored(UniqueStorageTag.INSTANCE))};
1978
 			}
1981
 			}
1979
 		}
1982
 		}
1989
 		final JavaWriter functionWriter;
1992
 		final JavaWriter functionWriter;
1990
 		
1993
 		
1991
 		//Bridge method!!!
1994
 		//Bridge method!!!
1992
-		if (!Objects.equals(methodInfo.descriptor, signature)) {
1995
+		if (!Objects.equals(methodInfo.descriptor, descriptor)) {
1993
 			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);
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
 			final JavaWriter bridgeWriter = new JavaWriter(expression.position, lambdaCW, bridgeMethodInfo, null, methodInfo.descriptor, null, "java/lang/Override");
1997
 			final JavaWriter bridgeWriter = new JavaWriter(expression.position, lambdaCW, bridgeMethodInfo, null, methodInfo.descriptor, null, "java/lang/Override");
1995
 			bridgeWriter.start();
1998
 			bridgeWriter.start();

Loading…
Cancel
Save