public class TypeEvaluator
extends java.lang.Object
var
in this code snippet:
Object o = new StringBuilder();
Object var = o;
it will return "java.lang.StringBuilder".
NOTE: This type evaluator does not (yet) compute the correct types when involving implicit type conversions, so be careful if using this for primitives; e.g. for "int * long" it might return the type "int".
| Constructor and Description |
|---|
TypeEvaluator(com.android.tools.lint.detector.api.JavaContext context)
Creates a new constant evaluator
|
| Modifier and Type | Method and Description |
|---|---|
static com.intellij.psi.PsiType |
evaluate(com.android.tools.lint.detector.api.JavaContext context,
com.intellij.psi.PsiElement node)
Evaluates the given node and returns the likely type of the instance.
|
com.intellij.psi.PsiType |
evaluate(com.intellij.psi.PsiElement node)
Returns the inferred type of the given node
|
static com.intellij.psi.PsiType |
evaluate(org.jetbrains.uast.UElement node) |
public TypeEvaluator(@Nullable
com.android.tools.lint.detector.api.JavaContext context)
context - the context to use to resolve field references, if any@Nullable
public com.intellij.psi.PsiType evaluate(@Nullable
com.intellij.psi.PsiElement node)
@Nullable
public static com.intellij.psi.PsiType evaluate(@Nullable
org.jetbrains.uast.UElement node)
@Nullable
public static com.intellij.psi.PsiType evaluate(@NonNull
com.android.tools.lint.detector.api.JavaContext context,
@NonNull
com.intellij.psi.PsiElement node)
context - the context to use to resolve field references, if anynode - the node to compute the type for