cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic ReferenceType.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
enver       2002/08/01 15:43:41

  Modified:    src/java/org/apache/bcel/generic ReferenceType.java
  Log:
  Sorry! The cat ate my curly brace just before commit.
  
  Revision  Changes    Path
  1.3       +38 -37    jakarta-bcel/src/java/org/apache/bcel/generic/ReferenceType.java
  
  Index: ReferenceType.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/generic/ReferenceType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ReferenceType.java	1 Aug 2002 22:38:42 -0000	1.2
  +++ ReferenceType.java	1 Aug 2002 22:43:40 -0000	1.3
  @@ -236,44 +236,45 @@
                   );
   
               }
  +        }
   
  -            if ((this instanceof ArrayType) || (t instanceof ArrayType))
  -                return Type.OBJECT;
  -            // TODO: Is there a proof of OBJECT being the direct ancestor of every ArrayType?
  -
  -            if (((this instanceof ObjectType) && ((ObjectType) this).referencesInterface()) ||
  -                    ((t instanceof ObjectType) && ((ObjectType) t).referencesInterface()))
  -                return Type.OBJECT;
  -            // TODO: The above line is correct comparing to the vmspec2. But one could
  -            // make class file verification a bit stronger here by using the notion of
  -            // superinterfaces or even castability or assignment compatibility.
  -
  -
  -            // this and t are ObjectTypes, see above.
  -            ObjectType thiz = (ObjectType) this;
  -            ObjectType other = (ObjectType) t;
  -            JavaClass[] thiz_sups = Repository.getSuperClasses(thiz.getClassName());
  -            JavaClass[] other_sups = Repository.getSuperClasses(other.getClassName());
  +        if ((this instanceof ArrayType) || (t instanceof ArrayType))
  +            return Type.OBJECT;
  +        // TODO: Is there a proof of OBJECT being the direct ancestor of every ArrayType?
  +
  +        if (((this instanceof ObjectType) && ((ObjectType) this).referencesInterface()) ||
  +                ((t instanceof ObjectType) && ((ObjectType) t).referencesInterface()))
  +            return Type.OBJECT;
  +        // TODO: The above line is correct comparing to the vmspec2. But one could
  +        // make class file verification a bit stronger here by using the notion of
  +        // superinterfaces or even castability or assignment compatibility.
  +
  +
  +        // this and t are ObjectTypes, see above.
  +        ObjectType thiz = (ObjectType) this;
  +        ObjectType other = (ObjectType) t;
  +        JavaClass[] thiz_sups = Repository.getSuperClasses(thiz.getClassName());
  +        JavaClass[] other_sups = Repository.getSuperClasses(other.getClassName());
   
  -            if ((thiz_sups == null) || (other_sups == null)) {
  -                return null;
  -            }
  +        if ((thiz_sups == null) || (other_sups == null)) {
  +            return null;
  +        }
   
  -            // Waaahh...
  -            JavaClass[] this_sups = new JavaClass[thiz_sups.length + 1];
  -            JavaClass[] t_sups = new JavaClass[other_sups.length + 1];
  -            System.arraycopy(thiz_sups, 0, this_sups, 1, thiz_sups.length);
  -            System.arraycopy(other_sups, 0, t_sups, 1, other_sups.length);
  -            this_sups[0] = Repository.lookupClass(thiz.getClassName());
  -            t_sups[0] = Repository.lookupClass(other.getClassName());
  -
  -            for (int i = 0; i < t_sups.length; i++) {
  -                for (int j = 0; j < this_sups.length; j++) {
  -                    if (this_sups[j].equals(t_sups[i])) return new ObjectType(this_sups[j].getClassName());
  -                }
  +        // Waaahh...
  +        JavaClass[] this_sups = new JavaClass[thiz_sups.length + 1];
  +        JavaClass[] t_sups = new JavaClass[other_sups.length + 1];
  +        System.arraycopy(thiz_sups, 0, this_sups, 1, thiz_sups.length);
  +        System.arraycopy(other_sups, 0, t_sups, 1, other_sups.length);
  +        this_sups[0] = Repository.lookupClass(thiz.getClassName());
  +        t_sups[0] = Repository.lookupClass(other.getClassName());
  +
  +        for (int i = 0; i < t_sups.length; i++) {
  +            for (int j = 0; j < this_sups.length; j++) {
  +                if (this_sups[j].equals(t_sups[i])) return new ObjectType(this_sups[j].getClassName());
               }
  -
  -            // Huh? Did you ask for Type.OBJECT's superclass??
  -            return null;
           }
  +
  +        // Huh? Did you ask for Type.OBJECT's superclass??
  +        return null;
       }
  +}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.