|
@@ -13,6 +13,7 @@ import org.openzen.zencode.shared.CodePosition;
|
13
|
13
|
import org.openzen.zenscript.codemodel.FunctionHeader;
|
14
|
14
|
import org.openzen.zenscript.codemodel.FunctionParameter;
|
15
|
15
|
import org.openzen.zenscript.codemodel.HighLevelDefinition;
|
|
16
|
+import org.openzen.zenscript.codemodel.Modifiers;
|
16
|
17
|
import org.openzen.zenscript.codemodel.Module;
|
17
|
18
|
import org.openzen.zenscript.codemodel.definition.VariantDefinition;
|
18
|
19
|
import org.openzen.zenscript.codemodel.definition.ZSPackage;
|
|
@@ -100,6 +101,25 @@ public abstract class JavaContext {
|
100
|
101
|
return getPackageName(pkg.parent) + "/" + pkg.name;
|
101
|
102
|
}
|
102
|
103
|
|
|
104
|
+ public JavaMethod getFunctionalInterface(StoredType type) {
|
|
105
|
+ if (type.getSpecifiedStorage() instanceof JavaFunctionalInterfaceStorageTag) {
|
|
106
|
+ JavaFunctionalInterfaceStorageTag tag = (JavaFunctionalInterfaceStorageTag)type.getSpecifiedStorage();
|
|
107
|
+ return tag.method;
|
|
108
|
+ } else {
|
|
109
|
+ FunctionTypeID functionType = (FunctionTypeID)type.type;
|
|
110
|
+ JavaSynthesizedFunctionInstance function = getFunction(functionType);
|
|
111
|
+
|
|
112
|
+ return new JavaMethod(
|
|
113
|
+ function.getCls(),
|
|
114
|
+ JavaMethod.Kind.INTERFACE,
|
|
115
|
+ function.getMethod(),
|
|
116
|
+ false,
|
|
117
|
+ getMethodDescriptor(function.getHeader()),
|
|
118
|
+ Modifiers.PUBLIC | Modifiers.ABSTRACT,
|
|
119
|
+ function.getHeader().getReturnType().isGeneric());
|
|
120
|
+ }
|
|
121
|
+ }
|
|
122
|
+
|
103
|
123
|
protected abstract JavaSyntheticClassGenerator getTypeGenerator();
|
104
|
124
|
|
105
|
125
|
public abstract String getDescriptor(TypeID type);
|