8247938: Change various JVM enums like LinkInfo::AccessCheck and Klass::DefaultsLookupMode to enum class

Use C++11 scoped enumeration declarations for several different Klass and LinkInfo enumerations.

Reviewed-by: coleenp, hseigel, kbarrett
This commit is contained in:
Lois Foltan 2020-08-06 18:13:56 +00:00
parent 99c7b2b85b
commit deaadfad52
17 changed files with 66 additions and 60 deletions

View file

@ -1769,7 +1769,10 @@ inline int InstanceKlass::quick_search(const Array<Method*>* methods, const Symb
// find_method looks up the name/signature in the local methods array
Method* InstanceKlass::find_method(const Symbol* name,
const Symbol* signature) const {
return find_method_impl(name, signature, find_overpass, find_static, find_private);
return find_method_impl(name, signature,
OverpassLookupMode::find,
StaticLookupMode::find,
PrivateLookupMode::find);
}
Method* InstanceKlass::find_method_impl(const Symbol* name,
@ -1794,8 +1797,8 @@ Method* InstanceKlass::find_instance_method(const Array<Method*>* methods,
Method* const meth = InstanceKlass::find_method_impl(methods,
name,
signature,
find_overpass,
skip_static,
OverpassLookupMode::find,
StaticLookupMode::skip,
private_mode);
assert(((meth == NULL) || !meth->is_static()),
"find_instance_method should have skipped statics");
@ -1853,9 +1856,9 @@ Method* InstanceKlass::find_method(const Array<Method*>* methods,
return InstanceKlass::find_method_impl(methods,
name,
signature,
find_overpass,
find_static,
find_private);
OverpassLookupMode::find,
StaticLookupMode::find,
PrivateLookupMode::find);
}
Method* InstanceKlass::find_method_impl(const Array<Method*>* methods,
@ -1898,9 +1901,9 @@ int InstanceKlass::find_method_index(const Array<Method*>* methods,
OverpassLookupMode overpass_mode,
StaticLookupMode static_mode,
PrivateLookupMode private_mode) {
const bool skipping_overpass = (overpass_mode == skip_overpass);
const bool skipping_static = (static_mode == skip_static);
const bool skipping_private = (private_mode == skip_private);
const bool skipping_overpass = (overpass_mode == OverpassLookupMode::skip);
const bool skipping_static = (static_mode == StaticLookupMode::skip);
const bool skipping_private = (private_mode == PrivateLookupMode::skip);
const int hit = quick_search(methods, name);
if (hit != -1) {
const Method* const m = methods->at(hit);
@ -1976,13 +1979,13 @@ Method* InstanceKlass::uncached_lookup_method(const Symbol* name,
Method* const method = InstanceKlass::cast(klass)->find_method_impl(name,
signature,
overpass_local_mode,
find_static,
StaticLookupMode::find,
private_mode);
if (method != NULL) {
return method;
}
klass = klass->super();
overpass_local_mode = skip_overpass; // Always ignore overpass methods in superclasses
overpass_local_mode = OverpassLookupMode::skip; // Always ignore overpass methods in superclasses
}
return NULL;
}
@ -2012,7 +2015,7 @@ Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name,
}
// Look up interfaces
if (m == NULL) {
m = lookup_method_in_all_interfaces(name, signature, find_defaults);
m = lookup_method_in_all_interfaces(name, signature, DefaultsLookupMode::find);
}
return m;
}
@ -2030,7 +2033,7 @@ Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
ik = all_ifs->at(i);
Method* m = ik->lookup_method(name, signature);
if (m != NULL && m->is_public() && !m->is_static() &&
((defaults_mode != skip_defaults) || !m->is_default_method())) {
((defaults_mode != DefaultsLookupMode::skip) || !m->is_default_method())) {
return m;
}
}