src/share/vm/classfile/classFileParser.cpp

changeset 7290
90257dfad6e3
parent 7275
8e15758b2e94
child 7417
0fa1f71a905b
     1.1 --- a/src/share/vm/classfile/classFileParser.cpp	Fri Oct 24 03:03:59 2014 +0000
     1.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Fri Oct 24 12:29:08 2014 -0700
     1.3 @@ -2529,7 +2529,7 @@
     1.4  Array<Method*>* ClassFileParser::parse_methods(bool is_interface,
     1.5                                                 AccessFlags* promoted_flags,
     1.6                                                 bool* has_final_method,
     1.7 -                                               bool* has_default_methods,
     1.8 +                                               bool* declares_default_methods,
     1.9                                                 TRAPS) {
    1.10    ClassFileStream* cfs = stream();
    1.11    cfs->guarantee_more(2, CHECK_NULL);  // length
    1.12 @@ -2548,11 +2548,11 @@
    1.13        if (method->is_final()) {
    1.14          *has_final_method = true;
    1.15        }
    1.16 -      if (is_interface && !(*has_default_methods)
    1.17 -        && !method->is_abstract() && !method->is_static()
    1.18 -        && !method->is_private()) {
    1.19 -        // default method
    1.20 -        *has_default_methods = true;
    1.21 +      // declares_default_methods: declares concrete instance methods, any access flags
    1.22 +      // used for interface initialization, and default method inheritance analysis
    1.23 +      if (is_interface && !(*declares_default_methods)
    1.24 +        && !method->is_abstract() && !method->is_static()) {
    1.25 +        *declares_default_methods = true;
    1.26        }
    1.27        _methods->at_put(index, method());
    1.28      }
    1.29 @@ -3691,6 +3691,7 @@
    1.30    JvmtiCachedClassFileData *cached_class_file = NULL;
    1.31    Handle class_loader(THREAD, loader_data->class_loader());
    1.32    bool has_default_methods = false;
    1.33 +  bool declares_default_methods = false;
    1.34    ResourceMark rm(THREAD);
    1.35  
    1.36    ClassFileStream* cfs = stream();
    1.37 @@ -3928,8 +3929,11 @@
    1.38      Array<Method*>* methods = parse_methods(access_flags.is_interface(),
    1.39                                              &promoted_flags,
    1.40                                              &has_final_method,
    1.41 -                                            &has_default_methods,
    1.42 +                                            &declares_default_methods,
    1.43                                              CHECK_(nullHandle));
    1.44 +    if (declares_default_methods) {
    1.45 +      has_default_methods = true;
    1.46 +    }
    1.47  
    1.48      // Additional attributes
    1.49      ClassAnnotationCollector parsed_annotations;
    1.50 @@ -4072,6 +4076,7 @@
    1.51      this_klass->set_minor_version(minor_version);
    1.52      this_klass->set_major_version(major_version);
    1.53      this_klass->set_has_default_methods(has_default_methods);
    1.54 +    this_klass->set_declares_default_methods(declares_default_methods);
    1.55  
    1.56      if (!host_klass.is_null()) {
    1.57        assert (this_klass->is_anonymous(), "should be the same");

mercurial