Re: Re: Re: A complete list of JDK classes which CheckClassAdapter fails (bug?)

[email protected]
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <1597305693.1893591282575734319.JavaMail.root@zimbra7-e1.priv.proxad.net>
> Eric,
> Why don't modify CheckClassAdapter to handle join interfaces as suggested
> in the paper you reference ?

I could try this, but a simpler solution is to relax the ASM verifier, ie to consider that any class can be assigned to any interface (like the Sun verifier does):

Index: SimpleVerifier.java
===================================================================
--- SimpleVerifier.java	(revision 1434)
+++ SimpleVerifier.java	(working copy)
@@ -267,6 +267,9 @@
             if (getSuperClass(u) == null) {
                 return false;
             } else {
+                if (isInterface) {
+                    return u.getSort() == Type.OBJECT || u.getSort() == Type.ARRAY;
+                }
                 return isAssignableFrom(t, getSuperClass(u));
             }
         }
@@ -284,7 +287,11 @@
             }
             return false;
         }
-        return getClass(t).isAssignableFrom(getClass(u));
+        Class tc = getClass(t);
+        if (tc.isInterface()) {
+            tc = Object.class;
+        }
+        return tc.isAssignableFrom(getClass(u));
     }

I checked that, with this patch, all JDK classes are considered valid with the ASM verifier.

Eric
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
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.