equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2012, 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. |
887 // ReferenceType or do we want objects of exact type only? |
887 // ReferenceType or do we want objects of exact type only? |
888 public List/*<ObjectReference>*/ objectsByType(ReferenceType type, boolean includeSubtypes) { |
888 public List/*<ObjectReference>*/ objectsByType(ReferenceType type, boolean includeSubtypes) { |
889 Klass kls = ((ReferenceTypeImpl)type).ref(); |
889 Klass kls = ((ReferenceTypeImpl)type).ref(); |
890 if (kls instanceof InstanceKlass) { |
890 if (kls instanceof InstanceKlass) { |
891 InstanceKlass ik = (InstanceKlass) kls; |
891 InstanceKlass ik = (InstanceKlass) kls; |
892 if (ik.isInterface()) { |
892 // if the Klass is final or if there are no subklasses loaded yet |
893 if (ik.nofImplementors() == 0L) { |
893 if (ik.getAccessFlagsObj().isFinal() || ik.getSubklassKlass() == null) { |
894 return new ArrayList(0); |
894 includeSubtypes = false; |
895 } |
|
896 } else { |
|
897 // if the Klass is final or if there are no subklasses loaded yet |
|
898 if (ik.getAccessFlagsObj().isFinal() || ik.getSubklassKlass() == null) { |
|
899 includeSubtypes = false; |
|
900 } |
|
901 } |
895 } |
902 } else { |
896 } else { |
903 // no subtypes for primitive array types |
897 // no subtypes for primitive array types |
904 ArrayTypeImpl arrayType = (ArrayTypeImpl) type; |
898 ArrayTypeImpl arrayType = (ArrayTypeImpl) type; |
905 try { |
899 try { |