src/share/vm/classfile/classFileParser.cpp

changeset 8761
4c3cae5323bb
parent 8679
fff265b31090
child 8856
ac27a9c85bea
child 9351
bae7d3cdf6af
equal deleted inserted replaced
8736:857e77fd668d 8761:4c3cae5323bb
819 ResourceMark rm(THREAD); 819 ResourceMark rm(THREAD);
820 NameSigHash** interface_names = NEW_RESOURCE_ARRAY_IN_THREAD( 820 NameSigHash** interface_names = NEW_RESOURCE_ARRAY_IN_THREAD(
821 THREAD, NameSigHash*, HASH_ROW_SIZE); 821 THREAD, NameSigHash*, HASH_ROW_SIZE);
822 initialize_hashtable(interface_names); 822 initialize_hashtable(interface_names);
823 bool dup = false; 823 bool dup = false;
824 Symbol* name = NULL;
824 { 825 {
825 debug_only(No_Safepoint_Verifier nsv;) 826 debug_only(No_Safepoint_Verifier nsv;)
826 for (index = 0; index < length; index++) { 827 for (index = 0; index < length; index++) {
827 Klass* k = _local_interfaces->at(index); 828 Klass* k = _local_interfaces->at(index);
828 Symbol* name = InstanceKlass::cast(k)->name(); 829 name = InstanceKlass::cast(k)->name();
829 // If no duplicates, add (name, NULL) in hashtable interface_names. 830 // If no duplicates, add (name, NULL) in hashtable interface_names.
830 if (!put_after_lookup(name, NULL, interface_names)) { 831 if (!put_after_lookup(name, NULL, interface_names)) {
831 dup = true; 832 dup = true;
832 break; 833 break;
833 } 834 }
834 } 835 }
835 } 836 }
836 if (dup) { 837 if (dup) {
837 classfile_parse_error("Duplicate interface name in class file %s", CHECK_NULL); 838 classfile_parse_error("Duplicate interface name \"%s\" in class file %s",
839 name->as_C_string(), CHECK_NULL);
838 } 840 }
839 } 841 }
840 return _local_interfaces; 842 return _local_interfaces;
841 } 843 }
842 844
1277 ResourceMark rm(THREAD); 1279 ResourceMark rm(THREAD);
1278 NameSigHash** names_and_sigs = NEW_RESOURCE_ARRAY_IN_THREAD( 1280 NameSigHash** names_and_sigs = NEW_RESOURCE_ARRAY_IN_THREAD(
1279 THREAD, NameSigHash*, HASH_ROW_SIZE); 1281 THREAD, NameSigHash*, HASH_ROW_SIZE);
1280 initialize_hashtable(names_and_sigs); 1282 initialize_hashtable(names_and_sigs);
1281 bool dup = false; 1283 bool dup = false;
1284 Symbol* name = NULL;
1285 Symbol* sig = NULL;
1282 { 1286 {
1283 debug_only(No_Safepoint_Verifier nsv;) 1287 debug_only(No_Safepoint_Verifier nsv;)
1284 for (AllFieldStream fs(fields, _cp); !fs.done(); fs.next()) { 1288 for (AllFieldStream fs(fields, _cp); !fs.done(); fs.next()) {
1285 Symbol* name = fs.name(); 1289 name = fs.name();
1286 Symbol* sig = fs.signature(); 1290 sig = fs.signature();
1287 // If no duplicates, add name/signature in hashtable names_and_sigs. 1291 // If no duplicates, add name/signature in hashtable names_and_sigs.
1288 if (!put_after_lookup(name, sig, names_and_sigs)) { 1292 if (!put_after_lookup(name, sig, names_and_sigs)) {
1289 dup = true; 1293 dup = true;
1290 break; 1294 break;
1291 } 1295 }
1292 } 1296 }
1293 } 1297 }
1294 if (dup) { 1298 if (dup) {
1295 classfile_parse_error("Duplicate field name&signature in class file %s", 1299 classfile_parse_error("Duplicate field name \"%s\" with signature \"%s\" in class file %s",
1296 CHECK_NULL); 1300 name->as_C_string(), sig->as_klass_external_name(), CHECK_NULL);
1297 } 1301 }
1298 } 1302 }
1299 1303
1300 return fields; 1304 return fields;
1301 } 1305 }
2578 ResourceMark rm(THREAD); 2582 ResourceMark rm(THREAD);
2579 NameSigHash** names_and_sigs = NEW_RESOURCE_ARRAY_IN_THREAD( 2583 NameSigHash** names_and_sigs = NEW_RESOURCE_ARRAY_IN_THREAD(
2580 THREAD, NameSigHash*, HASH_ROW_SIZE); 2584 THREAD, NameSigHash*, HASH_ROW_SIZE);
2581 initialize_hashtable(names_and_sigs); 2585 initialize_hashtable(names_and_sigs);
2582 bool dup = false; 2586 bool dup = false;
2587 Symbol* name = NULL;
2588 Symbol* sig = NULL;
2583 { 2589 {
2584 debug_only(No_Safepoint_Verifier nsv;) 2590 debug_only(No_Safepoint_Verifier nsv;)
2585 for (int i = 0; i < length; i++) { 2591 for (int i = 0; i < length; i++) {
2586 Method* m = _methods->at(i); 2592 Method* m = _methods->at(i);
2593 name = m->name();
2594 sig = m->signature();
2587 // If no duplicates, add name/signature in hashtable names_and_sigs. 2595 // If no duplicates, add name/signature in hashtable names_and_sigs.
2588 if (!put_after_lookup(m->name(), m->signature(), names_and_sigs)) { 2596 if (!put_after_lookup(name, sig, names_and_sigs)) {
2589 dup = true; 2597 dup = true;
2590 break; 2598 break;
2591 } 2599 }
2592 } 2600 }
2593 } 2601 }
2594 if (dup) { 2602 if (dup) {
2595 classfile_parse_error("Duplicate method name&signature in class file %s", 2603 classfile_parse_error("Duplicate method name \"%s\" with signature \"%s\" in class file %s",
2596 CHECK_NULL); 2604 name->as_C_string(), sig->as_klass_external_name(), CHECK_NULL);
2597 } 2605 }
2598 } 2606 }
2599 } 2607 }
2600 return _methods; 2608 return _methods;
2601 } 2609 }

mercurial