langtools/src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java
author darcy
Sun, 26 Jul 2009 21:27:11 -0700
changeset 3378 22011d9a9398
parent 10 06bc494ca11e
child 4936 abf1a22d9bcf
permissions -rw-r--r--
6381698: Warn of decommissioning of apt 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) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
            assert d1.getPosition() == d2.getPosition();
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
            DeclPartialOrder dpo1 = new DeclPartialOrder();
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
            DeclPartialOrder dpo2 = new DeclPartialOrder();
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
            d1.accept(dpo1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
            d2.accept(dpo2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
            int difference = dpo1.getValue() - dpo2.getValue();
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
            if (difference != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
                return difference;
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
            else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
                int result = d1.getSimpleName().compareTo(d2.getSimpleName());
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
                if (result != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
                    return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
                return (int)( Long.signum((long)System.identityHashCode(d1) -
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
                                          (long)System.identityHashCode(d2)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        public int compare(Declaration d1, Declaration d2) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
            if (equals(d1, d2))
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
                return 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
            SourcePosition p1 = d1.getPosition();
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
            SourcePosition p2 = d2.getPosition();
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
            if (p1 == null && p2 != null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
                return 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
            else if (p1 != null && p2 == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
                return -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
            else if(p1 == null && p2 == null)
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
                return compareEqualPosition(d1, d2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
            else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
                assert p1 != null && p2 != null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
                int fileComp = p1.file().compareTo(p2.file()) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
                if (fileComp == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
                    long diff = (long)p1.line() - (long)p2.line();
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
                    if (diff == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
                        diff = Long.signum((long)p1.column() - (long)p2.column());
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
                        if (diff != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
                            return (int)diff;
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
                        else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
                            // declarations may be two
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
                            // compiler-generated members with the
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
                            // same source position
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
                            return compareEqualPosition(d1, d2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
                    } else
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
                        return (diff<0)? -1:1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
                } else
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
                    return fileComp;
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
    final static java.util.Comparator<Declaration> comparator = new SourceOrderComparator();
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    SourceOrderDeclScanner(DeclarationVisitor pre, DeclarationVisitor post) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
        super(pre, post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * Visits a type declaration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     * @param d the declaration to visit
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    public void visitTypeDeclaration(TypeDeclaration d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
        d.accept(pre);
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        SortedSet<Declaration> decls = new
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
            decls.add(tpDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
        for(FieldDeclaration fieldDecl: d.getFields()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
            decls.add(fieldDecl);
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(MethodDeclaration methodDecl: d.getMethods()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
            decls.add(methodDecl);
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(TypeDeclaration typeDecl: d.getNestedTypes()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
            decls.add(typeDecl);
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(Declaration decl: decls )
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
            decl.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        d.accept(post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * Visits a class declaration.
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * @param d the declaration to visit
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    public void visitClassDeclaration(ClassDeclaration d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
        d.accept(pre);
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        SortedSet<Declaration> decls = new
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
            decls.add(tpDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
        for(FieldDeclaration fieldDecl: d.getFields()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
            decls.add(fieldDecl);
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(MethodDeclaration methodDecl: d.getMethods()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
            decls.add(methodDecl);
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(TypeDeclaration typeDecl: d.getNestedTypes()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
            decls.add(typeDecl);
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(ConstructorDeclaration ctorDecl: d.getConstructors()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
            decls.add(ctorDecl);
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(Declaration decl: decls )
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
            decl.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        d.accept(post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
    public void visitExecutableDeclaration(ExecutableDeclaration d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
        d.accept(pre);
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        SortedSet<Declaration> decls = new
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
            TreeSet<Declaration>(SourceOrderDeclScanner.comparator) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
        for(TypeParameterDeclaration tpDecl: d.getFormalTypeParameters())
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
            decls.add(tpDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
        for(ParameterDeclaration pDecl: d.getParameters())
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
            decls.add(pDecl);
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
        for(Declaration decl: decls )
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
            decl.accept(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
        d.accept(post);
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
}