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

[email protected]
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <95895931.1599361282312296145.JavaMail.root@zimbra7-e1.priv.proxad.net>
Sai Zhang wrote:
> Hi,
> 
> I am using ASM to instrument the whole JDK, but found the 
> CheckClassAdapter seems
> to be not so "reliable". It fails when verifying the bytecode of 
> *untouched *JDK classes (in rt.jar).
> 
> There could be two possibilities:
> (1) a bug in CheckClassAdapter
> (2) the JDK classes are not valid themselves (which might not be the 
> case, I could be wrong.)
> 
> We can reproduce it by simply using the following command:
> 
> |java -cp asm-all.jar org.objectweb.asm.util.CheckClassAdapter 
> org/domain/package/YourClass.class|
> 
> Any one has ideas on this point? Any comments and suggestion are highly 
> appreciated.

for the java.awt.List case, it seems the problem comes from the merge of two interface types on the stack. One branch of a "if" pushes a java.awt.ActionListener. The other branch pushes a java.awt.ItemListener. ASM merges this using the common *super class*, which is Object (the common super-interface is java.awt.EventListener, the expected type). The problem is that I never saw any rule in the JVM specification to compute such a common super interface type when merging stack frames.

Eric

Error at instruction 25: Argument 1: expected Ljava/util/EventListener;, but found R

00000 List Class .               :                 :     ACONST_NULL
00001 List Class .               : Lnull;          :     ASTORE 2
00002 List Class Lnull;          :                 :     ALOAD 1
00003 List Class Lnull;          : Class           :     LDC Ljava/awt/event/ActionListener;.class
00004 List Class Lnull;          : Class Class     :     IF_ACMPNE L0
00005 List Class Lnull;          :                 :     ALOAD 0
00006 List Class Lnull;          : List            :     GETFIELD java/awt/List.actionListener : Ljava/awt/event/ActionListener;
00007 List Class Lnull;          : ActionListener  :     ASTORE 2
00008 List Class ActionListener  :                 :     GOTO L1
00009 List Class Lnull;          :                 :    L0
00010 List Class Lnull;          :                 :     ALOAD 1
00011 List Class Lnull;          : Class           :     LDC Ljava/awt/event/ItemListener;.class
00012 List Class Lnull;          : Class Class     :     IF_ACMPNE L2
00013 List Class Lnull;          :                 :     ALOAD 0
00014 List Class Lnull;          : List            :     GETFIELD java/awt/List.itemListener : Ljava/awt/event/ItemListener;
00015 List Class Lnull;          : ItemListener    :     ASTORE 2
00016 List Class ItemListener    :                 :     GOTO L1
00017 List Class Lnull;          :                 :    L2
00018 List Class Lnull;          :                 :     ALOAD 0
00019 List Class Lnull;          : List            :     ALOAD 1
00020 List Class Lnull;          : List Class      :     INVOKESPECIAL java/awt/Component.getListeners (Ljava/lang/Class;)[Ljava/util/EventListener;
00021 List Class Lnull;          : EventListener   :     ARETURN
00022 List Class R               :                 :    L1
00023 List Class R               :                 :     ALOAD 2
00024 List Class R               : R               :     ALOAD 1
00025 List Class R               : R Class         :     INVOKESTATIC java/awt/AWTEventMulticaster.getListeners (Ljava/util/EventListener;Ljava/lang/Class;)[Ljava/util/EventListener;
00026 List Class ItemListener    : EventListener   :     ARETURN
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.