]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/JavaReferenceValidator.java
Added module header feature to SCL language.
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / types / JavaReferenceValidator.java
1 package org.simantics.scl.compiler.internal.codegen.types;
2
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.constants.generic.ClassRef;
5
6 @SuppressWarnings("hiding")
7 public interface JavaReferenceValidator<Class,Method,Field,Constructor> {
8
9     /**
10      * Tries to find the given class or returns null if the class
11      * does not exist.
12      */
13     Class findClass(TypeDesc name);
14     
15     boolean isInterface(Class clazz);
16     
17     boolean isPublic(Class clazz);
18     
19     /**
20      * Finds all methods that are compatible with type
21      * <pre>types[0] -> types[1] -> ... -> types[types.length-1]</pre> 
22      */
23     Method[] findCompatibleMethods(Class clazz, boolean isStatic, String name, 
24             TypeDesc[] parameterTypes, TypeDesc returnType);
25     TypeDesc getReturnType(Method method);    
26     TypeDesc[] getParameterTypes(Method method);
27
28     Constructor[] findCompatibleConstructors(Class clazz, TypeDesc[] types);
29     TypeDesc[] getConstructorParameterTypes(Constructor constructor);
30     
31     Field findField(Class clazz, String name);
32     boolean isStaticField(Field field);
33     TypeDesc getFieldType(Field field);
34     boolean isAssignableFrom(TypeDesc to, TypeDesc from);
35
36     Method[] chooseBest(Method[] methods);
37     
38     /**
39      * Returns a class ref object to the class or null if the
40      * class is not found.
41      */
42     ClassRef getClassRef(String className);
43
44     ClassLoader getClassLoader();
45 }