1329 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array |
1329 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array |
1330 void Method::sort_methods(Array<Method*>* methods, |
1330 void Method::sort_methods(Array<Method*>* methods, |
1331 Array<AnnotationArray*>* methods_annotations, |
1331 Array<AnnotationArray*>* methods_annotations, |
1332 Array<AnnotationArray*>* methods_parameter_annotations, |
1332 Array<AnnotationArray*>* methods_parameter_annotations, |
1333 Array<AnnotationArray*>* methods_default_annotations, |
1333 Array<AnnotationArray*>* methods_default_annotations, |
|
1334 Array<AnnotationArray*>* methods_type_annotations, |
1334 bool idempotent) { |
1335 bool idempotent) { |
1335 int length = methods->length(); |
1336 int length = methods->length(); |
1336 if (length > 1) { |
1337 if (length > 1) { |
1337 bool do_annotations = false; |
1338 bool do_annotations = false; |
1338 if (methods_annotations != NULL || |
1339 if (methods_annotations != NULL || |
1339 methods_parameter_annotations != NULL || |
1340 methods_parameter_annotations != NULL || |
1340 methods_default_annotations != NULL) { |
1341 methods_default_annotations != NULL || |
|
1342 methods_type_annotations != NULL) { |
1341 do_annotations = true; |
1343 do_annotations = true; |
1342 } |
1344 } |
1343 if (do_annotations) { |
1345 if (do_annotations) { |
1344 // Remember current method ordering so we can reorder annotations |
1346 // Remember current method ordering so we can reorder annotations |
1345 for (int i = 0; i < length; i++) { |
1347 for (int i = 0; i < length; i++) { |
1354 |
1356 |
1355 // Sort annotations if necessary |
1357 // Sort annotations if necessary |
1356 assert(methods_annotations == NULL || methods_annotations->length() == methods->length(), ""); |
1358 assert(methods_annotations == NULL || methods_annotations->length() == methods->length(), ""); |
1357 assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), ""); |
1359 assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), ""); |
1358 assert(methods_default_annotations == NULL || methods_default_annotations->length() == methods->length(), ""); |
1360 assert(methods_default_annotations == NULL || methods_default_annotations->length() == methods->length(), ""); |
|
1361 assert(methods_type_annotations == NULL || methods_type_annotations->length() == methods->length(), ""); |
1359 if (do_annotations) { |
1362 if (do_annotations) { |
1360 ResourceMark rm; |
1363 ResourceMark rm; |
1361 // Allocate temporary storage |
1364 // Allocate temporary storage |
1362 GrowableArray<AnnotationArray*>* temp_array = new GrowableArray<AnnotationArray*>(length); |
1365 GrowableArray<AnnotationArray*>* temp_array = new GrowableArray<AnnotationArray*>(length); |
1363 reorder_based_on_method_index(methods, methods_annotations, temp_array); |
1366 reorder_based_on_method_index(methods, methods_annotations, temp_array); |
1364 reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array); |
1367 reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array); |
1365 reorder_based_on_method_index(methods, methods_default_annotations, temp_array); |
1368 reorder_based_on_method_index(methods, methods_default_annotations, temp_array); |
|
1369 reorder_based_on_method_index(methods, methods_type_annotations, temp_array); |
1366 } |
1370 } |
1367 |
1371 |
1368 // Reset method ordering |
1372 // Reset method ordering |
1369 for (int i = 0; i < length; i++) { |
1373 for (int i = 0; i < length; i++) { |
1370 Method* m = methods->at(i); |
1374 Method* m = methods->at(i); |