Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
The Checker Framework enhances Java’s type system to
make it more powerful and useful. This lets software developers
detect and prevent errors in their Java programs.
The Checker Framework includes compiler plug-ins ("checkers")
that find bugs or verify their absence. It also permits you to
write your own compiler plug-ins.
package org.checkerframework.common.value;
import org.checkerframework.javacutil.ElementUtils;
import org.checkerframework.javacutil.TreeUtils;
import org.checkerframework.javacutil.TypesUtils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Name;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.framework.source.Result;
import com.sun.source.tree.MemberSelectTree;
import com.sun.source.tree.MethodInvocationTree;
import com.sun.source.tree.NewClassTree;
import com.sun.source.tree.Tree;
public class ReflectiveEvalutator {
private BaseTypeChecker checker;
private boolean reportWarnings;
public ReflectiveEvalutator(BaseTypeChecker checker,
ValueAnnotatedTypeFactory factory, boolean reportWarnings) {
this.checker = checker;
this.reportWarnings = reportWarnings;
}
/**
*
* @param allArgValues
* a list of list where the first list corresponds to all
* possible values for the first argument. Pass null to indicate
* that the method has no arguments.
* @param receiverValues
* a list of possible receiver values. null indicates that the
* method has no receiver
* @param tree
* location to report any errors
* @return all possible values that the method may return
*/
public List evaluteMethodCall(List> allArgValues,
List receiverValues, MethodInvocationTree tree) {
Method method = getMethodObject(tree);
if (method == null) {
return new ArrayList<>();
}
if (receiverValues == null) {
// Method does not have a receiver
// the first parameter of Method.invoke should be null
receiverValues = Collections.singletonList(null);
}
List