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) {
        public AnnotationVisitor visitArray(String name) {
            if ("delegateParams".equals(name)) {  // NOI18N
                return new AnnotationVisitor(api) {
                    List<Integer> list = new ArrayList<>();
                    public void visit(String name, Object value) {
                        list.add((Integer) value);
                    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.


Reply via email to