当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationUtils.areSame方法代码示例

本文整理汇总了Java中org.checkerframework.javacutil.AnnotationUtils.areSame方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationUtils.areSame方法的具体用法?Java AnnotationUtils.areSame怎么用?Java AnnotationUtils.areSame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.checkerframework.javacutil.AnnotationUtils的用法示例。


在下文中一共展示了AnnotationUtils.areSame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSubtypeWithRoots

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private boolean isSubtypeWithRoots(AnnotationMirror rhs, AnnotationMirror lhs) {

            Set<String> rTypeNamesSet = new HashSet<String>(Arrays.asList(DataflowUtils.getTypeNames(rhs)));
            Set<String> lTypeNamesSet = new HashSet<String>(Arrays.asList(DataflowUtils.getTypeNames(lhs)));
            Set<String> rRootsSet = new HashSet<String>(Arrays.asList(DataflowUtils.getTypeNameRoots(rhs)));
            Set<String> lRootsSet = new HashSet<String>(Arrays.asList(DataflowUtils.getTypeNameRoots(lhs)));
            Set<String> combinedTypeNames = new HashSet<String>();
            combinedTypeNames.addAll(rTypeNamesSet);
            combinedTypeNames.addAll(lTypeNamesSet);
            Set<String> combinedRoots = new HashSet<String>();
            combinedRoots.addAll(rRootsSet);
            combinedRoots.addAll(lRootsSet);

            AnnotationMirror combinedAnno = DataflowUtils.createDataflowAnnotationWithRoots(
                    combinedTypeNames, combinedRoots, processingEnv);
            AnnotationMirror refinedCombinedAnno = refineDataflow(combinedAnno);
            AnnotationMirror refinedLhs = refineDataflow(lhs);

            if (AnnotationUtils.areSame(refinedCombinedAnno, refinedLhs)) {
                return true;
            } else {
                return false;
            }
        }
 
开发者ID:Jianchu,项目名称:generic-type-inference-solver,代码行数:25,代码来源:DataflowAnnotatedTypeFactory.java

示例2: getSubSupertypeFor2

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private void getSubSupertypeFor2() {
    int num = 1;
    for (AnnotationMirror i : allTypes) {
        Set<AnnotationMirror> subtypeSet = new HashSet<AnnotationMirror>();
        Set<AnnotationMirror> supertypeSet = new HashSet<AnnotationMirror>();
        if (AnnotationUtils.areSame(i, this.top)) {
            subtypeSet.add(this.top);
            subtypeSet.add(this.bottom);
            supertypeSet.add(this.top);
        } else if (AnnotationUtils.areSame(i, this.bottom)) {
            subtypeSet.add(this.bottom);
            supertypeSet.add(this.bottom);
            supertypeSet.add(this.top);
        }
        this.subType.put(i, subtypeSet);
        this.superType.put(i, supertypeSet);
        this.modifierInt.put(i, num);
        this.IntModifier.put(num, i);
        num++;

    }
}
 
开发者ID:Jianchu,项目名称:generic-type-inference-solver,代码行数:23,代码来源:LatticeGenerator.java

示例3: reduce

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
public Map<String, AnnotationMirror> reduce(Map<String, AnnotationMirror> r1,
        Map<String, AnnotationMirror> r2) {
    Map<String, AnnotationMirror> result =
        new HashMap<String, AnnotationMirror>();

    if (r1 != null)
        result.putAll(r1);

    if (r2 != null) {
        // Need to be careful about overlap
        for (String key : r2.keySet()) {
            if (!result.containsKey(key))
                result.put(key, r2.get(key));
            else if (!AnnotationUtils.areSame(result.get(key), r2.get(key)))
                result.put(key, READONLY);
        }
    }
    return result;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:20,代码来源:ImmutabilityAnnotatedTypeFactory.java

示例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);
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:18,代码来源:KeyForAnnotatedTypeFactory.java

示例5: updateMappingToMutableSet

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
/**
 * Update a mapping from some key to a set of AnnotationMirrors.
 * If the key already exists in the mapping and the new qualifier
 * is in the same qualifier hierarchy as any of the existing qualifiers,
 * do nothing and return false.
 * If the key already exists in the mapping and the new qualifier
 * is not in the same qualifier hierarchy as any of the existing qualifiers,
 * add the qualifier to the existing set and return true.
 * If the key does not exist in the mapping, add the new qualifier as a
 * singleton set and return true.
 *
 * @param map The mapping to modify.
 * @param key The key to update.
 * @param newQual The value to add.
 * @return Whether there was a qualifier hierarchy collision.
 */
public <T> boolean updateMappingToMutableSet(
        Map<T, Set<AnnotationMirror>> map,
        T key, AnnotationMirror newQual) {

    if (!map.containsKey(key)) {
        Set<AnnotationMirror> set = AnnotationUtils.createAnnotationSet();
        set.add(newQual);
        map.put(key, set);
    } else {
        Set<AnnotationMirror> prevs = map.get(key);
        for (AnnotationMirror p : prevs) {
            if (AnnotationUtils.areSame(getTopAnnotation(p),
                    getTopAnnotation(newQual))) {
                return false;
            }
        }
        prevs.add(newQual);
        map.put(key, prevs);
    }
    return true;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:38,代码来源:QualifierHierarchy.java

示例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));
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:18,代码来源:IGJAnnotatedTypeFactory.java

