diff options
author | aclement <aclement> | 2010-07-14 21:02:17 +0000 |
---|---|---|
committer | aclement <aclement> | 2010-07-14 21:02:17 +0000 |
commit | 499ab8f9709d5c0e9f99b0247d0989e441dee4bc (patch) | |
tree | aaded73456d732dbd9229300cf6bb2513b1f5727 /org.aspectj.matcher | |
parent | 8b1628b65f7dc5931768859474bea963e404b4ed (diff) | |
download | aspectj-499ab8f9709d5c0e9f99b0247d0989e441dee4bc.tar.gz aspectj-499ab8f9709d5c0e9f99b0247d0989e441dee4bc.zip |
generics
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/AbstractAnnotationAJ.java | 2 | ||||
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java | 45 |
2 files changed, 25 insertions, 22 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/AbstractAnnotationAJ.java b/org.aspectj.matcher/src/org/aspectj/weaver/AbstractAnnotationAJ.java index 3f694873a..503d6b3b5 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/AbstractAnnotationAJ.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/AbstractAnnotationAJ.java @@ -138,7 +138,7 @@ public abstract class AbstractAnnotationAJ implements AnnotationAJ { /** * {@inheritDoc} */ - public abstract Set getTargets(); + public abstract Set<String> getTargets(); /** * {@inheritDoc} diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java b/org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java index 3dd7bfb82..58badb070 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java @@ -27,7 +27,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { private final boolean isRuntimeVisible; - private List /* of AnnotationNVPair */nvPairs = null; + private List<AnnotationNameValuePair> nvPairs = null; public StandardAnnotation(ResolvedType type, boolean isRuntimeVisible) { super(type); @@ -49,9 +49,8 @@ public class StandardAnnotation extends AbstractAnnotationAJ { sb.append("@").append(type.getClassName()); if (hasNameValuePairs()) { sb.append("("); - for (Iterator iter = nvPairs.iterator(); iter.hasNext();) { - AnnotationNameValuePair element = (AnnotationNameValuePair) iter.next(); - sb.append(element.stringify()); + for (AnnotationNameValuePair nvPair : nvPairs) { + sb.append(nvPair.stringify()); } sb.append(")"); } @@ -62,11 +61,12 @@ public class StandardAnnotation extends AbstractAnnotationAJ { StringBuffer sb = new StringBuffer(); sb.append("ANNOTATION [" + getTypeSignature() + "] [" + (isRuntimeVisible ? "runtimeVisible" : "runtimeInvisible") + "] ["); if (nvPairs != null) { - for (Iterator iter = nvPairs.iterator(); iter.hasNext();) { - AnnotationNameValuePair element = (AnnotationNameValuePair) iter.next(); + for (Iterator<AnnotationNameValuePair> iter = nvPairs.iterator(); iter.hasNext();) { + AnnotationNameValuePair element = iter.next(); sb.append(element.toString()); - if (iter.hasNext()) + if (iter.hasNext()) { sb.append(","); + } } } sb.append("]"); @@ -77,12 +77,14 @@ public class StandardAnnotation extends AbstractAnnotationAJ { * {@inheritDoc} */ public boolean hasNamedValue(String n) { - if (nvPairs == null) + if (nvPairs == null) { return false; + } for (int i = 0; i < nvPairs.size(); i++) { - AnnotationNameValuePair pair = (AnnotationNameValuePair) nvPairs.get(i); - if (pair.getName().equals(n)) + AnnotationNameValuePair pair = nvPairs.get(i); + if (pair.getName().equals(n)) { return true; + } } return false; } @@ -91,13 +93,15 @@ public class StandardAnnotation extends AbstractAnnotationAJ { * {@inheritDoc} */ public boolean hasNameValuePair(String n, String v) { - if (nvPairs == null) + if (nvPairs == null) { return false; + } for (int i = 0; i < nvPairs.size(); i++) { - AnnotationNameValuePair pair = (AnnotationNameValuePair) nvPairs.get(i); + AnnotationNameValuePair pair = nvPairs.get(i); if (pair.getName().equals(n)) { - if (pair.getValue().stringify().equals(v)) + if (pair.getValue().stringify().equals(v)) { return true; + } } } return false; @@ -106,14 +110,14 @@ public class StandardAnnotation extends AbstractAnnotationAJ { /** * {@inheritDoc} */ - public Set /* <String> */getTargets() { + public Set<String> getTargets() { if (!type.equals(UnresolvedType.AT_TARGET)) { - return Collections.EMPTY_SET; + return Collections.emptySet(); } - AnnotationNameValuePair nvp = (AnnotationNameValuePair) nvPairs.get(0); + AnnotationNameValuePair nvp = nvPairs.get(0); ArrayAnnotationValue aav = (ArrayAnnotationValue) nvp.getValue(); AnnotationValue[] avs = aav.getValues(); - Set targets = new HashSet(); + Set<String> targets = new HashSet<String>(); for (int i = 0; i < avs.length; i++) { AnnotationValue value = avs[i]; targets.add(value.stringify()); @@ -121,7 +125,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { return targets; } - public List getNameValuePairs() { + public List<AnnotationNameValuePair> getNameValuePairs() { return nvPairs; } @@ -131,7 +135,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { public void addNameValuePair(AnnotationNameValuePair pair) { if (nvPairs == null) { - nvPairs = new ArrayList(); + nvPairs = new ArrayList<AnnotationNameValuePair>(); } nvPairs.add(pair); } @@ -141,8 +145,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { */ public String getStringFormOfValue(String name) { if (hasNameValuePairs()) { - for (Iterator iterator = nvPairs.iterator(); iterator.hasNext();) { - AnnotationNameValuePair nvPair = (AnnotationNameValuePair) iterator.next(); + for (AnnotationNameValuePair nvPair : nvPairs) { if (nvPair.getName().equals(name)) { return nvPair.getValue().stringify(); } |