Package org.checkerframework.javacutil
Class AnnotationMirrorSet
java.lang.Object
org.checkerframework.javacutil.AnnotationMirrorSet
- All Implemented Interfaces:
Iterable<AnnotationMirror>,Collection<AnnotationMirror>,NavigableSet<@KeyFor("this") AnnotationMirror>,SequencedCollection<AnnotationMirror>,SequencedSet<AnnotationMirror>,Set<AnnotationMirror>,SortedSet<AnnotationMirror>,org.plumelib.util.DeepCopyable<AnnotationMirrorSet>
public class AnnotationMirrorSet
extends Object
implements NavigableSet<@KeyFor("this") AnnotationMirror>, org.plumelib.util.DeepCopyable<AnnotationMirrorSet>
The Set interface defines many methods with respect to the equals method. This implementation of
Set violates those specifications, but fulfills the same property using
AnnotationUtils.areSame(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror) rather than equals.
For example, the specification for the contains(Object o) method says: "returns true if and
only if this collection contains at least one element e such that (o == null ? e == null :
o.equals(e))." The specification for contains(java.lang.Object) is "returns true if and
only if this collection contains at least one element e such that (o == null ? e == null :
AnnotationUtils.areSame(o, e))".
AnnotationMirror is an interface and not all implementing classes provide a correct equals method; therefore, the existing implementations of Set cannot be used.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AnnotationMirrorSet(Collection<? extends AnnotationMirror> annos) Returns a newAnnotationMirrorSetthat contains the given annotation mirrors.Creates a newAnnotationMirrorSetthat containsvalue. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(AnnotationMirror annotationMirror) booleanaddAll(Collection<? extends AnnotationMirror> c) @Nullable @KeyFor("this") AnnotationMirrorvoidclear()Comparator<? super AnnotationMirror> booleanbooleancontainsAll(Collection<?> c) deepCopy()Iterator<@KeyFor("this") AnnotationMirror> static AnnotationMirrorSetemptySet()Returns an empty set.boolean@KeyFor("this") AnnotationMirrorfirst()@Nullable @KeyFor("this") AnnotationMirrorinthashCode()headSet(AnnotationMirror toElement) headSet(AnnotationMirror toElement, boolean inclusive) @Nullable @KeyFor("this") AnnotationMirrorbooleanisEmpty()Iterator<@KeyFor("this") AnnotationMirror> iterator()@KeyFor("this") AnnotationMirrorlast()@Nullable @KeyFor("this") AnnotationMirrorMake this set unmodifiable.@Nullable @KeyFor("this") AnnotationMirror@Nullable @KeyFor("this") AnnotationMirrorpollLast()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) static AnnotationMirrorSetsingleton(AnnotationMirror value) Returns a new unmodifiableAnnotationMirrorSetthat containsvalue.intsize()subSet(AnnotationMirror fromElement, boolean fromInclusive, AnnotationMirror toElement, boolean toInclusive) subSet(AnnotationMirror fromElement, AnnotationMirror toElement) tailSet(AnnotationMirror fromElement) tailSet(AnnotationMirror fromElement, boolean inclusive) Object[]toArray()<@KeyForBottom T>
@Nullable T[]toString()static AnnotationMirrorSetunmodifiableSet(Collection<? extends AnnotationMirror> annos) Returns an unmodifiable AnnotationMirrorSet with the given elements.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.NavigableSet
removeFirst, removeLast, reversed
-
Constructor Details
-
AnnotationMirrorSet
public AnnotationMirrorSet()Default constructor. -
AnnotationMirrorSet
Creates a newAnnotationMirrorSetthat containsvalue.- Parameters:
value- the AnnotationMirror to put in the set
-
AnnotationMirrorSet
Returns a newAnnotationMirrorSetthat contains the given annotation mirrors.- Parameters:
annos- the AnnotationMirrors to put in the set
-
-
Method Details
-
deepCopy
- Specified by:
deepCopyin interfaceorg.plumelib.util.DeepCopyable<AnnotationMirrorSet>
-
makeUnmodifiable
Make this set unmodifiable.- Returns:
- this set
-
singleton
Returns a new unmodifiableAnnotationMirrorSetthat containsvalue.- Parameters:
value- the AnnotationMirror to put in the set- Returns:
- a new unmodifiable
AnnotationMirrorSetthat contains onlyvalue
-
unmodifiableSet
Returns an unmodifiable AnnotationMirrorSet with the given elements.- Parameters:
annos- the annotation mirrors that will constitute the new unmodifiable set- Returns:
- an unmodifiable AnnotationMirrorSet with the given elements
-
emptySet
Returns an empty set.- Returns:
- an empty set
-
size
public int size()- Specified by:
sizein interfaceCollection<AnnotationMirror>- Specified by:
sizein interfaceSet<AnnotationMirror>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<AnnotationMirror>- Specified by:
isEmptyin interfaceSet<AnnotationMirror>
-
contains
public boolean contains(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, @Nullable Object o) - Specified by:
containsin interfaceCollection<AnnotationMirror>- Specified by:
containsin interfaceSet<AnnotationMirror>
-
iterator
- Specified by:
iteratorin interfaceCollection<AnnotationMirror>- Specified by:
iteratorin interfaceIterable<AnnotationMirror>- Specified by:
iteratorin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>- Specified by:
iteratorin interfaceSet<AnnotationMirror>
-
toArray
- Specified by:
toArrayin interfaceCollection<AnnotationMirror>- Specified by:
toArrayin interfaceSet<AnnotationMirror>
-
toArray
- Specified by:
toArrayin interfaceCollection<AnnotationMirror>- Specified by:
toArrayin interfaceSet<AnnotationMirror>
-
add
public boolean add(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, AnnotationMirror annotationMirror) - Specified by:
addin interfaceCollection<AnnotationMirror>- Specified by:
addin interfaceSet<AnnotationMirror>
-
remove
- Specified by:
removein interfaceCollection<AnnotationMirror>- Specified by:
removein interfaceSet<AnnotationMirror>
-
containsAll
- Specified by:
containsAllin interfaceCollection<AnnotationMirror>- Specified by:
containsAllin interfaceSet<AnnotationMirror>
-
addAll
public boolean addAll(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, Collection<? extends AnnotationMirror> c) - Specified by:
addAllin interfaceCollection<AnnotationMirror>- Specified by:
addAllin interfaceSet<AnnotationMirror>
-
retainAll
- Specified by:
retainAllin interfaceCollection<AnnotationMirror>- Specified by:
retainAllin interfaceSet<AnnotationMirror>
-
removeAll
- Specified by:
removeAllin interfaceCollection<AnnotationMirror>- Specified by:
removeAllin interfaceSet<AnnotationMirror>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<AnnotationMirror>- Specified by:
clearin interfaceSet<AnnotationMirror>
-
toString
-
equals
- Specified by:
equalsin interfaceCollection<AnnotationMirror>- Specified by:
equalsin interfaceSet<AnnotationMirror>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<AnnotationMirror>- Specified by:
hashCodein interfaceSet<AnnotationMirror>- Overrides:
hashCodein classObject
-
comparator
- Specified by:
comparatorin interfaceSortedSet<AnnotationMirror>
-
first
- Specified by:
firstin interfaceSortedSet<AnnotationMirror>
-
last
- Specified by:
lastin interfaceSortedSet<AnnotationMirror>
-
lower
- Specified by:
lowerin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
floor
- Specified by:
floorin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
ceiling
- Specified by:
ceilingin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
higher
- Specified by:
higherin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
pollFirst
- Specified by:
pollFirstin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
pollLast
- Specified by:
pollLastin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
descendingSet
- Specified by:
descendingSetin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
descendingIterator
- Specified by:
descendingIteratorin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
subSet
public AnnotationMirrorSet subSet(AnnotationMirror fromElement, boolean fromInclusive, AnnotationMirror toElement, boolean toInclusive) - Specified by:
subSetin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
headSet
- Specified by:
headSetin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
tailSet
- Specified by:
tailSetin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
subSet
- Specified by:
subSetin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>- Specified by:
subSetin interfaceSortedSet<AnnotationMirror>
-
headSet
- Specified by:
headSetin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>- Specified by:
headSetin interfaceSortedSet<AnnotationMirror>
-
tailSet
- Specified by:
tailSetin interfaceNavigableSet<@KeyFor("this") AnnotationMirror>- Specified by:
tailSetin interfaceSortedSet<AnnotationMirror>
-