langtools/src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java
author darcy
Wed, 17 Feb 2010 14:30:17 -0800
changeset 4937 2fc03fb01efa
parent 4936 abf1a22d9bcf
child 5520 86e4b9a9da40
permissions -rw-r--r--
6927061: Refactor apt implemenation to use code from JSR 269 Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * Copyright 2004-2005 Sun Microsystems, Inc.  All Rights Reserved.
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 * have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.mirror.util;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.mirror.declaration.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.util.SortedSet;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import java.util.TreeSet;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * A visitor for declarations that scans declarations contained within
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * the given declaration in source code order.  For example, when
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * visiting a class, the methods, fields, constructors, and nested
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * types of the class are also visited.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * To control the processing done on a declaration, users of this
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * class pass in their own visitors for pre and post processing.  The
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * preprocessing visitor is called before the contained declarations
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * are scanned; the postprocessing visitor is called after the
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * contained declarations are scanned.
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 *
3378
22011d9a9398 6381698: Warn of decommissioning of apt
darcy
parents: 10
diff changeset
    45
 * @deprecated All components of this API have been superseded by the
22011d9a9398 6381698: Warn of decommissioning of apt
darcy
parents: 10
diff changeset
    46
 * standardized annotation processing API.  The replacement for the
22011d9a9398 6381698: Warn of decommissioning of apt
darcy
parents: 10
diff changeset
    47
 * functionality of this class is {@link
22011d9a9398 6381698: Warn of decommissioning of apt
darcy
parents: 10
diff changeset
    48
 * javax.lang.model.util.SimpleElementVisitor6}.
22011d9a9398 6381698: Warn of decommissioning of apt
darcy
parents: 10
diff changeset
    49
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * @author Joseph D. Darcy
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * @author Scott Seligman
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 */
3378
22011d9a9398 6381698: Warn of decommissioning of apt
darcy
parents: 10
diff changeset
    54
@Deprecated
22011d9a9398 6381698: Warn of decommissioning of apt
darcy
parents: 10
diff changeset
    55
