2727
2828import org .checkerframework .checker .index .qual .NonNegative ;
2929import org .checkerframework .checker .initialization .qual .UnknownInitialization ;
30+ import org .checkerframework .checker .nullness .qual .UnknownKeyFor ;
3031import org .checkerframework .checker .lock .qual .GuardSatisfied ;
3132import org .checkerframework .checker .lock .qual .GuardedByUnknown ;
3233import org .checkerframework .checker .nullness .qual .Nullable ;
34+ import org .checkerframework .checker .tainting .qual .Tainted ;
3335import org .checkerframework .common .value .qual .PolyValue ;
3436import org .checkerframework .dataflow .qual .Pure ;
3537import org .checkerframework .dataflow .qual .SideEffectFree ;
3638import org .checkerframework .framework .qual .AnnotatedFor ;
39+ import org .checkerframework .framework .qual .Covariant ;
3740
3841import java .io .IOException ;
3942import java .io .InvalidObjectException ;
8083 * @jls 8.9.3 Enum Members
8184 * @since 1.5
8285 */
83- @ AnnotatedFor ({"lock" , "nullness" , "index" , "value" })
86+ @ AnnotatedFor ({"lock" , "nullness" , "index" , "value" , "tainting" })
87+ @ Covariant (0 )
8488@ SuppressWarnings ("serial" ) // No serialVersionUID needed due to
8589 // special-casing of enum classes.
8690public abstract class Enum <E extends Enum <E >>
@@ -208,7 +212,7 @@ protected final Object clone(@GuardSatisfied Enum<E> this) throws CloneNotSuppor
208212 * method is the order in which the constants are declared.
209213 */
210214 @ SuppressWarnings ({"rawtypes" })
211- public final int compareTo (E o ) {
215+ public final int compareTo (@ UnknownKeyFor @ Tainted E o ) {
212216 Enum <?> other = (Enum <?>)o ;
213217 Enum <E > self = this ;
214218 if (self .getClass () != other .getClass () && // optimization
@@ -230,7 +234,7 @@ public final int compareTo(E o) {
230234 * enum type
231235 */
232236 @ SuppressWarnings ("unchecked" )
233- public final Class <E > getDeclaringClass () {
237+ public final Class <@ Tainted E > getDeclaringClass () {
234238 Class <?> clazz = getClass ();
235239 Class <?> zuper = clazz .getSuperclass ();
236240 return (zuper == Enum .class ) ? (Class <E >)clazz : (Class <E >)zuper ;
0 commit comments