performance improvement - eliminate multiple instance creation for

context HashMap.
Still at the top of the performance list of Checkstyle non-parsing methods.
This commit is contained in:
Rick Giles 2002-12-25 13:07:08 +00:00
parent e0651ea2fb
commit 3badd996bf
1 changed files with 4 additions and 2 deletions

View File

@ -118,6 +118,8 @@ public final class TreeWalker
/** context of child components */
private Context mChildContext;
private Map mContext = new HashMap();
/**
* HACK - a reference to a private "mParent" field in DetailAST.
@ -439,10 +441,10 @@ public final class TreeWalker
(ArrayList) mTokenToChecks.get(
TokenTypes.getTokenName(aAST.getType()));
if (visitors != null) {
final Map ctx = new HashMap();
mContext.clear();
for (int i = 0; i < visitors.size(); i++) {
final Check check = (Check) visitors.get(i);
check.setTokenContext(ctx);
check.setTokenContext(mContext);
check.visitToken(aAST);
}
}