Package org.checkerframework.javacutil
Class AnnotationMirrorSet
java.lang.Object
org.checkerframework.javacutil.AnnotationMirrorSet
- All Implemented Interfaces:
Iterable<AnnotationMirror>
,Collection<AnnotationMirror>
,NavigableSet<@KeyFor("this") 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
ConstructorDescriptionDefault constructor.AnnotationMirrorSet
(Collection<? extends AnnotationMirror> annos) Returns a newAnnotationMirrorSet
that contains the given annotation mirrors.Creates a newAnnotationMirrorSet
that containsvalue
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(AnnotationMirror annotationMirror) boolean
addAll
(Collection<? extends AnnotationMirror> c) @Nullable @KeyFor("this") AnnotationMirror
void
clear()
Comparator<? super AnnotationMirror>
boolean
boolean
containsAll
(Collection<?> c) deepCopy()
Iterator<@KeyFor("this") AnnotationMirror>
static AnnotationMirrorSet
emptySet()
Returns an empty set.boolean
@KeyFor("this") AnnotationMirror
first()
@Nullable @KeyFor("this") AnnotationMirror
int
hashCode()
headSet
(AnnotationMirror toElement) headSet
(AnnotationMirror toElement, boolean inclusive) @Nullable @KeyFor("this") AnnotationMirror
boolean
isEmpty()
Iterator<@KeyFor("this") AnnotationMirror>
iterator()
@KeyFor("this") AnnotationMirror
last()
@Nullable @KeyFor("this") AnnotationMirror
Make this set unmodifiable.@Nullable @KeyFor("this") AnnotationMirror
@Nullable @KeyFor("this") AnnotationMirror
pollLast()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) static AnnotationMirrorSet
singleton
(AnnotationMirror value) Returns a new unmodifiableAnnotationMirrorSet
that containsvalue
.int
size()
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 AnnotationMirrorSet
unmodifiableSet
(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, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.SortedSet
spliterator
-
Constructor Details
-
AnnotationMirrorSet
public AnnotationMirrorSet()Default constructor. -
AnnotationMirrorSet
Creates a newAnnotationMirrorSet
that containsvalue
.- Parameters:
value
- the AnnotationMirror to put in the set
-
AnnotationMirrorSet
Returns a newAnnotationMirrorSet
that contains the given annotation mirrors.- Parameters:
annos
- the AnnotationMirrors to put in the set
-
-
Method Details
-
deepCopy
- Specified by:
deepCopy
in interfaceorg.plumelib.util.DeepCopyable<AnnotationMirrorSet>
-
makeUnmodifiable
Make this set unmodifiable.- Returns:
- this set
-
singleton
Returns a new unmodifiableAnnotationMirrorSet
that containsvalue
.- Parameters:
value
- the AnnotationMirror to put in the set- Returns:
- a new unmodifiable
AnnotationMirrorSet
that contains onlyvalue
-
unmodifiableSet
Returns an unmodifiable AnnotationMirrorSet with the given elements.- Parameters:
annos
- the annotation mirrors that will constitute the new unmodifable set- Returns:
- an unmodifiable AnnotationMirrorSet with the given elements
-
emptySet
Returns an empty set.- Returns:
- an empty set
-
size
public int size()- Specified by:
size
in interfaceCollection<AnnotationMirror>
- Specified by:
size
in interfaceSet<AnnotationMirror>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<AnnotationMirror>
- Specified by:
isEmpty
in interfaceSet<AnnotationMirror>
-
contains
public boolean contains(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, @Nullable Object o) - Specified by:
contains
in interfaceCollection<AnnotationMirror>
- Specified by:
contains
in interfaceSet<AnnotationMirror>
-
iterator
- Specified by:
iterator
in interfaceCollection<AnnotationMirror>
- Specified by:
iterator
in interfaceIterable<AnnotationMirror>
- Specified by:
iterator
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
- Specified by:
iterator
in interfaceSet<AnnotationMirror>
-
toArray
- Specified by:
toArray
in interfaceCollection<AnnotationMirror>
- Specified by:
toArray
in interfaceSet<AnnotationMirror>
-
toArray
- Specified by:
toArray
in interfaceCollection<AnnotationMirror>
- Specified by:
toArray
in interfaceSet<AnnotationMirror>
-
add
public boolean add(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, AnnotationMirror annotationMirror) - Specified by:
add
in interfaceCollection<AnnotationMirror>
- Specified by:
add
in interfaceSet<AnnotationMirror>
-
remove
- Specified by:
remove
in interfaceCollection<AnnotationMirror>
- Specified by:
remove
in interfaceSet<AnnotationMirror>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<AnnotationMirror>
- Specified by:
containsAll
in interfaceSet<AnnotationMirror>
-
addAll
public boolean addAll(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, Collection<? extends AnnotationMirror> c) - Specified by:
addAll
in interfaceCollection<AnnotationMirror>
- Specified by:
addAll
in interfaceSet<AnnotationMirror>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<AnnotationMirror>
- Specified by:
retainAll
in interfaceSet<AnnotationMirror>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<AnnotationMirror>
- Specified by:
removeAll
in interfaceSet<AnnotationMirror>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<AnnotationMirror>
- Specified by:
clear
in interfaceSet<AnnotationMirror>
-
toString
-
equals
- Specified by:
equals
in interfaceCollection<AnnotationMirror>
- Specified by:
equals
in interfaceSet<AnnotationMirror>
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<AnnotationMirror>
- Specified by:
hashCode
in interfaceSet<AnnotationMirror>
- Overrides:
hashCode
in classObject
-
comparator
- Specified by:
comparator
in interfaceSortedSet<AnnotationMirror>
-
first
- Specified by:
first
in interfaceSortedSet<AnnotationMirror>
-
last
- Specified by:
last
in interfaceSortedSet<AnnotationMirror>
-
lower
- Specified by:
lower
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
floor
- Specified by:
floor
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
ceiling
- Specified by:
ceiling
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
higher
- Specified by:
higher
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
pollFirst
- Specified by:
pollFirst
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
pollLast
- Specified by:
pollLast
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
descendingSet
- Specified by:
descendingSet
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
descendingIterator
- Specified by:
descendingIterator
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
subSet
public AnnotationMirrorSet subSet(AnnotationMirror fromElement, boolean fromInclusive, AnnotationMirror toElement, boolean toInclusive) - Specified by:
subSet
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
headSet
- Specified by:
headSet
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
tailSet
- Specified by:
tailSet
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
-
subSet
- Specified by:
subSet
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
- Specified by:
subSet
in interfaceSortedSet<AnnotationMirror>
-
headSet
- Specified by:
headSet
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
- Specified by:
headSet
in interfaceSortedSet<AnnotationMirror>
-
tailSet
- Specified by:
tailSet
in interfaceNavigableSet<@KeyFor("this") AnnotationMirror>
- Specified by:
tailSet
in interfaceSortedSet<AnnotationMirror>
-