< prev index next >
src/share/vm/classfile/classFileParser.cpp
Print this page
@@ -796,15 +796,15 @@
// Side-effects: populates the _local_interfaces field
void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
const int itfs_len,
ConstantPool* const cp,
- bool* const has_default_methods,
+ bool* const has_nonstatic_concrete_methods,
TRAPS) {
assert(stream != NULL, "invariant");
assert(cp != NULL, "invariant");
- assert(has_default_methods != NULL, "invariant");
+ assert(has_nonstatic_concrete_methods != NULL, "invariant");
if (itfs_len == 0) {
_local_interfaces = Universe::the_empty_klass_array();
} else {
assert(itfs_len > 0, "only called for len>0");
@@ -842,12 +842,12 @@
if (!interf()->is_interface()) {
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(),
"Implementing class");
}
- if (InstanceKlass::cast(interf())->has_default_methods()) {
- *has_default_methods = true;
+ if (InstanceKlass::cast(interf())->has_nonstatic_concrete_methods()) {
+ *has_nonstatic_concrete_methods = true;
}
_local_interfaces->at_put(index, interf());
}
if (!_need_verify || itfs_len <= 1) {
@@ -2828,16 +2828,16 @@
// Side-effects: populates the _methods field in the parser
void ClassFileParser::parse_methods(const ClassFileStream* const cfs,
bool is_interface,
AccessFlags* promoted_flags,
bool* has_final_method,
- bool* declares_default_methods,
+ bool* declares_nonstatic_concrete_methods,
TRAPS) {
assert(cfs != NULL, "invariant");
assert(promoted_flags != NULL, "invariant");
assert(has_final_method != NULL, "invariant");
- assert(declares_default_methods != NULL, "invariant");
+ assert(declares_nonstatic_concrete_methods != NULL, "invariant");
assert(NULL == _methods, "invariant");
cfs->guarantee_more(2, CHECK); // length
const u2 length = cfs->get_u2_fast();
@@ -2858,15 +2858,15 @@
CHECK);
if (method->is_final()) {
*has_final_method = true;
}
- // declares_default_methods: declares concrete instance methods, any access flags
+ // declares_nonstatic_concrete_methods: declares concrete instance methods, any access flags
// used for interface initialization, and default method inheritance analysis
- if (is_interface && !(*declares_default_methods)
+ if (is_interface && !(*declares_nonstatic_concrete_methods)
&& !method->is_abstract() && !method->is_static()) {
- *declares_default_methods = true;
+ *declares_nonstatic_concrete_methods = true;
}
_methods->at_put(index, method);
}
if (_need_verify && length > 1) {
@@ -5248,12 +5248,12 @@
ik->constants()->klass_at_put(_this_class_index, ik); // eagerly resolve
}
ik->set_minor_version(_minor_version);
ik->set_major_version(_major_version);
- ik->set_has_default_methods(_has_default_methods);
- ik->set_declares_default_methods(_declares_default_methods);
+ ik->set_has_nonstatic_concrete_methods(_has_nonstatic_concrete_methods);
+ ik->set_declares_nonstatic_concrete_methods(_declares_nonstatic_concrete_methods);
if (_host_klass != NULL) {
assert (ik->is_anonymous(), "should be the same");
ik->set_host_klass(_host_klass);
}
@@ -5309,17 +5309,14 @@
check_super_interface_access(ik, CHECK);
// check if this class overrides any final method
check_final_method_override(ik, CHECK);
- // check that if this class is an interface then it doesn't have static methods
- if (ik->is_interface()) {
- /* An interface in a JAVA 8 classfile can be static */
- if (_major_version < JAVA_8_VERSION) {
+ // reject static interface methods prior to Java 8
+ if (ik->is_interface() && _major_version < JAVA_8_VERSION) {
check_illegal_static_method(ik, CHECK);
}
- }
// Obtain this_klass' module entry
ModuleEntry* module_entry = ik->module();
assert(module_entry != NULL, "module_entry should always be set");
@@ -5334,13 +5331,13 @@
_protection_domain,
CHECK);
assert(_all_mirandas != NULL, "invariant");
- // Generate any default methods - default methods are interface methods
- // that have a default implementation. This is new with Lambda project.
- if (_has_default_methods ) {
+ // Generate any default methods - default methods are public interface methods
+ // that have a default implementation. This is new with Java 8.
+ if (_has_nonstatic_concrete_methods ) {
DefaultMethods::generate_default_methods(ik,
_all_mirandas,
CHECK);
}
@@ -5521,12 +5518,12 @@
_super_class_index(0),
_itfs_len(0),
_java_fields_count(0),
_need_verify(false),
_relax_verify(false),
- _has_default_methods(false),
- _declares_default_methods(false),
+ _has_nonstatic_concrete_methods(false),
+ _declares_nonstatic_concrete_methods(false),
_has_final_method(false),
_has_finalizer(false),
_has_empty_finalizer(false),
_has_vanilla_constructor(false),
_max_bootstrap_specifier_index(-1) {
@@ -5796,11 +5793,11 @@
// Interfaces
_itfs_len = stream->get_u2_fast();
parse_interfaces(stream,
_itfs_len,
cp,
- &_has_default_methods,
+ &_has_nonstatic_concrete_methods,
CHECK);
assert(_local_interfaces != NULL, "invariant");
// Fields (offsets are filled in later)
@@ -5819,20 +5816,20 @@
AccessFlags promoted_flags;
parse_methods(stream,
_access_flags.is_interface(),
&promoted_flags,
&_has_final_method,
- &_declares_default_methods,
+ &_declares_nonstatic_concrete_methods,
CHECK);
assert(_methods != NULL, "invariant");
// promote flags from parse_methods() to the klass' flags
_access_flags.add_promoted_flags(promoted_flags.as_int());
- if (_declares_default_methods) {
- _has_default_methods = true;
+ if (_declares_nonstatic_concrete_methods) {
+ _has_nonstatic_concrete_methods = true;
}
// Additional attributes/annotations
_parsed_annotations = new ClassAnnotationCollector();
parse_classfile_attributes(stream, cp, _parsed_annotations, CHECK);
@@ -5877,12 +5874,12 @@
true,
CHECK);
}
if (_super_klass != NULL) {
- if (_super_klass->has_default_methods()) {
- _has_default_methods = true;
+ if (_super_klass->has_nonstatic_concrete_methods()) {
+ _has_nonstatic_concrete_methods = true;
}
if (_super_klass->is_interface()) {
ResourceMark rm(THREAD);
Exceptions::fthrow(
< prev index next >