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.
Checker Qual is the set of annotations (qualifiers) and supporting classes
used by the Checker Framework to type check Java source code. Please
see artifact:
org.checkerframework:checker
package org.checkerframework.common.wholeprograminference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeMirror;
import org.checkerframework.framework.util.AnnotationBuilder;
import org.checkerframework.javacutil.AnnotationUtils;
import org.checkerframework.javacutil.ErrorReporter;
import annotations.Annotation;
import annotations.el.AnnotationDef;
import annotations.field.AnnotationFieldType;
import annotations.field.ArrayAFT;
import annotations.field.BasicAFT;
import annotations.field.ScalarAFT;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Attribute.Array;
import com.sun.tools.javac.code.Type.ArrayType;
/**
* This class has auxiliary methods that performs conversion between
* {@link annotations.Annotation} and
* {@link javax.lang.model.element.AnnotationMirror}.
* @author pbsf
*/
public class AnnotationConverter {
/**
* Converts an {@link javax.lang.model.element.AnnotationMirror}
* into an {@link annotations.Annotation}.
*/
protected static Annotation annotationMirrorToAnnotation(AnnotationMirror am) {
AnnotationDef def = new AnnotationDef(AnnotationUtils.annotationName(am));
Map fieldTypes = new HashMap<>();
// Handling cases where there are fields in annotations.
for (ExecutableElement ee : am.getElementValues().keySet()) {
AnnotationFieldType aft = getAnnotationFieldType(ee, am.
getElementValues().get(ee).getValue());
if (aft == null) return null;
// Here we just add the type of the field into fieldTypes.
fieldTypes.put(ee.getSimpleName().toString(), aft);
}
def.setFieldTypes(fieldTypes);
// Now, we handle the values of those types below
Map values =
am.getElementValues();
Map newValues = new HashMap<>();
for (ExecutableElement ee : values.keySet()) {
Object value = values.get(ee).getValue();
if (value instanceof List) {
@SuppressWarnings("unchecked")
List