diff --git a/CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/InterfaceDefinition.java b/CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/InterfaceDefinition.java index 6dc0257f..0ea1e780 100644 --- a/CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/InterfaceDefinition.java +++ b/CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/InterfaceDefinition.java @@ -8,11 +8,15 @@ import org.openzen.zenscript.codemodel.compilation.ResolvingType; import org.openzen.zenscript.codemodel.identifiers.ModuleSymbol; import org.openzen.zenscript.codemodel.identifiers.TypeSymbol; +import org.openzen.zenscript.codemodel.member.IDefinitionMember; +import org.openzen.zenscript.codemodel.type.DefinitionTypeID; import org.openzen.zenscript.codemodel.type.TypeID; import org.openzen.zenscript.codemodel.type.member.InterfaceResolvingType; import org.openzen.zenscript.codemodel.type.member.MemberSet; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; public class InterfaceDefinition extends HighLevelDefinition { @@ -39,6 +43,19 @@ public R accept(C context, DefinitionVisitorWithContext visitor) { @Override public ResolvingType resolve(TypeID[] typeArguments) { - return InterfaceResolvingType.of(super.resolve(typeArguments), baseInterfaces); + if (baseInterfaces.isEmpty()) { + return InterfaceResolvingType.of(super.resolve(typeArguments), Collections.emptyList()); + } else { + TypeID type = DefinitionTypeID.create(this, typeArguments); + + MemberSet.Builder members = MemberSet.create(type); + GenericMapper mapper = GenericMapper.create(typeParameters, typeArguments); + for (IDefinitionMember member : this.members) { + member.registerTo(type, members, mapper); + } + + TypeID[] baseInterfaces = this.baseInterfaces.toArray(TypeID.NONE); + return InterfaceResolvingType.of(super.resolve(typeArguments), Arrays.asList(mapper.map(baseInterfaces))); + } } } diff --git a/JavaIntegration/src/main/java/org/openzen/zencode/java/impl/conversion/JdkJavaRuntimeConverter.java b/JavaIntegration/src/main/java/org/openzen/zencode/java/impl/conversion/JdkJavaRuntimeConverter.java index ec53654f..3ceb2cc4 100644 --- a/JavaIntegration/src/main/java/org/openzen/zencode/java/impl/conversion/JdkJavaRuntimeConverter.java +++ b/JavaIntegration/src/main/java/org/openzen/zencode/java/impl/conversion/JdkJavaRuntimeConverter.java @@ -32,7 +32,7 @@ public Optional resolveJavaType(Class javaType) { private void fillJavaClassToZenCodeClassName() { fillMapping(List.class, "stdlib.List"); - fillMapping(Collection.class, "stdlib.List"); + fillMapping(Collection.class, "javalib.Collection"); fillMapping(Comparable.class, "stdlib.Comparable"); fillMapping(Exception.class, "stdlib.Exception"); fillMapping(IllegalArgumentException.class, "stdlib.IllegalArgumentException"); diff --git a/JavaIntegration/src/main/java/org/openzen/zencode/java/module/JavaNativeTypeTemplate.java b/JavaIntegration/src/main/java/org/openzen/zencode/java/module/JavaNativeTypeTemplate.java index 3bea7aa7..d861941e 100644 --- a/JavaIntegration/src/main/java/org/openzen/zencode/java/module/JavaNativeTypeTemplate.java +++ b/JavaIntegration/src/main/java/org/openzen/zencode/java/module/JavaNativeTypeTemplate.java @@ -29,7 +29,6 @@ import java.lang.reflect.Modifier; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.Stream; public class JavaNativeTypeTemplate { protected final JavaRuntimeClass class_; diff --git a/JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java b/JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java index 8e41d85a..b6b757af 100644 --- a/JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java +++ b/JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java @@ -46,6 +46,18 @@ public class JavaPrepareDefinitionVisitor implements DefinitionVisitor getRequiredStdLibModules() { - return Collections.singletonList("stdlib"); + return Arrays.asList("stdlib", "javalib"); } @Override diff --git a/StdLibs b/StdLibs index d21d9972..ac25693f 160000 --- a/StdLibs +++ b/StdLibs @@ -1 +1 @@ -Subproject commit d21d9972e1bda49975d5151951782809560d29a4 +Subproject commit ac25693fa61257e8b87b4c7bbcdba767db45a880