X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fcodegen%2Ftypes%2FJavaReferenceValidator.java;fp=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fcodegen%2Ftypes%2FJavaReferenceValidator.java;h=21f775e53e66be29c7563f03ca8a1dcdda4080a9;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/JavaReferenceValidator.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/JavaReferenceValidator.java new file mode 100644 index 000000000..21f775e53 --- /dev/null +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/JavaReferenceValidator.java @@ -0,0 +1,43 @@ +package org.simantics.scl.compiler.internal.codegen.types; + +import org.cojen.classfile.TypeDesc; +import org.simantics.scl.compiler.constants.generic.ClassRef; + +@SuppressWarnings("hiding") +public interface JavaReferenceValidator { + + /** + * Tries to find the given class or returns null if the class + * does not exist. + */ + Class findClass(TypeDesc name); + + boolean isInterface(Class clazz); + + boolean isPublic(Class clazz); + + /** + * Finds all methods that are compatible with type + *
types[0] -> types[1] -> ... -> types[types.length-1]
+ */ + Method[] findCompatibleMethods(Class clazz, boolean isStatic, String name, + TypeDesc[] parameterTypes, TypeDesc returnType); + TypeDesc getReturnType(Method method); + TypeDesc[] getParameterTypes(Method method); + + Constructor[] findCompatibleConstructors(Class clazz, TypeDesc[] types); + TypeDesc[] getConstructorParameterTypes(Constructor constructor); + + Field findField(Class clazz, String name); + boolean isStaticField(Field field); + TypeDesc getFieldType(Field field); + boolean isAssignableFrom(TypeDesc to, TypeDesc from); + + Method[] chooseBest(Method[] methods); + + /** + * Returns a class ref object to the class or null if the + * class is not found. + */ + ClassRef getClassRef(String className); +}