@@ -31,6 +31,18 @@ public final class MethodOutline {
3131 this .annotations = annotations ;
3232 }
3333
34+ // ----------------------------------------------------------------------------------------------
35+ // The rest of this class is used to implement advanced matching, while keeping outlines minimal
36+ // ----------------------------------------------------------------------------------------------
37+
38+ private static final int [] NO_BOUNDARIES = {};
39+
40+ /** Lazy cache of boundaries between each parameter/return descriptor. */
41+ private int [] descriptorBoundaries ;
42+
43+ /** Lazy cache of hashes for each parameter/return type-string. */
44+ private int [] typeStringHashes ;
45+
3446 /**
3547 * @return number of method parameters
3648 */
@@ -77,10 +89,18 @@ TypeString returnTypeString() {
7789 return new TypeString (descriptor , start , end , getHash (returnIndex , start , end ));
7890 }
7991
80- private static final int [] NO_BOUNDARIES = {};
81-
82- /** Lazy cache of boundaries between each parameter/return descriptor. */
83- private int [] descriptorBoundaries ;
92+ /** Gets a previously cached {@link TypeString} hash; otherwise computes and caches a new hash. */
93+ private int getHash (int typeStringIndex , int start , int end ) {
94+ if (typeStringHashes == null ) {
95+ // allow for one hash per parameter, plus one for return type
96+ typeStringHashes = new int [descriptorBoundaries .length + 1 ];
97+ }
98+ int hash = typeStringHashes [typeStringIndex ];
99+ if (hash == 0 ) {
100+ typeStringHashes [typeStringIndex ] = hash = TypeString .computeHash (descriptor , start , end );
101+ }
102+ return hash ;
103+ }
84104
85105 /**
86106 * Returns the boundaries between each parameter/return descriptor in the method descriptor.
@@ -138,20 +158,4 @@ private static int[] parseBoundaries(String descriptor) {
138158 }
139159 return boundaries ;
140160 }
141-
142- /** Lazy cache of hashes for each parameter/return type-string. */
143- private int [] typeStringHashes ;
144-
145- /** Gets a previously cached {@link TypeString} hash; otherwise computes and caches a new hash. */
146- private int getHash (int typeStringIndex , int start , int end ) {
147- if (typeStringHashes == null ) {
148- // allow for one hash per parameter, plus one for return type
149- typeStringHashes = new int [descriptorBoundaries .length + 1 ];
150- }
151- int hash = typeStringHashes [typeStringIndex ];
152- if (hash == 0 ) {
153- typeStringHashes [typeStringIndex ] = hash = TypeString .computeHash (descriptor , start , end );
154- }
155- return hash ;
156- }
157161}
0 commit comments