public class TypeChecker extends Object
It checks that JSweet authorized APIs are used, and that auxiliary types such as unions are valid.
| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
AUTHORIZED_OBJECT_METHODS
Methods that can be invoked on
java.lang.Object from JSweet. |
static Set<String> |
AUTHORIZED_STRING_METHODS
Methods that can be invoked on
java.lang.String from JSweet. |
static Set<String> |
FORBIDDEN_JDK_FUNCTIONAL_METHODS
Methods that cannot be invoked on
java.util.function classes
from JSweet. |
static boolean |
jdkAllowed |
static Set<String> |
NUMBER_TYPE_NAMES
Java types that represent numbers (simple names).
|
static Set<String> |
NUMBER_TYPES
Java types that represent numbers (qualified names).
|
| Constructor and Description |
|---|
TypeChecker(AbstractTreePrinter translator)
Creates a new type checker object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkApply(com.sun.tools.javac.tree.JCTree.JCMethodInvocation invocation,
com.sun.tools.javac.code.Symbol.MethodSymbol methSym)
Checks that the given invocation conforms to JSweet contraints.
|
boolean |
checkSelect(com.sun.tools.javac.tree.JCTree.JCFieldAccess select)
Checks that the given field access conforms to JSweet contraints.
|
boolean |
checkType(com.sun.tools.javac.tree.JCTree declaringElement,
com.sun.tools.javac.util.Name declaringElementName,
com.sun.tools.javac.tree.JCTree.JCExpression typeExpression)
Checks that the given type is JSweet compatible.
|
boolean |
checkUnionTypeAssignment(com.sun.tools.javac.code.Types types,
com.sun.tools.javac.tree.JCTree parent,
com.sun.tools.javac.tree.JCTree.JCMethodInvocation union)
Checks that the given union type assignment conforms to JSweet
contraints.
|
public static boolean jdkAllowed
public static final Set<String> NUMBER_TYPES
public static final Set<String> NUMBER_TYPE_NAMES
public static final Set<String> AUTHORIZED_OBJECT_METHODS
java.lang.Object from JSweet.public static final Set<String> AUTHORIZED_STRING_METHODS
java.lang.String from JSweet.public TypeChecker(AbstractTreePrinter translator)
public boolean checkApply(com.sun.tools.javac.tree.JCTree.JCMethodInvocation invocation,
com.sun.tools.javac.code.Symbol.MethodSymbol methSym)
public boolean checkType(com.sun.tools.javac.tree.JCTree declaringElement,
com.sun.tools.javac.util.Name declaringElementName,
com.sun.tools.javac.tree.JCTree.JCExpression typeExpression)
public boolean checkSelect(com.sun.tools.javac.tree.JCTree.JCFieldAccess select)
public boolean checkUnionTypeAssignment(com.sun.tools.javac.code.Types types,
com.sun.tools.javac.tree.JCTree parent,
com.sun.tools.javac.tree.JCTree.JCMethodInvocation union)