You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for (TypeAnnotation.LocationInfo.Locationloc : locs) {
440
487
dos.write(loc.tag);
441
488
dos.writeShort(loc.index);
442
489
}
@@ -528,12 +575,40 @@ public static <T, A, TA, E, EA, MT, ETM> List<A> decodeAnnotations(byte[] encode
528
575
}
529
576
}
530
577
578
+
/**
579
+
* Decodes parameter annotations serialized in {@code encoded} to objects.
580
+
*
581
+
* @param <T> type to which a type name is resolved
582
+
* @param <A> type of the object representing a decoded annotation
583
+
* @param <E> type of the object representing a decoded enum constant
584
+
* @param <MT> type of the object representing a missing type
585
+
* @param <ETM> type of the object representing a decoded element type mismatch
586
+
* @return an immutable list of immutable lists of {@code A} objects
587
+
*/
588
+
@SuppressWarnings("unchecked")
589
+
publicstatic <T, A, TA, E, EA, MT, ETM> List<List<A>> decodeParameterAnnotations(byte[] encoded, AnnotationDecoder<T, A, TA, E, EA, MT, ETM> decoder) {
privatestatic <T, A, TA, E, EA, MT, ETM> List<A> decodeAnnotations(DataInputStreamdis, AnnotationDecoder<T, A, TA, E, EA, MT, ETM> decoder) throwsIOException {
privatestatic <T, A, TA, E, EA, MT, ETM> AdecodeAnnotation(DataInputStreamdis, AnnotationDecoder<T, A, TA, E, EA, MT, ETM> decoder) throwsIOException {
533
608
StringtypeName = dis.readUTF();
534
609
Ttype = decoder.resolveType(typeName);
535
610
intn = readLength(dis);
536
-
Map.Entry[] elements = newMap.Entry[n];
611
+
Map.Entry[] elements = n == 0 ? NO_ELEMENTS : newMap.Entry[n];
537
612
for (inti = 0; i < n; i++) {
538
613
Stringname = dis.readUTF();
539
614
bytetag = dis.readByte();
@@ -681,7 +756,7 @@ private static <T, A, TA, E, EA, MT, ETM> TA decodeTypeAnnotation(DataInputStrea
0 commit comments