public class TypeEvaluator
extends java.lang.Object
JavaContext.getType(Node)
in that it analyzes the
flow and for example figures out that if you ask for the type of 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(JavaContext context)
Creates a new constant evaluator
|
Modifier and Type | Method and Description |
---|---|
static JavaParser.TypeDescriptor |
evaluate(JavaContext context,
lombok.ast.Node node)
Deprecated.
Use
evaluate(JavaContext, PsiElement) instead |
static com.intellij.psi.PsiType |
evaluate(JavaContext context,
com.intellij.psi.PsiElement node)
Evaluates the given node and returns the likely type of the instance.
|
JavaParser.TypeDescriptor |
evaluate(lombok.ast.Node node)
Deprecated.
Use
evaluate(PsiElement) instead |
com.intellij.psi.PsiType |
evaluate(com.intellij.psi.PsiElement node)
Returns the inferred type of the given node
|
public TypeEvaluator(@Nullable JavaContext context)
context
- the context to use to resolve field references, if any@Deprecated @Nullable public JavaParser.TypeDescriptor evaluate(@NonNull lombok.ast.Node node)
evaluate(PsiElement)
instead@Nullable public com.intellij.psi.PsiType evaluate(@Nullable com.intellij.psi.PsiElement node)
@Deprecated @Nullable public static JavaParser.TypeDescriptor evaluate(@NonNull JavaContext context, @NonNull lombok.ast.Node node)
evaluate(JavaContext, PsiElement)
insteadcontext
- the context to use to resolve field references, if anynode
- the node to compute the type for@Nullable public static com.intellij.psi.PsiType evaluate(@NonNull 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