--- old/src/share/vm/oops/instanceKlass.cpp 2015-12-05 15:20:05.438452291 +0100 +++ new/src/share/vm/oops/instanceKlass.cpp 2015-12-05 15:20:05.202452285 +0100 @@ -1169,6 +1169,57 @@ return true; } } + // field not found. Try to search for an accessor-method-pair + bool found = false; + int length = sig->utf8_length(); + if (length > 0) { + // extract original signature+ one \0 char + char fSig[length+1]; + sig->as_C_string(fSig,length+1); + + // the signature of the get-Method is two chars longer + \0 + char get_sig[length+3]; + sprintf(get_sig,"()%s",fSig); + + // the signature of the put-Method is three chars longer + \0 + char put_sig[length+4]; + sprintf(put_sig,"(%s)V",fSig); + + // Look through all methods in the class. + Array* methods = this->methods(); + for (int i = 0; i < methods->length(); i++) { + Method* m = methods->at(i); + + // extract name of accessor-field + u2 af = m->accessor_field_name(); + // Is zero an valid index? + if (af != 0) { + Symbol* fn = m->constMethod()->constants()->symbol_at(af); + char mname[name->utf8_length()+1]; + name->as_C_string(mname,name->utf8_length()+1); + // if fieldname matches. record match and store name and + // signature in fielddescriptor + if (fn->equals(mname)) { + found = true; + fd->set_field_name_from_accessor(af); + fd->set_sig_for_accessor(sig); + if (m->signature()->equals(get_sig)) { + // remember get method + fd->set_get_accessor(m->method_idnum()); + }else if (m->signature()->equals(put_sig)) { + // remember put method + fd->set_put_accessor(m->method_idnum()); + } + } + } + } + } + if (found) { + // initialize accesor-values in fielddescriptor + fd->reinitialize_accessor(const_cast(this)); + // is the fielddescriptor a valid accessor-fielddescriptor? + return fd->is_accessor(); + } return false; }