Przeglądaj źródła

Fixed Bridge methods IncompatibleClassChangeError

Reason was that it tried to invokeInterface whereas a bridge redirects to a local (virtual) method.
The local method was flagged incorrectly as the same type as the bridger which would be interface, hence the error
kindlich 5 lat temu
rodzic
commit
07d6866fb2
Nie znaleziono w bazie danych klucza dla tego podpisu

+ 1
- 1
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/compiler/JavaExpressionVisitor.java Wyświetl plik

@@ -1940,7 +1940,7 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
1940 1940
 				}
1941 1941
 			}
1942 1942
 			
1943
-			bridgeWriter.invokeVirtual(new JavaMethod(JavaClass.fromInternalName(className, JavaClass.Kind.CLASS), methodInfo.kind, methodInfo.name, methodInfo.compile, signature, methodInfo.modifiers, methodInfo.genericResult));
1943
+			bridgeWriter.invokeVirtual(new JavaMethod(JavaClass.fromInternalName(className, JavaClass.Kind.CLASS), JavaMethod.Kind.INSTANCE, methodInfo.name, methodInfo.compile, signature, methodInfo.modifiers, methodInfo.genericResult));
1944 1944
 			if(expression.header.getReturnType().type != BasicTypeID.VOID) {
1945 1945
 				bridgeWriter.returnType(context.getType(expression.header.getReturnType()));
1946 1946
 			}

+ 6
- 6
JavaIntegration/src/main/java/org/openzen/zencode/java/JavaNativeModule.java Wyświetl plik

@@ -878,7 +878,7 @@ public class JavaNativeModule {
878 878
             TypeVariable variable = (TypeVariable) type;
879 879
             return registry.getGeneric(context.get(variable)).stored();
880 880
         }else if(type instanceof AnnotatedType){
881
-		    final TypeID baseType;
881
+		    final StoredType storedType;
882 882
 		    if(type instanceof AnnotatedParameterizedType) {
883 883
                 AnnotatedParameterizedType parameterizedType = (AnnotatedParameterizedType) type;
884 884
                 final Type rawType = ((ParameterizedType) parameterizedType.getType()).getRawType();
@@ -889,22 +889,22 @@ public class JavaNativeModule {
889 889
                 }
890 890
             
891 891
                 if(rawType == Map.class) {
892
-                    baseType = registry.getAssociative(codeParameters[0], codeParameters[1]);
892
+                    storedType = registry.getAssociative(codeParameters[0], codeParameters[1]).stored();
893 893
                 } else {
894 894
                     HighLevelDefinition definition = addClass((Class<?>) rawType);
895
-                    baseType = registry.getForDefinition(definition, codeParameters);
895
+                    storedType = registry.getForDefinition(definition, codeParameters).stored();
896 896
                 }
897 897
             } else {
898
-		        baseType = loadType(context, (AnnotatedElement) ((AnnotatedType) type).getType(), unsigned).type;
898
+		        storedType = loadType(context, (AnnotatedElement) ((AnnotatedType) type).getType(), unsigned);
899 899
             }
900 900
             
901 901
 		    if(type.isAnnotationPresent(ZenCodeStorageTag.class)) {
902 902
 		        //Replace with switch if more StorageTagTypes are added
903 903
                 if(type.getAnnotation(ZenCodeStorageTag.class).value() == StorageTagType.STATIC) {
904
-                    return baseType.stored(StaticStorageTag.INSTANCE);
904
+                    return storedType.type.stored(StorageTag.union(CodePosition.BUILTIN, storedType.getSpecifiedStorage(), StaticStorageTag.INSTANCE));
905 905
                 }
906 906
             }
907
-		    return baseType.stored();
907
+		    return storedType;
908 908
 		    
909 909
         } else {
910 910
 			throw new IllegalArgumentException("Could not analyze type: " + type);

Ładowanie…
Anuluj
Zapisz