本文整理汇总了Java中org.checkerframework.javacutil.AnnotationUtils.areSameIgnoringValues方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationUtils.areSameIgnoringValues方法的具体用法?Java AnnotationUtils.areSameIgnoringValues怎么用?Java AnnotationUtils.areSameIgnoringValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.checkerframework.javacutil.AnnotationUtils
的用法示例。
在下文中一共展示了AnnotationUtils.areSameIgnoringValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDatatypesUsed
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private Collection<String> getDatatypesUsed(Collection<Slot> slots) {
Set<String> types = new TreeSet<>();
for (Slot slot : slots) {
if (slot instanceof ConstantSlot) {
ConstantSlot constantSlot = (ConstantSlot) slot;
AnnotationMirror anno = constantSlot.getValue();
if (AnnotationUtils.areSameIgnoringValues(anno, DATAFLOW)) {
String[] dataflowValues = DataflowUtils.getTypeNames(anno);
for (String dataflowValue : dataflowValues) {
types.add(dataflowValue);
}
}
}
}
return types;
}
示例2: isSubtype
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
if (AnnotationUtils.areSameIgnoringValues(rhs, DATAFLOW)
&& AnnotationUtils.areSameIgnoringValues(lhs, DATAFLOW)) {
return isSubtypeWithRoots(rhs, lhs);
// return isSubtypeWithoutRoots(rhs, lhs);
} else {
//if (rhs != null && lhs != null)
if (AnnotationUtils.areSameIgnoringValues(rhs, DATAFLOW)) {
rhs = DATAFLOW;
} else if (AnnotationUtils.areSameIgnoringValues(lhs, DATAFLOW)) {
lhs = DATAFLOW;
}
return super.isSubtype(rhs, lhs);
}
}
示例3: getDatatypesUsed
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private Collection<String> getDatatypesUsed(Collection<Slot> solts) {
Set<String> types = new TreeSet<>();
for (Slot slot : solts) {
if (slot instanceof ConstantSlot) {
ConstantSlot constantSlot = (ConstantSlot) slot;
AnnotationMirror anno = constantSlot.getValue();
if (AnnotationUtils.areSameIgnoringValues(anno, DATAFLOW)) {
String[] dataflowValues = DataflowUtils.getTypeNames(anno);
for (String dataflowValue : dataflowValues) {
types.add(dataflowValue);
}
}
}
}
return types;
}
示例4: isSubtype
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
if (AnnotationUtils.areSameIgnoringValues(lhs, KEYFOR) &&
AnnotationUtils.areSameIgnoringValues(rhs, KEYFOR)) {
// If they are both KeyFor annotations, they have to be equal.
// TODO: or one a subset of the maps of the other? Ordering of maps?
return AnnotationUtils.areSame(lhs, rhs);
}
// Ignore annotation values to ensure that annotation is in supertype map.
if (AnnotationUtils.areSameIgnoringValues(lhs, KEYFOR)) {
lhs = KEYFOR;
}
if (AnnotationUtils.areSameIgnoringValues(rhs, KEYFOR)) {
rhs = KEYFOR;
}
return super.isSubtype(rhs, lhs);
}
示例5: isSubtype
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
if (AnnotationUtils.areSameIgnoringValues(rhs, REGEX)
&& AnnotationUtils.areSameIgnoringValues(lhs, REGEX)) {
int rhsValue = getRegexValue(rhs);
int lhsValue = getRegexValue(lhs);
return lhsValue <= rhsValue;
}
// TODO: subtyping between PartialRegex?
// Ignore annotation values to ensure that annotation is in supertype map.
if (AnnotationUtils.areSameIgnoringValues(lhs, REGEX)) {
lhs = REGEX;
}
if (AnnotationUtils.areSameIgnoringValues(rhs, REGEX)) {
rhs = REGEX;
}
if (AnnotationUtils.areSameIgnoringValues(lhs, PARTIALREGEX)) {
lhs = PARTIALREGEX;
}
if (AnnotationUtils.areSameIgnoringValues(rhs, PARTIALREGEX)) {
rhs = PARTIALREGEX;
}
return super.isSubtype(rhs, lhs);
}
示例6: isSubtype
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
if (AnnotationUtils.areSameIgnoringValues(lhs, I) &&
AnnotationUtils.areSameIgnoringValues(rhs, I)) {
return AnnotationUtils.areSame(lhs, rhs);
}
// Ignore annotation values to ensure that annotation is in supertype map.
if (AnnotationUtils.areSameIgnoringValues(lhs, I)) {
lhs = I;
}
if (AnnotationUtils.areSameIgnoringValues(rhs, I)) {
rhs = I;
}
return (AnnotationUtils.areSame(rhs, BOTTOM_QUAL)
|| AnnotationUtils.areSame(lhs, BOTTOM_QUAL)
|| super.isSubtype(rhs, lhs));
}
示例7: getHighestAnnotation
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private AnnotationMirror[] getHighestAnnotation(AnnotationMirror a1,
AnnotationMirror a2) {
AnnotationMirror[] higherFirst = new AnnotationMirror[2];
for (AnnotationMirror m : orderedNumberAnnotations) {
if (AnnotationUtils.areSameIgnoringValues(a1, m)) {
higherFirst[0] = a1;
higherFirst[1] = a2;
return higherFirst;
} else if (AnnotationUtils.areSameIgnoringValues(a2, m)) {
higherFirst[0] = a2;
higherFirst[1] = a1;
return higherFirst;
}
}
// No number-type annotation was found
return null;
}
示例8: handleArrayLength
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
/**
* If the receiverType object has an ArrayLen annotation it returns an
* IntVal with all the ArrayLen annotation's values as its possible
* values.
*
* @param receiverType
*/
private AnnotationMirror handleArrayLength(
AnnotatedTypeMirror receiverType) {
AnnotationMirror recAnno = getValueAnnotation(receiverType);
if (AnnotationUtils.areSameIgnoringValues(recAnno, ARRAYLEN)) {
HashSet<Integer> lengthValues = new HashSet<Integer>(
AnnotationUtils.getElementValueArray(recAnno, "value",
Integer.class, true));
return createAnnotation("org.checkerframework.common.value.qual.IntVal",
lengthValues);
} else {
return UNKNOWNVAL;
}
}
示例9: getAnnotationValueClass
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private Class<?> getAnnotationValueClass(AnnotationMirror anno) {
if (AnnotationUtils.areSameIgnoringValues(anno, CHARVAL)) {
return Character.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, INTVAL)) {
return Integer.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, LONGVAL)) {
return Long.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, SHORTVAL)) {
return Short.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, BYTEVAL)) {
return Byte.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, FLOATVAL)) {
return Float.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, DOUBLEVAL)) {
return Double.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, BOOLVAL)) {
return Boolean.class;
} else if (AnnotationUtils.areSameIgnoringValues(anno, STRINGVAL)) {
return String.class;
}
return null;
}
示例10: leastUpperBound
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2) {
if (!AnnotationUtils.areSameIgnoringValues(getTopAnnotation(a1), getTopAnnotation(a2))) {
return null;
} else if (isSubtype(a1, a2)) {
return a2;
} else if (isSubtype(a2, a1)) {
return a1;
} else if (AnnotationUtils.areSameIgnoringValues(a1, a2)) {
return getTopAnnotation(a1);
}
if (lubs == null) {
lubs = calculateLubs();
}
AnnotationPair pair = new AnnotationPair(a1, a2);
return lubs.get(pair);
}
示例11: isSubtype
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
/**
* Most qualifiers have no value fields. However, two annotations with
* values are subtype of each other only if they have the same values.
* i.e. I(m) is a subtype of I(n) iff m = n
*
* When client specifies an annotation, a1, to be a subtype of annotation
* with values, a2, then a1 is a subtype of all instances of a2 regardless
* of a2 values. i.e. IGJBottom is a subtype of all instances of
* {@code @I}.
*
* @param rhs The right-hand side, i.e. the sub qualifier
* @param lhs The left-hand side, i.e. the super qualifier
*/
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
checkAnnoInGraph(rhs);
checkAnnoInGraph(lhs);
/* TODO: this optimization leads to recursion
for (AnnotationMirror top : tops) {
System.out.println("Looking at top: " + tops + " and " + anno1);
// We cannot use getRootAnnotation, as that would use subtyping and recurse
if (isSubtype(anno1, top) && AnnotationUtils.areSame(top, anno2))
return true;
}*/
if (AnnotationUtils.areSameIgnoringValues(rhs, lhs))
return AnnotationUtils.areSame(rhs, lhs);
Set<AnnotationMirror> supermap1 = this.supertypesMap.get(rhs);
return AnnotationUtils.containsSame(supermap1, lhs);
}
示例12: calculateLubs
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private Map<AnnotationPair, AnnotationMirror> calculateLubs() {
Map<AnnotationPair, AnnotationMirror> newlubs = new HashMap<AnnotationPair, AnnotationMirror>();
for (AnnotationMirror a1 : supertypesGraph.keySet()) {
for (AnnotationMirror a2 : supertypesGraph.keySet()) {
if (AnnotationUtils.areSameIgnoringValues(a1, a2))
continue;
if (!AnnotationUtils.areSame(getTopAnnotation(a1), getTopAnnotation(a2)))
continue;
AnnotationPair pair = new AnnotationPair(a1, a2);
if (newlubs.containsKey(pair))
continue;
AnnotationMirror lub = findLub(a1, a2);
newlubs.put(pair, lub);
}
}
return newlubs;
}
示例13: calculateGlbs
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private Map<AnnotationPair, AnnotationMirror> calculateGlbs() {
Map<AnnotationPair, AnnotationMirror> newglbs = new HashMap<AnnotationPair, AnnotationMirror>();
for (AnnotationMirror a1 : supertypesGraph.keySet()) {
for (AnnotationMirror a2 : supertypesGraph.keySet()) {
if (AnnotationUtils.areSameIgnoringValues(a1, a2))
continue;
if (!AnnotationUtils.areSame(getTopAnnotation(a1), getTopAnnotation(a2)))
continue;
AnnotationPair pair = new AnnotationPair(a1, a2);
if (newglbs.containsKey(pair))
continue;
AnnotationMirror glb = findGlb(a1, a2);
newglbs.put(pair, glb);
}
}
return newglbs;
}
示例14: isSubtype
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
if (AnnotationUtils.areSameIgnoringValues(rhs, FORMAT) &&
AnnotationUtils.areSameIgnoringValues(lhs, FORMAT))
{
ConversionCategory[] rhsArgTypes =
treeUtil.formatAnnotationToCategories(rhs);
ConversionCategory[] lhsArgTypes =
treeUtil.formatAnnotationToCategories(lhs);
if (rhsArgTypes.length != lhsArgTypes.length) {
return false;
}
for (int i = 0; i < rhsArgTypes.length; ++i) {
if (!ConversionCategory.isSubsetOf(lhsArgTypes[i], rhsArgTypes[i])) {
return false;
}
}
return true;
}
if (AnnotationUtils.areSameIgnoringValues(lhs, FORMAT)) {
lhs = FORMAT;
}
if (AnnotationUtils.areSameIgnoringValues(rhs, FORMAT)) {
rhs = FORMAT;
}
if (AnnotationUtils.areSameIgnoringValues(lhs, INVALIDFORMAT)) {
lhs = INVALIDFORMAT;
}
if (AnnotationUtils.areSameIgnoringValues(rhs, INVALIDFORMAT)) {
rhs = INVALIDFORMAT;
}
return super.isSubtype(rhs, lhs);
}
示例15: isSubtype
import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
if (AnnotationUtils.areSameIgnoringValues(lhs, FENUM) &&
AnnotationUtils.areSameIgnoringValues(rhs, FENUM)) {
return AnnotationUtils.areSame(lhs, rhs);
}
// Ignore annotation values to ensure that annotation is in supertype map.
if (AnnotationUtils.areSameIgnoringValues(lhs, FENUM)) {
lhs = FENUM;
}
if (AnnotationUtils.areSameIgnoringValues(rhs, FENUM)) {
rhs = FENUM;
}
return super.isSubtype(rhs, lhs);
}