示例7: isSubtype

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(Collection<? extends AnnotationMirror> rhs, Collection<? extends AnnotationMirror> lhs) {
    if (lhs.isEmpty() || rhs.isEmpty()) {
        ErrorReporter.errorAbort("MultiGraphQualifierHierarchy: empty annotations in lhs: " + lhs + " or rhs: " + rhs);
    }
    if (lhs.size() != rhs.size()) {
        ErrorReporter.errorAbort("MultiGraphQualifierHierarchy: mismatched number of annotations in lhs: " + lhs + " and rhs: " + rhs);
    }
    int valid = 0;
    for (AnnotationMirror lhsAnno : lhs) {
        for (AnnotationMirror rhsAnno : rhs) {
            if (AnnotationUtils.areSame(getTopAnnotation(lhsAnno), getTopAnnotation(rhsAnno)) &&
                    isSubtype(rhsAnno, lhsAnno)) {
                ++valid;
            }
        }
    }
    return lhs.size() == valid;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:20,代码来源:MultiGraphQualifierHierarchy.java

示例8: 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;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:18,代码来源:MultiGraphQualifierHierarchy.java

示例9: 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);
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:16,代码来源:FenumAnnotatedTypeFactory.java

示例10: isSubtype

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs) {
    if (AnnotationUtils.areSameIgnoringValues(lhs, VALUE) &&
            AnnotationUtils.areSameIgnoringValues(rhs, VALUE)) {
        return AnnotationUtils.areSame(lhs, rhs);
    }
    if (AnnotationUtils.areSameIgnoringValues(lhs, VALUE)) {
        lhs = VALUE;
    }
    if (AnnotationUtils.areSameIgnoringValues(rhs, VALUE)) {
        rhs = VALUE;
    }
    return super.isSubtype(rhs, lhs);
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:15,代码来源:FlowTestAnnotatedTypeFactory.java

示例11: getTopAnnotation

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public AnnotationMirror getTopAnnotation(AnnotationMirror start) {
    for (AnnotationMirror top : tops) {
        if (AnnotationUtils.areSame(start, top) ||
                isSubtype(start, top)) {
            return top;
        }
    }
    ErrorReporter.errorAbort("MultiGraphQualifierHierarchy: did not find the top corresponding to qualifier " + start +
            " all tops: " + tops);
    return null;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:13,代码来源:MultiGraphQualifierHierarchy.java

示例12: getBottomAnnotation

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public AnnotationMirror getBottomAnnotation(AnnotationMirror start) {
    for (AnnotationMirror bot : bottoms) {
        if (AnnotationUtils.areSame(start, bot) ||
                isSubtype(bot, start)) {
            return bot;
        }
    }
    ErrorReporter.errorAbort("MultiGraphQualifierHierarchy: did not find the bottom corresponding to qualifier " + start +
            "; all bottoms: " + bottoms + "; this: " + this);
    return null;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:13,代码来源:MultiGraphQualifierHierarchy.java

示例13: greatestLowerBound

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2) {
    if (AnnotationUtils.areSameIgnoringValues(a1, a2))
        return AnnotationUtils.areSame(a1, a2) ? a1 : getBottomAnnotation(a1);
    if (glbs == null) {
        glbs = calculateGlbs();
    }
    AnnotationPair pair = new AnnotationPair(a1, a2);
    return glbs.get(pair);
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:11,代码来源:MultiGraphQualifierHierarchy.java

示例14: equals

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
@Override
public boolean equals(Object o) {
    if (!(o instanceof AnnotatedTypeMirror))
        return false;
    AnnotatedTypeMirror t = (AnnotatedTypeMirror) o;
    if (atypeFactory.types.isSameType(this.actualType, t.actualType)
            && AnnotationUtils.areSame(getAnnotations(), t.getAnnotations()))
        return true;
    return false;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:11,代码来源:AnnotatedTypeMirror.java

示例15: mapGetHelper

import org.checkerframework.javacutil.AnnotationUtils; //导入方法依赖的package包/类
private static <K extends AnnotatedTypeMirror, V extends AnnotatedTypeMirror>
V mapGetHelper(Map<K, V> mappings, AnnotatedTypeVariable key) {
    for (Map.Entry<K, V> entry : mappings.entrySet()) {
        K possible = entry.getKey();
        V possValue = entry.getValue();
        if (possible == key) return possValue;
        if (possible instanceof AnnotatedTypeVariable) {
            AnnotatedTypeVariable other = (AnnotatedTypeVariable)possible;
            Element oElt = other.getUnderlyingType().asElement();
            if (key.getUnderlyingType().asElement().equals(oElt)) {
                // Not identical AnnotatedTypeMirrors, but they wrap the same TypeMirror.
                if (!key.annotations.isEmpty()
                        && !AnnotationUtils.areSame(key.annotations, other.annotations)) {
                    // An annotated type variable use means to override
                    // any annotations on the actual type argument.
                    @SuppressWarnings("unchecked")
                    V found = (V)possValue.getCopy(false);
                    found.addAnnotations(possValue.getAnnotations());
                    found.replaceAnnotations(key.annotations);
                    return found;
                } else {
                    return possValue;
                }
            }
        }
    }
    return null;
}
 
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:29,代码来源:AnnotatedTypeMirror.java


注:本文中的org.checkerframework.javacutil.AnnotationUtils.areSame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。