Package org.checkerframework.javacutil
Class Resolver
java.lang.Object
org.checkerframework.javacutil.Resolver
A utility class to find symbols corresponding to string references (identifiers).
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectBuild an instance ofResolve$MethodResolutionContext.Finds the class literal with namename.@Nullable com.sun.tools.javac.code.Symbol.ClassSymbolfindClassInPackage(String name, com.sun.tools.javac.code.Symbol.PackageSymbol pck, TreePath path) Finds the class with namenamein a given package.findField(String name, TypeMirror type, TreePath path) Finds the field with namenameintypeor a superclass or superinterface oftype.findLocalVariableOrParameter(String name, TreePath path) Finds the local variable (including formal parameters) with namenamein the given scope.findMethod(String methodName, TypeMirror receiverType, TreePath path, List<TypeMirror> argumentTypes) Finds the method element for a given name and list of expected parameter types.@Nullable com.sun.tools.javac.code.Symbol.PackageSymbolfindPackage(String name, TreePath path) Finds the package with namename.com.sun.tools.javac.comp.Env<com.sun.tools.javac.comp.AttrContext>getEnvForPath(TreePath path) Determine the environment for the given path.
- 
Constructor Details- 
Resolver
 
- 
- 
Method Details- 
getEnvForPathpublic com.sun.tools.javac.comp.Env<com.sun.tools.javac.comp.AttrContext> getEnvForPath(TreePath path) Determine the environment for the given path.- Parameters:
- path- the tree path to the local scope
- Returns:
- the corresponding attribution environment
 
- 
findPackagepublic @Nullable com.sun.tools.javac.code.Symbol.PackageSymbol findPackage(String name, TreePath path) Finds the package with namename.- Parameters:
- name- the name of the package
- path- the tree path to the local scope
- Returns:
- the PackageSymbolfor the package if it is found,nullotherwise
 
- 
findFieldFinds the field with namenameintypeor a superclass or superinterface oftype.The method adheres to all the rules of Java's scoping (while also considering the imports) for name resolution. - Parameters:
- name- the name of the field
- type- the type of the receiver (i.e., the type in which to look for the field)
- path- the tree path to the local scope
- Returns:
- the element for the field, nullotherwise
 
- 
findLocalVariableOrParameterFinds the local variable (including formal parameters) with namenamein the given scope.- Parameters:
- name- the name of the local variable
- path- the tree path to the local scope
- Returns:
- the element for the local variable, nullotherwise
 
- 
findClassFinds the class literal with namename.The method adheres to all the rules of Java's scoping (while also considering the imports) for name resolution. - Parameters:
- name- the name of the class
- path- the tree path to the local scope
- Returns:
- the element for the class
 
- 
findClassInPackagepublic @Nullable com.sun.tools.javac.code.Symbol.ClassSymbol findClassInPackage(String name, com.sun.tools.javac.code.Symbol.PackageSymbol pck, TreePath path) Finds the class with namenamein a given package.- Parameters:
- name- the name of the class
- pck- the PackageSymbol for the package
- path- the tree path to the local scope
- Returns:
- the ClassSymbolfor the class if it is found,nullotherwise
 
- 
findMethodpublic @Nullable ExecutableElement findMethod(String methodName, TypeMirror receiverType, TreePath path, List<TypeMirror> argumentTypes) Finds the method element for a given name and list of expected parameter types.The method adheres to all the rules of Java's scoping (while also considering the imports) for name resolution. (This method takes into account autoboxing.) This method is a wrapper around com.sun.tools.javac.comp.Resolve.findMethod.- Parameters:
- methodName- name of the method to find
- receiverType- type of the receiver of the method
- path- tree path
- argumentTypes- types of arguments passed to the method call
- Returns:
- the method element (if found)
 
- 
buildMethodContextprotected Object buildMethodContext() throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldExceptionBuild an instance ofResolve$MethodResolutionContext.
 
-