From e0e1330c6e01a878d365bff112f1c6505c7e6ebd Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 26 Aug 2010 15:20:03 +0000 Subject: [PATCH] 320468 --- .../weaver/patterns/ModifiersPattern.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ModifiersPattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ModifiersPattern.java index a8d2680e3..d63fc8ecf 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ModifiersPattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ModifiersPattern.java @@ -26,6 +26,18 @@ public class ModifiersPattern extends PatternNode { public static final ModifiersPattern ANY = new ModifiersPattern(0, 0); + private static Map modifierFlags = null; + + static { + modifierFlags = new HashMap(); + int flag = 1; + while (flag <= Modifier.STRICT) { + String flagName = Modifier.toString(flag); + modifierFlags.put(flagName, new Integer(flag)); + flag = flag << 1; + } + } + public ModifiersPattern(int requiredModifiers, int forbiddenModifiers) { this.requiredModifiers = requiredModifiers; this.forbiddenModifiers = forbiddenModifiers; @@ -78,19 +90,8 @@ public class ModifiersPattern extends PatternNode { s.writeShort(forbiddenModifiers); } - private static Map modifierFlags = null; - public static int getModifierFlag(String name) { - if (modifierFlags == null) { - modifierFlags = new HashMap(); - int flag = 1; - while (flag <= Modifier.STRICT) { - String flagName = Modifier.toString(flag); - modifierFlags.put(flagName, new Integer(flag)); - flag = flag << 1; - } - } - Integer flag = (Integer) modifierFlags.get(name); + Integer flag = modifierFlags.get(name); if (flag == null) { return -1; } -- 2.39.5