@@ -140,18 +140,18 @@ public Void scan(Element elem, Void ignore) {
140140 */
141141 class TestTypeScanner extends TypeScanner <Void , Void > {
142142 Element elem ;
143- NavigableMap <Integer , AnnotationMirror > toBeFound ;
143+ NavigableMap <Integer , List < AnnotationMirror > > toBeFound ;
144144 int count = 0 ;
145145 Set <TypeMirror > seen = new HashSet <>();
146146
147147 TestTypeScanner (Element elem , List <AnnotationMirror > tests , Types types ) {
148148 super (types );
149149 this .elem = elem ;
150150
151- NavigableMap <Integer , AnnotationMirror > testByPos = new TreeMap <>();
151+ NavigableMap <Integer , List < AnnotationMirror > > testByPos = new TreeMap <>();
152152 for (AnnotationMirror test : tests ) {
153153 for (int pos : getPosn (test )) {
154- testByPos .put (pos , test );
154+ testByPos .computeIfAbsent (pos , ArrayList :: new ). add ( test );
155155 }
156156 }
157157 this .toBeFound = testByPos ;
@@ -173,17 +173,18 @@ Void scan(TypeMirror t, Void ignore) {
173173 out .println ("scan " + count + ": " + t );
174174 if (toBeFound .size () > 0 ) {
175175 if (toBeFound .firstKey ().equals (count )) {
176- AnnotationMirror test = toBeFound .pollFirstEntry ().getValue ();
177- String annoType = getAnnoType (test );
178- AnnotationMirror anno = getAnnotation (t , annoType );
179- if (anno == null ) {
180- error (elem , "annotation not found on " + count + ": " + t );
181- } else {
182- String v = getValue (anno , "value" ).toString ();
183- if (v .equals (getExpect (test ))) {
184- out .println ("found " + anno + " as expected" );
176+ for (AnnotationMirror test : toBeFound .pollFirstEntry ().getValue ()) {
177+ String annoType = getAnnoType (test );
178+ AnnotationMirror anno = getAnnotation (t , annoType );
179+ if (anno == null ) {
180+ error (elem , "annotation not found on " + count + ": " + t );
185181 } else {
186- error (elem , "Unexpected value: " + v + ", expected: " + getExpect (test ));
182+ String v = getValue (anno , "value" ).toString ();
183+ if (v .equals (getExpect (test ))) {
184+ out .println ("found " + anno + " as expected" );
185+ } else {
186+ error (elem , "Unexpected value: " + v + ", expected: " + getExpect (test ));
187+ }
187188 }
188189 }
189190 } else if (count > toBeFound .firstKey ()) {
0 commit comments