[hotspot]The VM support of static and private interface method

bitter_fox bitterfoxc at gmail.com
Thu Jan 10 22:49:26 PST 2013


FYI, this is the diff around static interface method.

Regards,
bitter_fox

[1]:
@@ -3788,7 +3788,7 @@ instanceKlassHandle ClassFileParser::par
check_final_method_override(this_klass, CHECK_(nullHandle));
// check that if this class is an interface then it doesn't have static
methods
- if (this_klass->is_interface()) {
+ if (this_klass->is_interface() && major_version < JAVA_8_VERSION) {
check_illegal_static_method(this_klass, CHECK_(nullHandle));
}

[2]:
@@ -3766,6 +3767,31 @@ instanceKlassHandle ClassFileParser::par
// Initialize itable offset tables
klassItable::setup_itable_offset_table(this_klass);
+ // Compute transitive closure of interfaces this class implements
+ // Do final class setup
+ fill_oop_maps(this_klass, nonstatic_oop_map_count, nonstatic_oop_offsets,
nonstatic_oop_counts);
+
+ // Fill in has_finalizer, has_vanilla_constructor, and layout_helper
+ set_precomputed_flags(this_klass);
+
+ // reinitialize modifiers, using the InnerClasses attribute
+ int computed_modifiers =
this_klass->compute_modifier_flags(CHECK_(nullHandle));
+ this_klass->set_modifier_flags(computed_modifiers);
+
+ // check if this class can access its super class
+ check_super_class_access(this_klass, CHECK_(nullHandle));
+
+ // check if this class can access its superinterfaces
+ check_super_interface_access(this_klass, CHECK_(nullHandle));
+
+ // check if this class overrides any final method
+ check_final_method_override(this_klass, CHECK_(nullHandle));
+
+ // check that if this class is an interface then it doesn't have static
methods
+ if (this_klass->is_interface()) {
+ check_illegal_static_method(this_klass, CHECK_(nullHandle));
+ }
+
#ifdef ASSERT
if (ParseAllGenericSignatures) {
@@ -3773,39 +3799,17 @@ instanceKlassHandle ClassFileParser::par
}
#endif
+ // Generate any default methods - default methods are interface methods
+ // that have a default implementation. This is new with Lambda project.
if (has_default_methods && !access_flags.is_interface() &&
local_interfaces->length() > 0) {
DefaultMethods::generate_default_methods(
this_klass(), &all_mirandas, CHECK_(nullHandle));
}
+
if (_requires_bridges && !access_flags.is_interface()) {
DefaultMethods::create_missing_bridges(this_klass(), CHECK_(nullHandle));
- }
-
- // Compute transitive closure of interfaces this class implements
- // Do final class setup
- fill_oop_maps(this_klass, nonstatic_oop_map_count, nonstatic_oop_offsets,
nonstatic_oop_counts);
-
- // Fill in has_finalizer, has_vanilla_constructor, and layout_helper
- set_precomputed_flags(this_klass);
-
- // reinitialize modifiers, using the InnerClasses attribute
- int computed_modifiers =
this_klass->compute_modifier_flags(CHECK_(nullHandle));
- this_klass->set_modifier_flags(computed_modifiers);
-
- // check if this class can access its super class
- check_super_class_access(this_klass, CHECK_(nullHandle));
-
- // check if this class can access its superinterfaces
- check_super_interface_access(this_klass, CHECK_(nullHandle));
-
- // check if this class overrides any final method
- check_final_method_override(this_klass, CHECK_(nullHandle));
-
- // check that if this class is an interface then it doesn't have static
methods
- if (this_klass->is_interface() && major_version < JAVA_8_VERSION) {
- check_illegal_static_method(this_klass, CHECK_(nullHandle));
}
// Allocate mirror and initialize static fields


More information about the lambda-dev mailing list