Skip to content

Commit

Permalink
actually use sorted order
Browse files Browse the repository at this point in the history
  • Loading branch information
theron-wang committed Aug 15, 2024
1 parent 936e8dc commit 9af868c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -136,9 +135,8 @@ else if (targetAnnotation.isNormalAnnotationExpr()) {
List<ElementType> sortedElementTypes = new ArrayList<>(elementTypes);
Collections.sort(sortedElementTypes, (a, b) -> a.name().compareTo(b.name()));

Iterator<ElementType> iterator = elementTypes.iterator();
while (iterator.hasNext()) {
ElementType elementType = iterator.next();
for (int i = 0; i < sortedElementTypes.size(); i++) {
ElementType elementType = sortedElementTypes.get(i);
if (!staticallyImportedElementTypes.contains(elementType)) {
if (useFullyQualified) {
newAnnotation.append("java.lang.annotation.");
Expand All @@ -147,7 +145,7 @@ else if (targetAnnotation.isNormalAnnotationExpr()) {
}
newAnnotation.append(elementType.name());

if (iterator.hasNext()) {
if (i < sortedElementTypes.size() - 1) {
newAnnotation.append(", ");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.checkerframework.checker.initialization.qual;

@java.lang.annotation.Target({ java.lang.annotation.ElementType.TYPE_USE, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.METHOD })
@java.lang.annotation.Target({ java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE })
public @interface Initialized {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.checkerframework.checker.nullness.qual;

@java.lang.annotation.Target({ java.lang.annotation.ElementType.TYPE_USE, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.METHOD })
@java.lang.annotation.Target({ java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE })
public @interface NonNull {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package org.checkerframework.checker.nullness.qual;

@java.lang.annotation.Target({ java.lang.annotation.ElementType.TYPE_USE, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.METHOD })
@java.lang.annotation.Target({ java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE })
public @interface UnknownKeyFor {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.example;

@java.lang.annotation.Target({ java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.ANNOTATION_TYPE, java.lang.annotation.ElementType.TYPE_USE })
@java.lang.annotation.Target({ java.lang.annotation.ElementType.ANNOTATION_TYPE, java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.TYPE_USE })
public @interface AnnotationDeclaration {
}

0 comments on commit 9af868c

Please sign in to comment.