Package org.checkerframework.javacutil
Class AnnotationMirrorSet
- java.lang.Object
-
- org.checkerframework.javacutil.AnnotationMirrorSet
-
- All Implemented Interfaces:
java.lang.Iterable<javax.lang.model.element.AnnotationMirror>
,java.util.Collection<javax.lang.model.element.AnnotationMirror>
,java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
,java.util.Set<javax.lang.model.element.AnnotationMirror>
,java.util.SortedSet<javax.lang.model.element.AnnotationMirror>
,org.plumelib.util.DeepCopyable<AnnotationMirrorSet>
public class AnnotationMirrorSet extends java.lang.Object implements java.util.NavigableSet<@KeyFor("this") javax.lang.model.element.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 usingAnnotationUtils.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
Constructors Constructor Description AnnotationMirrorSet()
Default constructor.AnnotationMirrorSet(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos)
Returns a newAnnotationMirrorSet
that contains the given annotation mirrors.AnnotationMirrorSet(javax.lang.model.element.AnnotationMirror value)
Creates a newAnnotationMirrorSet
that containsvalue
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(javax.lang.model.element.AnnotationMirror annotationMirror)
boolean
addAll(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> c)
@Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror
ceiling(javax.lang.model.element.AnnotationMirror e)
void
clear()
java.util.Comparator<? super javax.lang.model.element.AnnotationMirror>
comparator()
boolean
contains(@Nullable java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
AnnotationMirrorSet
deepCopy()
java.util.Iterator<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
descendingIterator()
AnnotationMirrorSet
descendingSet()
static AnnotationMirrorSet
emptySet()
Returns an empty set.boolean
equals(@Nullable java.lang.Object o)
@KeyFor("this") javax.lang.model.element.AnnotationMirror
first()
@Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror
floor(javax.lang.model.element.AnnotationMirror e)
int
hashCode()
AnnotationMirrorSet
headSet(javax.lang.model.element.AnnotationMirror toElement)
AnnotationMirrorSet
headSet(javax.lang.model.element.AnnotationMirror toElement, boolean inclusive)
@Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror
higher(javax.lang.model.element.AnnotationMirror e)
boolean
isEmpty()
java.util.Iterator<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
iterator()
@KeyFor("this") javax.lang.model.element.AnnotationMirror
last()
@Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror
lower(javax.lang.model.element.AnnotationMirror e)
AnnotationMirrorSet
makeUnmodifiable()
Make this set unmodifiable.@Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror
pollFirst()
@Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror
pollLast()
boolean
remove(@Nullable java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
static AnnotationMirrorSet
singleton(javax.lang.model.element.AnnotationMirror value)
Returns a new unmodifiableAnnotationMirrorSet
that containsvalue
.int
size()
AnnotationMirrorSet
subSet(javax.lang.model.element.AnnotationMirror fromElement, boolean fromInclusive, javax.lang.model.element.AnnotationMirror toElement, boolean toInclusive)
AnnotationMirrorSet
subSet(javax.lang.model.element.AnnotationMirror fromElement, javax.lang.model.element.AnnotationMirror toElement)
AnnotationMirrorSet
tailSet(javax.lang.model.element.AnnotationMirror fromElement)
AnnotationMirrorSet
tailSet(javax.lang.model.element.AnnotationMirror fromElement, boolean inclusive)
java.lang.Object[]
toArray()
<@KeyForBottom T>
@Nullable T[]toArray(@PolyNull T[] a)
java.lang.String
toString()
static AnnotationMirrorSet
unmodifiableSet(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos)
Returns an unmodifiable AnnotationMirrorSet with the given elements.
-
-
-
Constructor Detail
-
AnnotationMirrorSet
public AnnotationMirrorSet()
Default constructor.
-
AnnotationMirrorSet
public AnnotationMirrorSet(javax.lang.model.element.AnnotationMirror value)
Creates a newAnnotationMirrorSet
that containsvalue
.- Parameters:
value
- the AnnotationMirror to put in the set
-
AnnotationMirrorSet
public AnnotationMirrorSet(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos)
Returns a newAnnotationMirrorSet
that contains the given annotation mirrors.- Parameters:
annos
- the AnnotationMirrors to put in the set
-
-
Method Detail
-
deepCopy
public AnnotationMirrorSet deepCopy()
- Specified by:
deepCopy
in interfaceorg.plumelib.util.DeepCopyable<AnnotationMirrorSet>
-
makeUnmodifiable
public AnnotationMirrorSet makeUnmodifiable()
Make this set unmodifiable.- Returns:
- this set
-
singleton
public static AnnotationMirrorSet singleton(javax.lang.model.element.AnnotationMirror value)
Returns a new unmodifiableAnnotationMirrorSet
that containsvalue
.- Parameters:
value
- the AnnotationMirror to put in the set- Returns:
- a new unmodifiable
AnnotationMirrorSet
that contains onlyvalue
-
unmodifiableSet
public static AnnotationMirrorSet unmodifiableSet(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos)
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
public static AnnotationMirrorSet emptySet()
Returns an empty set.- Returns:
- an empty set
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
size
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
isEmpty
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
contains
public boolean contains(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, @Nullable java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
contains
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
iterator
public java.util.Iterator<@KeyFor("this") javax.lang.model.element.AnnotationMirror> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
iterator
in interfacejava.lang.Iterable<javax.lang.model.element.AnnotationMirror>
- Specified by:
iterator
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
- Specified by:
iterator
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
toArray
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
toArray
public <@KeyForBottom T> @Nullable T[] toArray(@PolyNull T[] a)
- Specified by:
toArray
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
toArray
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
add
public boolean add(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, javax.lang.model.element.AnnotationMirror annotationMirror)
- Specified by:
add
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
add
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
remove
public boolean remove(@Nullable java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
remove
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
containsAll
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
addAll
public boolean addAll(@UnknownInitialization(AnnotationMirrorSet.class) AnnotationMirrorSet this, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> c)
- Specified by:
addAll
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
addAll
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
retainAll
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
removeAll
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
clear
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
equals
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<javax.lang.model.element.AnnotationMirror>
- Specified by:
hashCode
in interfacejava.util.Set<javax.lang.model.element.AnnotationMirror>
- Overrides:
hashCode
in classjava.lang.Object
-
comparator
public java.util.Comparator<? super javax.lang.model.element.AnnotationMirror> comparator()
- Specified by:
comparator
in interfacejava.util.SortedSet<javax.lang.model.element.AnnotationMirror>
-
first
public @KeyFor("this") javax.lang.model.element.AnnotationMirror first()
- Specified by:
first
in interfacejava.util.SortedSet<javax.lang.model.element.AnnotationMirror>
-
last
public @KeyFor("this") javax.lang.model.element.AnnotationMirror last()
- Specified by:
last
in interfacejava.util.SortedSet<javax.lang.model.element.AnnotationMirror>
-
lower
public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror lower(javax.lang.model.element.AnnotationMirror e)
- Specified by:
lower
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
floor
public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror floor(javax.lang.model.element.AnnotationMirror e)
- Specified by:
floor
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
ceiling
public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror ceiling(javax.lang.model.element.AnnotationMirror e)
- Specified by:
ceiling
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
higher
public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror higher(javax.lang.model.element.AnnotationMirror e)
- Specified by:
higher
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
pollFirst
public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror pollFirst()
- Specified by:
pollFirst
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
pollLast
public @Nullable @KeyFor("this") javax.lang.model.element.AnnotationMirror pollLast()
- Specified by:
pollLast
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
descendingSet
public AnnotationMirrorSet descendingSet()
- Specified by:
descendingSet
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
descendingIterator
public java.util.Iterator<@KeyFor("this") javax.lang.model.element.AnnotationMirror> descendingIterator()
- Specified by:
descendingIterator
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
subSet
public AnnotationMirrorSet subSet(javax.lang.model.element.AnnotationMirror fromElement, boolean fromInclusive, javax.lang.model.element.AnnotationMirror toElement, boolean toInclusive)
- Specified by:
subSet
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
headSet
public AnnotationMirrorSet headSet(javax.lang.model.element.AnnotationMirror toElement, boolean inclusive)
- Specified by:
headSet
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
tailSet
public AnnotationMirrorSet tailSet(javax.lang.model.element.AnnotationMirror fromElement, boolean inclusive)
- Specified by:
tailSet
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
-
subSet
public AnnotationMirrorSet subSet(javax.lang.model.element.AnnotationMirror fromElement, javax.lang.model.element.AnnotationMirror toElement)
- Specified by:
subSet
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
- Specified by:
subSet
in interfacejava.util.SortedSet<javax.lang.model.element.AnnotationMirror>
-
headSet
public AnnotationMirrorSet headSet(javax.lang.model.element.AnnotationMirror toElement)
- Specified by:
headSet
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
- Specified by:
headSet
in interfacejava.util.SortedSet<javax.lang.model.element.AnnotationMirror>
-
tailSet
public AnnotationMirrorSet tailSet(javax.lang.model.element.AnnotationMirror fromElement)
- Specified by:
tailSet
in interfacejava.util.NavigableSet<@KeyFor("this") javax.lang.model.element.AnnotationMirror>
- Specified by:
tailSet
in interfacejava.util.SortedSet<javax.lang.model.element.AnnotationMirror>
-
-