When you create your PR for 7.2, please close this one in favor of that: https://github.com/apache/netbeans/pull/1108

On 11/7/19 1:41 PM, Jose Ch wrote:
Thanks for your help Peter.

I tested the PR and it works for both the asm5.2 and the asm7.2 branches. I
also compare the output from the original asm5.0.1 with the new ones
(ams5.2-asm7.2) and it was the same.

I also tested using ASM API v6 & v7, the output was the same and I worked
without problems my daily projects. I will prepare the PR today.

Jose Contreras

El jue., 7 nov. 2019 a las 3:58, Peter Hull (<peterhul...@gmail.com>)
escribió:

On Wed, 6 Nov 2019 at 22:24, Jose Ch <pepnes...@gmail.com> wrote:
I will test the PR and do as you suggest Pete.
For what it's worth my implementation was a bit different:
     private static class CtorDelVisitor extends AnnotationVisitor {
         int[] indices;
         /**
          * Constructs a new {@link AnnotationVisitor}.
          *
          * @param api the ASM API version implemented by this visitor. Must
be one of {@link
          *     Opcodes#ASM4}, {@link Opcodes#ASM5}, {@link Opcodes#ASM6} or
{@link Opcodes#ASM7}.
          */
         public CtorDelVisitor(int api) {
             super(api);
         }
         @Override
         public AnnotationVisitor visitArray(String name) {
             if ("delegateParams".equals(name)) {  // NOI18N
                 return new AnnotationVisitor(api) {
                     List<Integer> list = new ArrayList<>();
                     @Override
                     public void visit(String name, Object value) {
                         list.add((Integer) value);
                     }
                     @Override
                     public void visitEnd() {
                         int[] indices = new int[list.size()];
                         for (int i = 0; i < indices.length; ++i) {
                             indices[i] = list.get(i);
                         }
                         CtorDelVisitor.this.indices = indices;
                     }
                 };
             } else {
                 return super.visitArray(name); // Not interested
             }
         }
     }
I guess Svata's will be more efficient.

It's a bit frustrating that the AnnotationNode forces us to visit each
array element in turn when all we need is the complete list, but I think
there's no way around that. Visitor pattern makes my head spin, it always
seems inside-out to me.

Pete


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to