Bugfix of refIsInstanceOf() - Brian's patch applied (#25103) BLD200206260100
authormmatula@netbeans.org
Tue, 25 Jun 2002 15:48:01 +0000
changeset 8970af50e0ae106
parent 896 32793164da9e
child 898 5ca7915d3e9f
Bugfix of refIsInstanceOf() - Brian's patch applied (#25103)
mdr/src/org/netbeans/mdr/handlers/InstanceHandler.java
     1.1 --- a/mdr/src/org/netbeans/mdr/handlers/InstanceHandler.java	Mon Jun 24 20:48:02 2002 +0000
     1.2 +++ b/mdr/src/org/netbeans/mdr/handlers/InstanceHandler.java	Tue Jun 25 15:48:01 2002 +0000
     1.3 @@ -206,22 +206,26 @@
     1.4      public final boolean refIsInstanceOf(RefObject objType, boolean considerSubtypes) {
     1.5          try {
     1.6              _lock(false);
     1.7 -            if (refMetaObject().equals(objType)) return true;
     1.8 -            if (considerSubtypes) {
     1.9 -                boolean isInstance;
    1.10 -                Iterator it = ((Collection) ((GeneralizableElement) refMetaObject()).getSupertypes()).iterator();
    1.11 -                while (it.hasNext()) {
    1.12 -                    if (refIsInstanceOf(((RefObject) it.next()), true)) {
    1.13 -                        return true;
    1.14 -                    }
    1.15 -                }
    1.16 -            }
    1.17 -            return false;
    1.18 +            return isInstanceOf((GeneralizableElement) refMetaObject(), objType, considerSubtypes);
    1.19          } finally {
    1.20              _unlock();
    1.21          }
    1.22      }
    1.23  
    1.24 +    private final boolean isInstanceOf(GeneralizableElement metaObject, RefObject objType, boolean considerSubtypes) {
    1.25 +        if (metaObject.equals(objType)) return true;
    1.26 +        if (considerSubtypes) {
    1.27 +            boolean isInstance;
    1.28 +            Iterator it = metaObject.getSupertypes().iterator();
    1.29 +            while (it.hasNext()) {
    1.30 +                if (isInstanceOf(((GeneralizableElement) it.next()), objType, true)) {
    1.31 +                    return true;
    1.32 +                }
    1.33 +            }
    1.34 +        }
    1.35 +        return false;
    1.36 +    }
    1.37 +
    1.38      public final RefClass refClass() {
    1.39          try {
    1.40              _lock(false);