src/share/vm/classfile/classFileParser.cpp

changeset 8761
4c3cae5323bb
parent 8679
fff265b31090
child 8856
ac27a9c85bea
child 9351
bae7d3cdf6af
     1.1 --- a/src/share/vm/classfile/classFileParser.cpp	Wed Apr 12 09:03:26 2017 -0700
     1.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Thu Apr 20 04:53:33 2017 -0400
     1.3 @@ -821,11 +821,12 @@
     1.4        THREAD, NameSigHash*, HASH_ROW_SIZE);
     1.5      initialize_hashtable(interface_names);
     1.6      bool dup = false;
     1.7 +    Symbol* name = NULL;
     1.8      {
     1.9        debug_only(No_Safepoint_Verifier nsv;)
    1.10        for (index = 0; index < length; index++) {
    1.11          Klass* k = _local_interfaces->at(index);
    1.12 -        Symbol* name = InstanceKlass::cast(k)->name();
    1.13 +        name = InstanceKlass::cast(k)->name();
    1.14          // If no duplicates, add (name, NULL) in hashtable interface_names.
    1.15          if (!put_after_lookup(name, NULL, interface_names)) {
    1.16            dup = true;
    1.17 @@ -834,7 +835,8 @@
    1.18        }
    1.19      }
    1.20      if (dup) {
    1.21 -      classfile_parse_error("Duplicate interface name in class file %s", CHECK_NULL);
    1.22 +      classfile_parse_error("Duplicate interface name \"%s\" in class file %s",
    1.23 +               name->as_C_string(), CHECK_NULL);
    1.24      }
    1.25    }
    1.26    return _local_interfaces;
    1.27 @@ -1279,11 +1281,13 @@
    1.28        THREAD, NameSigHash*, HASH_ROW_SIZE);
    1.29      initialize_hashtable(names_and_sigs);
    1.30      bool dup = false;
    1.31 +    Symbol* name = NULL;
    1.32 +    Symbol* sig = NULL;
    1.33      {
    1.34        debug_only(No_Safepoint_Verifier nsv;)
    1.35        for (AllFieldStream fs(fields, _cp); !fs.done(); fs.next()) {
    1.36 -        Symbol* name = fs.name();
    1.37 -        Symbol* sig = fs.signature();
    1.38 +        name = fs.name();
    1.39 +        sig = fs.signature();
    1.40          // If no duplicates, add name/signature in hashtable names_and_sigs.
    1.41          if (!put_after_lookup(name, sig, names_and_sigs)) {
    1.42            dup = true;
    1.43 @@ -1292,8 +1296,8 @@
    1.44        }
    1.45      }
    1.46      if (dup) {
    1.47 -      classfile_parse_error("Duplicate field name&signature in class file %s",
    1.48 -                            CHECK_NULL);
    1.49 +      classfile_parse_error("Duplicate field name \"%s\" with signature \"%s\" in class file %s",
    1.50 +                             name->as_C_string(), sig->as_klass_external_name(), CHECK_NULL);
    1.51      }
    1.52    }
    1.53  
    1.54 @@ -2580,20 +2584,24 @@
    1.55          THREAD, NameSigHash*, HASH_ROW_SIZE);
    1.56        initialize_hashtable(names_and_sigs);
    1.57        bool dup = false;
    1.58 +      Symbol* name = NULL;
    1.59 +      Symbol* sig = NULL;
    1.60        {
    1.61          debug_only(No_Safepoint_Verifier nsv;)
    1.62          for (int i = 0; i < length; i++) {
    1.63            Method* m = _methods->at(i);
    1.64 +          name = m->name();
    1.65 +          sig = m->signature();
    1.66            // If no duplicates, add name/signature in hashtable names_and_sigs.
    1.67 -          if (!put_after_lookup(m->name(), m->signature(), names_and_sigs)) {
    1.68 +          if (!put_after_lookup(name, sig, names_and_sigs)) {
    1.69              dup = true;
    1.70              break;
    1.71            }
    1.72          }
    1.73        }
    1.74        if (dup) {
    1.75 -        classfile_parse_error("Duplicate method name&signature in class file %s",
    1.76 -                              CHECK_NULL);
    1.77 +        classfile_parse_error("Duplicate method name \"%s\" with signature \"%s\" in class file %s",
    1.78 +                              name->as_C_string(), sig->as_klass_external_name(), CHECK_NULL);
    1.79        }
    1.80      }
    1.81    }

mercurial