Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/reflectionUtils.cpp @ 12823:ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
Summary: New default methods list with inherited superinterface methods
Reviewed-by: minqi, sspitsyn, coleenp
author | acorn |
---|---|
date | Mon, 07 Oct 2013 12:20:28 -0400 |
parents | da91efe96a93 |
children | 096c224171c4 |
comparison
equal
deleted
inserted
replaced
12822:cc4f5f8d885e | 12823:ac9cb1d5a202 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
25 #include "precompiled.hpp" | 25 #include "precompiled.hpp" |
26 #include "classfile/javaClasses.hpp" | 26 #include "classfile/javaClasses.hpp" |
27 #include "memory/universe.inline.hpp" | 27 #include "memory/universe.inline.hpp" |
28 #include "runtime/reflectionUtils.hpp" | 28 #include "runtime/reflectionUtils.hpp" |
29 | 29 |
30 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, bool classes_only) { | 30 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, |
31 _klass = klass; | 31 bool classes_only, bool walk_defaults) { |
32 _klass = _base_klass = klass; | |
33 _base_class_search_defaults = false; | |
34 _defaults_checked = false; | |
32 if (classes_only) { | 35 if (classes_only) { |
33 _interfaces = Universe::the_empty_klass_array(); | 36 _interfaces = Universe::the_empty_klass_array(); |
34 } else { | 37 } else { |
35 _interfaces = klass->transitive_interfaces(); | 38 _interfaces = klass->transitive_interfaces(); |
36 } | 39 } |
37 _interface_index = _interfaces->length(); | 40 _interface_index = _interfaces->length(); |
38 _local_only = local_only; | 41 _local_only = local_only; |
39 _classes_only = classes_only; | 42 _classes_only = classes_only; |
43 _walk_defaults = walk_defaults; | |
40 } | 44 } |
41 | 45 |
42 bool KlassStream::eos() { | 46 bool KlassStream::eos() { |
43 if (index() >= 0) return false; | 47 if (index() >= 0) return false; |
44 if (_local_only) return true; | 48 if (_local_only) return true; |
45 if (!_klass->is_interface() && _klass->super() != NULL) { | 49 if (!_klass->is_interface() && _klass->super() != NULL) { |
46 // go up superclass chain (not for interfaces) | 50 // go up superclass chain (not for interfaces) |
47 _klass = _klass->super(); | 51 _klass = _klass->super(); |
52 // Next for method walks, walk default methods | |
53 } else if (_walk_defaults && (_defaults_checked == false) && (_base_klass->default_methods() != NULL)) { | |
54 _base_class_search_defaults = true; | |
55 _klass = _base_klass; | |
56 _defaults_checked = true; | |
48 } else { | 57 } else { |
58 // Next walk transitive interfaces | |
49 if (_interface_index > 0) { | 59 if (_interface_index > 0) { |
50 _klass = _interfaces->at(--_interface_index); | 60 _klass = _interfaces->at(--_interface_index); |
51 } else { | 61 } else { |
52 return true; | 62 return true; |
53 } | 63 } |