lazy initialization of classes
This commit is contained in:
@@ -40,6 +40,10 @@ fun Any?.equals(other : Any?) : Boolean// = this === other
|
|||||||
// Returns "null" for null
|
// Returns "null" for null
|
||||||
fun Any?.toString() : String// = this === other
|
fun Any?.toString() : String// = this === other
|
||||||
|
|
||||||
|
// fun <T> array(vararg elements : T) : Array<T>
|
||||||
|
|
||||||
|
// fun array(vararg elements : Int) : IntArray
|
||||||
|
|
||||||
fun String?.plus(other: Any?) : String
|
fun String?.plus(other: Any?) : String
|
||||||
|
|
||||||
trait Iterator<out T> {
|
trait Iterator<out T> {
|
||||||
|
|||||||
@@ -47,68 +47,70 @@ public class JetStandardLibrary {
|
|||||||
// return standardLibrary;
|
// return standardLibrary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final JetScope libraryScope;
|
private JetScope libraryScope;
|
||||||
|
|
||||||
private final ClassDescriptor byteClass;
|
private ClassDescriptor byteClass;
|
||||||
private final ClassDescriptor charClass;
|
private ClassDescriptor charClass;
|
||||||
private final ClassDescriptor shortClass;
|
private ClassDescriptor shortClass;
|
||||||
private final ClassDescriptor intClass;
|
private ClassDescriptor intClass;
|
||||||
private final ClassDescriptor longClass;
|
private ClassDescriptor longClass;
|
||||||
private final ClassDescriptor floatClass;
|
private ClassDescriptor floatClass;
|
||||||
private final ClassDescriptor doubleClass;
|
private ClassDescriptor doubleClass;
|
||||||
private final ClassDescriptor booleanClass;
|
private ClassDescriptor booleanClass;
|
||||||
private final ClassDescriptor stringClass;
|
|
||||||
private final ClassDescriptor arrayClass;
|
|
||||||
private final ClassDescriptor iterableClass;
|
|
||||||
private final ClassDescriptor typeInfoClass;
|
|
||||||
|
|
||||||
private final JetType byteType;
|
private ClassDescriptor stringClass;
|
||||||
private final JetType charType;
|
private ClassDescriptor arrayClass;
|
||||||
private final JetType shortType;
|
private ClassDescriptor iterableClass;
|
||||||
private final JetType intType;
|
private ClassDescriptor typeInfoClass;
|
||||||
private final JetType longType;
|
|
||||||
private final JetType floatType;
|
|
||||||
private final JetType doubleType;
|
|
||||||
private final JetType booleanType;
|
|
||||||
private final JetType stringType;
|
|
||||||
|
|
||||||
private final JetType nullableByteType;
|
private JetType byteType;
|
||||||
private final JetType nullableCharType;
|
private JetType charType;
|
||||||
private final JetType nullableShortType;
|
private JetType shortType;
|
||||||
private final JetType nullableIntType;
|
private JetType intType;
|
||||||
private final JetType nullableLongType;
|
private JetType longType;
|
||||||
private final JetType nullableFloatType;
|
private JetType floatType;
|
||||||
private final JetType nullableDoubleType;
|
private JetType doubleType;
|
||||||
private final JetType nullableBooleanType;
|
private JetType booleanType;
|
||||||
private final JetType nullableTuple0Type;
|
|
||||||
|
|
||||||
private final ClassDescriptor byteArrayClass;
|
private JetType stringType;
|
||||||
private final ClassDescriptor charArrayClass;
|
|
||||||
private final ClassDescriptor shortArrayClass;
|
|
||||||
private final ClassDescriptor intArrayClass;
|
|
||||||
private final ClassDescriptor longArrayClass;
|
|
||||||
private final ClassDescriptor floatArrayClass;
|
|
||||||
private final ClassDescriptor doubleArrayClass;
|
|
||||||
private final ClassDescriptor booleanArrayClass;
|
|
||||||
|
|
||||||
private final JetType byteArrayType;
|
private JetType nullableByteType;
|
||||||
private final JetType charArrayType;
|
private JetType nullableCharType;
|
||||||
private final JetType shortArrayType;
|
private JetType nullableShortType;
|
||||||
private final JetType intArrayType;
|
private JetType nullableIntType;
|
||||||
private final JetType longArrayType;
|
private JetType nullableLongType;
|
||||||
private final JetType floatArrayType;
|
private JetType nullableFloatType;
|
||||||
private final JetType doubleArrayType;
|
private JetType nullableDoubleType;
|
||||||
private final JetType booleanArrayType;
|
private JetType nullableBooleanType;
|
||||||
|
private JetType nullableTuple0Type;
|
||||||
|
|
||||||
|
private ClassDescriptor byteArrayClass;
|
||||||
|
private ClassDescriptor charArrayClass;
|
||||||
|
private ClassDescriptor shortArrayClass;
|
||||||
|
private ClassDescriptor intArrayClass;
|
||||||
|
private ClassDescriptor longArrayClass;
|
||||||
|
private ClassDescriptor floatArrayClass;
|
||||||
|
private ClassDescriptor doubleArrayClass;
|
||||||
|
private ClassDescriptor booleanArrayClass;
|
||||||
|
|
||||||
|
private JetType byteArrayType;
|
||||||
|
private JetType charArrayType;
|
||||||
|
private JetType shortArrayType;
|
||||||
|
private JetType intArrayType;
|
||||||
|
private JetType longArrayType;
|
||||||
|
private JetType floatArrayType;
|
||||||
|
private JetType doubleArrayType;
|
||||||
|
private JetType booleanArrayType;
|
||||||
|
|
||||||
public JetType getTuple0Type() {
|
public JetType getTuple0Type() {
|
||||||
return tuple0Type;
|
return tuple0Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final JetType tuple0Type;
|
private JetType tuple0Type;
|
||||||
private final JetType nullableStringType;
|
private JetType nullableStringType;
|
||||||
|
|
||||||
private final NamespaceDescriptor typeInfoNamespace;
|
private NamespaceDescriptor typeInfoNamespace;
|
||||||
private final Set<FunctionDescriptor> typeInfoFunction;
|
private Set<FunctionDescriptor> typeInfoFunction;
|
||||||
|
|
||||||
private JetStandardLibrary(@NotNull Project project) {
|
private JetStandardLibrary(@NotNull Project project) {
|
||||||
// TODO : review
|
// TODO : review
|
||||||
@@ -124,10 +126,23 @@ public class JetStandardLibrary {
|
|||||||
// this.libraryScope = bootstrappingTDA.process(JetStandardClasses.STANDARD_CLASSES, file.getRootNamespace().getDeclarations());
|
// this.libraryScope = bootstrappingTDA.process(JetStandardClasses.STANDARD_CLASSES, file.getRootNamespace().getDeclarations());
|
||||||
// bootstrappingTDA.process(writableScope, JetStandardClasses.STANDARD_CLASSES_NAMESPACE, file.getRootNamespace().getDeclarations());
|
// bootstrappingTDA.process(writableScope, JetStandardClasses.STANDARD_CLASSES_NAMESPACE, file.getRootNamespace().getDeclarations());
|
||||||
TopDownAnalyzer.processStandardLibraryNamespace(bootstrappingSemanticServices, bindingTraceContext, writableScope, JetStandardClasses.STANDARD_CLASSES_NAMESPACE, file.getRootNamespace());
|
TopDownAnalyzer.processStandardLibraryNamespace(bootstrappingSemanticServices, bindingTraceContext, writableScope, JetStandardClasses.STANDARD_CLASSES_NAMESPACE, file.getRootNamespace());
|
||||||
this.libraryScope = JetStandardClasses.STANDARD_CLASSES_NAMESPACE.getMemberScope();
|
// this.libraryScope = JetStandardClasses.STANDARD_CLASSES_NAMESPACE.getMemberScope();
|
||||||
|
|
||||||
AnalyzingUtils.throwExceptionOnErrors(bindingTraceContext.getBindingContext());
|
AnalyzingUtils.throwExceptionOnErrors(bindingTraceContext.getBindingContext());
|
||||||
|
initStdClasses();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public JetScope getLibraryScope() {
|
||||||
|
initStdClasses();
|
||||||
|
return libraryScope;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initStdClasses() {
|
||||||
|
if(libraryScope == null) {
|
||||||
|
this.libraryScope = JetStandardClasses.STANDARD_CLASSES_NAMESPACE.getMemberScope();
|
||||||
this.byteClass = (ClassDescriptor) libraryScope.getClassifier("Byte");
|
this.byteClass = (ClassDescriptor) libraryScope.getClassifier("Byte");
|
||||||
this.charClass = (ClassDescriptor) libraryScope.getClassifier("Char");
|
this.charClass = (ClassDescriptor) libraryScope.getClassifier("Char");
|
||||||
this.shortClass = (ClassDescriptor) libraryScope.getClassifier("Short");
|
this.shortClass = (ClassDescriptor) libraryScope.getClassifier("Short");
|
||||||
@@ -138,6 +153,7 @@ public class JetStandardLibrary {
|
|||||||
this.booleanClass = (ClassDescriptor) libraryScope.getClassifier("Boolean");
|
this.booleanClass = (ClassDescriptor) libraryScope.getClassifier("Boolean");
|
||||||
this.stringClass = (ClassDescriptor) libraryScope.getClassifier("String");
|
this.stringClass = (ClassDescriptor) libraryScope.getClassifier("String");
|
||||||
this.arrayClass = (ClassDescriptor) libraryScope.getClassifier("Array");
|
this.arrayClass = (ClassDescriptor) libraryScope.getClassifier("Array");
|
||||||
|
|
||||||
this.iterableClass = (ClassDescriptor) libraryScope.getClassifier("Iterable");
|
this.iterableClass = (ClassDescriptor) libraryScope.getClassifier("Iterable");
|
||||||
typeInfoNamespace = libraryScope.getNamespace("typeinfo");
|
typeInfoNamespace = libraryScope.getNamespace("typeinfo");
|
||||||
this.typeInfoClass = (ClassDescriptor) typeInfoNamespace.getMemberScope().getClassifier("TypeInfo");
|
this.typeInfoClass = (ClassDescriptor) typeInfoNamespace.getMemberScope().getClassifier("TypeInfo");
|
||||||
@@ -182,79 +198,87 @@ public class JetStandardLibrary {
|
|||||||
this.nullableBooleanType = TypeUtils.makeNullable(booleanType);
|
this.nullableBooleanType = TypeUtils.makeNullable(booleanType);
|
||||||
this.nullableStringType = TypeUtils.makeNullable(stringType);
|
this.nullableStringType = TypeUtils.makeNullable(stringType);
|
||||||
this.nullableTuple0Type = TypeUtils.makeNullable(tuple0Type);
|
this.nullableTuple0Type = TypeUtils.makeNullable(tuple0Type);
|
||||||
} catch (IOException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetScope getLibraryScope() {
|
|
||||||
return libraryScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getByte() {
|
public ClassDescriptor getByte() {
|
||||||
|
initStdClasses();
|
||||||
return byteClass;
|
return byteClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getChar() {
|
public ClassDescriptor getChar() {
|
||||||
|
initStdClasses();
|
||||||
return charClass;
|
return charClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getShort() {
|
public ClassDescriptor getShort() {
|
||||||
|
initStdClasses();
|
||||||
return shortClass;
|
return shortClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getInt() {
|
public ClassDescriptor getInt() {
|
||||||
|
initStdClasses();
|
||||||
return intClass;
|
return intClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getLong() {
|
public ClassDescriptor getLong() {
|
||||||
|
initStdClasses();
|
||||||
return longClass;
|
return longClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getFloat() {
|
public ClassDescriptor getFloat() {
|
||||||
|
initStdClasses();
|
||||||
return floatClass;
|
return floatClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getDouble() {
|
public ClassDescriptor getDouble() {
|
||||||
|
initStdClasses();
|
||||||
return doubleClass;
|
return doubleClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getBoolean() {
|
public ClassDescriptor getBoolean() {
|
||||||
|
initStdClasses();
|
||||||
return booleanClass;
|
return booleanClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getString() {
|
public ClassDescriptor getString() {
|
||||||
|
initStdClasses();
|
||||||
return stringClass;
|
return stringClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getArray() {
|
public ClassDescriptor getArray() {
|
||||||
|
initStdClasses();
|
||||||
return arrayClass;
|
return arrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ClassDescriptor getIterable() {
|
public ClassDescriptor getIterable() {
|
||||||
|
initStdClasses();
|
||||||
return iterableClass;
|
return iterableClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NamespaceDescriptor getTypeInfoNamespace() {
|
public NamespaceDescriptor getTypeInfoNamespace() {
|
||||||
|
initStdClasses();
|
||||||
return typeInfoNamespace;
|
return typeInfoNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getTypeInfo() {
|
public ClassDescriptor getTypeInfo() {
|
||||||
|
initStdClasses();
|
||||||
return typeInfoClass;
|
return typeInfoClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<FunctionDescriptor> getTypeInfoFunctions() {
|
public Set<FunctionDescriptor> getTypeInfoFunctions() {
|
||||||
|
initStdClasses();
|
||||||
return typeInfoFunction;
|
return typeInfoFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,46 +291,55 @@ public class JetStandardLibrary {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getIntType() {
|
public JetType getIntType() {
|
||||||
|
initStdClasses();
|
||||||
return intType;
|
return intType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getLongType() {
|
public JetType getLongType() {
|
||||||
|
initStdClasses();
|
||||||
return longType;
|
return longType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getDoubleType() {
|
public JetType getDoubleType() {
|
||||||
|
initStdClasses();
|
||||||
return doubleType;
|
return doubleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getFloatType() {
|
public JetType getFloatType() {
|
||||||
|
initStdClasses();
|
||||||
return floatType;
|
return floatType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getCharType() {
|
public JetType getCharType() {
|
||||||
|
initStdClasses();
|
||||||
return charType;
|
return charType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getBooleanType() {
|
public JetType getBooleanType() {
|
||||||
|
initStdClasses();
|
||||||
return booleanType;
|
return booleanType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getStringType() {
|
public JetType getStringType() {
|
||||||
|
initStdClasses();
|
||||||
return stringType;
|
return stringType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getByteType() {
|
public JetType getByteType() {
|
||||||
|
initStdClasses();
|
||||||
return byteType;
|
return byteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetType getShortType() {
|
public JetType getShortType() {
|
||||||
|
initStdClasses();
|
||||||
return shortType;
|
return shortType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,106 +373,132 @@ public class JetStandardLibrary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableStringType() {
|
public JetType getNullableStringType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableStringType;
|
return nullableStringType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableByteType() {
|
public JetType getNullableByteType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableByteType;
|
return nullableByteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableCharType() {
|
public JetType getNullableCharType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableCharType;
|
return nullableCharType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableShortType() {
|
public JetType getNullableShortType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableShortType;
|
return nullableShortType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableIntType() {
|
public JetType getNullableIntType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableIntType;
|
return nullableIntType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableLongType() {
|
public JetType getNullableLongType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableLongType;
|
return nullableLongType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableFloatType() {
|
public JetType getNullableFloatType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableFloatType;
|
return nullableFloatType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableDoubleType() {
|
public JetType getNullableDoubleType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableDoubleType;
|
return nullableDoubleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableBooleanType() {
|
public JetType getNullableBooleanType() {
|
||||||
|
initStdClasses();
|
||||||
return nullableBooleanType;
|
return nullableBooleanType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getNullableTuple0Type() {
|
public JetType getNullableTuple0Type() {
|
||||||
|
initStdClasses();
|
||||||
return nullableTuple0Type;
|
return nullableTuple0Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getBooleanArrayType() {
|
public JetType getBooleanArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return booleanArrayType;
|
return booleanArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getByteArrayType() {
|
public JetType getByteArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return byteArrayType;
|
return byteArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getCharArrayType() {
|
public JetType getCharArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return charArrayType;
|
return charArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getShortArrayType() {
|
public JetType getShortArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return shortArrayType;
|
return shortArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getIntArrayType() {
|
public JetType getIntArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return intArrayType;
|
return intArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getLongArrayType() {
|
public JetType getLongArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return longArrayType;
|
return longArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getFloatArrayType() {
|
public JetType getFloatArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return floatArrayType;
|
return floatArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JetType getDoubleArrayType() {
|
public JetType getDoubleArrayType() {
|
||||||
|
initStdClasses();
|
||||||
return doubleArrayType;
|
return doubleArrayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getByteArrayClass() {
|
public ClassDescriptor getByteArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return byteArrayClass;
|
return byteArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getCharArrayClass() {
|
public ClassDescriptor getCharArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return charArrayClass;
|
return charArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getShortArrayClass() {
|
public ClassDescriptor getShortArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return shortArrayClass;
|
return shortArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getIntArrayClass() {
|
public ClassDescriptor getIntArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return intArrayClass;
|
return intArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getLongArrayClass() {
|
public ClassDescriptor getLongArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return longArrayClass;
|
return longArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getFloatArrayClass() {
|
public ClassDescriptor getFloatArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return floatArrayClass;
|
return floatArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getDoubleArrayClass() {
|
public ClassDescriptor getDoubleArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return doubleArrayClass;
|
return doubleArrayClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDescriptor getBooleanArrayClass() {
|
public ClassDescriptor getBooleanArrayClass() {
|
||||||
|
initStdClasses();
|
||||||
return booleanArrayClass;
|
return booleanArrayClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,4 +59,14 @@ public class VarArgTest extends CodegenTestCase {
|
|||||||
assertTrue(((String[])res).length == 1);
|
assertTrue(((String[])res).length == 1);
|
||||||
assertTrue(((String[])res)[0].equals("239"));
|
assertTrue(((String[])res)[0].equals("239"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testArrayT () throws InvocationTargetException, IllegalAccessException {
|
||||||
|
loadText("fun test() = _array(2, 4); fun <T> _array(vararg elements : T) = elements");
|
||||||
|
System.out.println(generateToText());
|
||||||
|
final Method main = generateFunction();
|
||||||
|
Object res = main.invoke(null, new Object[]{});
|
||||||
|
assertTrue(((Integer[])res).length == 2);
|
||||||
|
assertTrue(((Integer[])res)[0].equals(2));
|
||||||
|
assertTrue(((Integer[])res)[1].equals(4));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user