Inserting new label node

Yudi Zheng <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CAA=eNoNBP4mZJ5Cyg4+CozAKaf2waxrp928bh9BDE2D4Byzxdw@mail.gmail.com>
Hi,

We have encountered some buggy behavior while using LabelNodes.
The LabelNode is correctly bound with Label but it's not true in the
opposite direction. We believe that Label should be also properly
bound with LabelNode as it is required for example by
MethodNode.getLabelNode() method.

protected LabelNode getLabelNode(final Label l) {
>  if (!(l.info instanceof LabelNode)) {
>  l.info = new LabelNode(l);
>  }
>  return (LabelNode) l.info;
> }


We are proposing following changes (see attached patch) to the
LabelNode class. Do you think it makes sense?

PS: We still didn't receive reply to our previous mail  :)

Best regards,
Yudi
LabelNodePatch.patch (application/octet-stream, 516 B)
Index: LabelNode.java
===================================================================
--- LabelNode.java	(revision 1502)
+++ LabelNode.java	(working copy)
@@ -48,6 +48,7 @@
     public LabelNode(final Label label) {
         super(-1);
         this.label = label;
+		this.label.info = this;
     }
 
     public int getType() {
@@ -57,6 +58,7 @@
     public Label getLabel() {
         if (label == null) {
             label = new Label();
+			label.info = this;
         }
         return label;
     }
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.