@SuppressWarnings("deprecation")
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
class SourceOrderDeclScanner extends DeclarationScanner {
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    static class SourceOrderComparator implements java.util.Comparator<Declaration> {
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
        SourceOrderComparator(){}
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        static boolean equals(Declaration d1, Declaration d2) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
            return d1 == d2 || (d1 != null && d1.equals(d2));
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        private static class DeclPartialOrder extends com.sun.mirror.util.SimpleDeclarationVisitor {
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
            private int value = 1000;
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
            private static int staticAdjust(Declaration d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
                return d.getModifiers().contains(Modifier.STATIC)?0:1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
            DeclPartialOrder() {}
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
            public int getValue() { return value; }
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
            public void visitTypeParameterDeclaration(TypeParameterDeclaration d) {value = 0;}
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
            public void visitEnumConstantDeclaration(EnumConstantDeclaration d) {value = 1;}
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
            public void visitClassDeclaration(ClassDeclaration d) {value = 2 + staticAdjust(d);}
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
            public void visitInterfaceDeclaration(InterfaceDeclaration d) {value = 4;}
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
            public void visitEnumDeclaration(EnumDeclaration d) {value = 6;}
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
            public void visitAnnotationTypeDeclaration(AnnotationTypeDeclaration d) {value = 8;}
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
            public void visitFieldDeclaration(FieldDeclaration d) {value = 10 + staticAdjust(d);}
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
            public void visitConstructorDeclaration(ConstructorDeclaration d) {value = 12;}
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
            @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
            public void visitMethodDeclaration(MethodDeclaration d) {value = 14 + staticAdjust(d);}
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        @SuppressWarnings("cast")
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        private int compareEqualPosition(Declaration d1, Declaration d2) {
4936
abf1a22d9bcf 6926703: apt tests should run with assertions enabled
darcy
parents: 3378
diff changeset
   104
            assert
4937
2fc03fb01efa 6927061: Refactor apt implemenation to use code from JSR 269
darcy
parents: 4936
diff changeset
   105
                (d1.getPosition() == d2.getPosition()) || // Handles two null positions.
4936
abf1a22d9bcf 6926703: apt tests should run with assertions enabled
darcy
parents: 3378
diff changeset
   106
                (d1.getPosition().file().compareTo(d2.getPosition().file()) == 0 &&
abf1a22d9bcf 6926703: apt tests should run with assertions enabled
darcy
parents: 3378
diff changeset
   107
                 d1.getPosition().line()   == d2.getPosition().line() &&
abf1a22d9bcf 6926703: apt tests should run with assertions enabled
darcy
parents: 3378
diff changeset
   108
                 d1.getPosition().column() == d2.getPosition().column());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
            DeclPartialOrder dpo1 = new DeclPartialOrder();
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
            DeclPartialOrder dpo2 = new DeclPartialOrder();
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
            d1.accept(dpo1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
            d2.accept(dpo2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
            int difference = dpo1.getValue() - dpo2.getValue();
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
            if (difference != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
                return difference;
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
            else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
                int result = d1.getSimpleName().compareTo(d2.getSimpleName());
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
                if (result != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
                    return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
                return (int)( Long.signum((long)System.identityHashCode(d1) -
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
                                          (long)System.identityHashCode(d2)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
        public int compare(Declaration d1, Declaration d2) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
            if (equals(d1, d2))
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
                return 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
            SourcePosition p1 = d1.getPosition();
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
            SourcePosition p2 = d2.getPosition();
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
            if (p1 == null && p2 != null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
                return 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
            else if (p1 != null && p2 == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
                return -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
            else if(p1 == null && p2 == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
                return compareEqualPosition(d1, d2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
            else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
                assert p1 != null && p2 != null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
                int fileComp = p1.file().compareTo(p2.file()) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
                if (fileComp == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
                    long diff = (long)p1.line() - (long)p2.line();
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
                    if (diff == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
                        diff = Long.signum((long)p1.column() - (long)p2.column());
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
                        if (diff != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
                            return (int)diff;
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
                        else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
                            // declarations may be two
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
                            // compiler-generated members with the
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
                            // same source position
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
                            return compareEqualPosition(d1, d2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
                    } else
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
                        return (diff<0)? -1:1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
                } else
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
                    return fileComp;
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    final static java.util.Comparator<Declaration> comparator = new SourceOrderComparator();
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    SourceOrderDeclScanner(DeclarationVisitor pre, DeclarationVisitor post) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
        super(pre, post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     * Visits a type declaration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * @param d the declaration to visit
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    public void visitTypeDeclaration(TypeDeclaration d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        d.accept(pre);
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
        SortedSet<Declaration> decls = new
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
            decls.add(tpDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
        for(FieldDeclaration fieldDecl: d.getFields()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
            decls.add(fieldDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
        for(MethodDeclaration methodDecl: d.getMethods()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
            decls.add(methodDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
        for(TypeDeclaration typeDecl: d.getNestedTypes()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
            decls.add(typeDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        for(Declaration decl: decls )
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
            decl.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
        d.accept(post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * Visits a class declaration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     * @param d the declaration to visit
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    public void visitClassDeclaration(ClassDeclaration d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
        d.accept(pre);
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
        SortedSet<Declaration> decls = new
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
            decls.add(tpDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
        for(FieldDeclaration fieldDecl: d.getFields()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
            decls.add(fieldDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        for(MethodDeclaration methodDecl: d.getMethods()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
            decls.add(methodDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
        for(TypeDeclaration typeDecl: d.getNestedTypes()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
            decls.add(typeDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
        for(ConstructorDeclaration ctorDecl: d.getConstructors()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
            decls.add(ctorDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
        for(Declaration decl: decls )
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
            decl.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
        d.accept(post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
    public void visitExecutableDeclaration(ExecutableDeclaration d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
        d.accept(pre);
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        SortedSet<Declaration> decls = new
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters())
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
            decls.add(tpDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
        for(ParameterDeclaration pDecl: d.getParameters())
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
            decls.add(pDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
        for(Declaration decl: decls )
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
            decl.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
        d.accept(post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
}