Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/defaultMethods.cpp @ 7613:2dce7c34c564
8006513: Null pointer in DefaultMethods::generate_default_methods when merging annotations
Reviewed-by: brutisso, jfranck
author | stefank |
---|---|
date | Thu, 17 Jan 2013 11:39:48 +0100 |
parents | ade95d680b42 |
children | 927a311d00f9 |
comparison
equal
deleted
inserted
replaced
7612:4967eb4f67a9 | 7613:2dce7c34c564 |
---|---|
1283 static void merge_in_new_methods(InstanceKlass* klass, | 1283 static void merge_in_new_methods(InstanceKlass* klass, |
1284 GrowableArray<Method*>* new_methods, TRAPS) { | 1284 GrowableArray<Method*>* new_methods, TRAPS) { |
1285 | 1285 |
1286 enum { ANNOTATIONS, PARAMETERS, DEFAULTS, NUM_ARRAYS }; | 1286 enum { ANNOTATIONS, PARAMETERS, DEFAULTS, NUM_ARRAYS }; |
1287 | 1287 |
1288 Array<AnnotationArray*>* original_annots[NUM_ARRAYS]; | 1288 Array<AnnotationArray*>* original_annots[NUM_ARRAYS] = { NULL }; |
1289 | 1289 |
1290 Array<Method*>* original_methods = klass->methods(); | 1290 Array<Method*>* original_methods = klass->methods(); |
1291 Annotations* annots = klass->annotations(); | 1291 Annotations* annots = klass->annotations(); |
1292 original_annots[ANNOTATIONS] = annots->methods_annotations(); | 1292 if (annots != NULL) { |
1293 original_annots[PARAMETERS] = annots->methods_parameter_annotations(); | 1293 original_annots[ANNOTATIONS] = annots->methods_annotations(); |
1294 original_annots[DEFAULTS] = annots->methods_default_annotations(); | 1294 original_annots[PARAMETERS] = annots->methods_parameter_annotations(); |
1295 original_annots[DEFAULTS] = annots->methods_default_annotations(); | |
1296 } | |
1295 | 1297 |
1296 Array<int>* original_ordering = klass->method_ordering(); | 1298 Array<int>* original_ordering = klass->method_ordering(); |
1297 Array<int>* merged_ordering = Universe::the_empty_int_array(); | 1299 Array<int>* merged_ordering = Universe::the_empty_int_array(); |
1298 | 1300 |
1299 int new_size = klass->methods()->length() + new_methods->length(); | 1301 int new_size = klass->methods()->length() + new_methods->length(); |
1368 } | 1370 } |
1369 #endif | 1371 #endif |
1370 | 1372 |
1371 // Replace klass methods with new merged lists | 1373 // Replace klass methods with new merged lists |
1372 klass->set_methods(merged_methods); | 1374 klass->set_methods(merged_methods); |
1373 annots->set_methods_annotations(merged_annots[ANNOTATIONS]); | 1375 if (annots != NULL) { |
1374 annots->set_methods_parameter_annotations(merged_annots[PARAMETERS]); | 1376 annots->set_methods_annotations(merged_annots[ANNOTATIONS]); |
1375 annots->set_methods_default_annotations(merged_annots[DEFAULTS]); | 1377 annots->set_methods_parameter_annotations(merged_annots[PARAMETERS]); |
1378 annots->set_methods_default_annotations(merged_annots[DEFAULTS]); | |
1379 } else { | |
1380 assert(merged_annots[ANNOTATIONS] == NULL, "Must be"); | |
1381 assert(merged_annots[PARAMETERS] == NULL, "Must be"); | |
1382 assert(merged_annots[DEFAULTS] == NULL, "Must be"); | |
1383 } | |
1376 | 1384 |
1377 ClassLoaderData* cld = klass->class_loader_data(); | 1385 ClassLoaderData* cld = klass->class_loader_data(); |
1378 MetadataFactory::free_array(cld, original_methods); | 1386 MetadataFactory::free_array(cld, original_methods); |
1379 for (int i = 0; i < NUM_ARRAYS; ++i) { | 1387 for (int i = 0; i < NUM_ARRAYS; ++i) { |
1380 MetadataFactory::free_array(cld, original_annots[i]); | 1388 MetadataFactory::free_array(cld, original_annots[i]); |