# HG changeset patch # User amurillo # Date 1389727335 28800 # Node ID 2c3130311ffa6cb6ac7886433cf31c04ea8bdb57 # Parent ac902fca803b643cda167fb1ede0e0ae8b0bf603# Parent b99955ea4b918ce5ad421362aa812b81c658fb43 Merge diff -r b99955ea4b91 -r 2c3130311ffa .hgtags --- a/.hgtags Mon Jan 13 22:31:47 2014 -0800 +++ b/.hgtags Tue Jan 14 11:22:15 2014 -0800 @@ -408,3 +408,4 @@ 55fb97c4c58d6ed4db8ec02a382ba518d9265815 hs25-b65 d3521d8e562a782f66fc0dfdebeffba2c7e3471d jdk8-b122 591135a7d6f96c0ef281d078cee9a8d8c342d45c jdk8-b123 +9b9816164447214f21b06ccf646893c281c76a42 hs25-b66 diff -r b99955ea4b91 -r 2c3130311ffa make/hotspot_version --- a/make/hotspot_version Mon Jan 13 22:31:47 2014 -0800 +++ b/make/hotspot_version Tue Jan 14 11:22:15 2014 -0800 @@ -35,7 +35,7 @@ HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=65 +HS_BUILD_NUMBER=66 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff -r b99955ea4b91 -r 2c3130311ffa src/share/vm/classfile/defaultMethods.cpp --- a/src/share/vm/classfile/defaultMethods.cpp Mon Jan 13 22:31:47 2014 -0800 +++ b/src/share/vm/classfile/defaultMethods.cpp Tue Jan 14 11:22:15 2014 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -390,6 +390,20 @@ Symbol* get_exception_message() { return _exception_message; } Symbol* get_exception_name() { return _exception_name; } + // Return true if the specified klass has a static method that matches + // the name and signature of the target method. + bool has_matching_static(InstanceKlass* root) { + if (_members.length() > 0) { + Pair entry = _members.at(0); + Method* impl = root->find_method(entry.first->name(), + entry.first->signature()); + if ((impl != NULL) && impl->is_static()) { + return true; + } + } + return false; + } + // Either sets the target or the exception error message void determine_target(InstanceKlass* root, TRAPS) { if (has_target() || throws_exception()) { @@ -416,19 +430,26 @@ } if (num_defaults == 0) { - if (qualified_methods.length() == 0) { - _exception_message = generate_no_defaults_message(CHECK); - } else { - assert(root != NULL, "Null root class"); - _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); + // If the root klass has a static method with matching name and signature + // then do not generate an overpass method because it will hide the + // static method during resolution. + if (!has_matching_static(root)) { + if (qualified_methods.length() == 0) { + _exception_message = generate_no_defaults_message(CHECK); + } else { + assert(root != NULL, "Null root class"); + _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); + } + _exception_name = vmSymbols::java_lang_AbstractMethodError(); } - _exception_name = vmSymbols::java_lang_AbstractMethodError(); + // If only one qualified method is default, select that } else if (num_defaults == 1) { _selected_target = qualified_methods.at(default_index); - } else if (num_defaults > 1) { - _exception_message = generate_conflicts_message(&qualified_methods,CHECK); - _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); + + } else if (num_defaults > 1 && !has_matching_static(root)) { + _exception_message = generate_conflicts_message(&qualified_methods,CHECK); + _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); if (TraceDefaultMethods) { _exception_message->print_value_on(tty); tty->print_cr("");