summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2017-10-23 14:39:20 -0700
committerAndy Clement <aclement@pivotal.io>2017-10-23 14:39:20 -0700
commitc3142b62c00a162fdba5d29ab5176b510065d586 (patch)
treecf9612255474efc86f0b196cd8792592f3d70bcf /org.aspectj.matcher
parent98602bc67ccc288070530970f4474c0fb86ceee3 (diff)
downloadaspectj-c3142b62c00a162fdba5d29ab5176b510065d586.tar.gz
aspectj-c3142b62c00a162fdba5d29ab5176b510065d586.zip
Fix 525972 - java.lang.ArrayIndexOutOfBoundsException: 2 (at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:970))
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
index 5985e4b6d..daccec105 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
@@ -966,12 +966,38 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
}
TypeVariable[] tvs = getGenericType().getTypeVariables();
Map<String, UnresolvedType> parameterizationMap = new HashMap<String, UnresolvedType>();
- for (int i = 0; i < tvs.length; i++) {
- parameterizationMap.put(tvs[i].getName(), typeParameters[i]);
+ if (tvs.length != typeParameters.length) {
+ world.getMessageHandler()
+ .handleMessage(
+ new Message("Mismatch when building parameterization map. For type '" + this.signature +
+ "' expecting "+tvs.length+":["+toString(tvs)+"] type parameters but found "+typeParameters.length+
+ ":["+toString(typeParameters)+"]", "",
+ IMessage.ERROR, getSourceLocation(), null,
+ new ISourceLocation[] { getSourceLocation() }));
+ } else {
+ for (int i = 0; i < tvs.length; i++) {
+ parameterizationMap.put(tvs[i].getName(), typeParameters[i]);
+ }
}
return parameterizationMap;
}
+ private String toString(UnresolvedType[] typeParameters) {
+ StringBuilder s = new StringBuilder();
+ for (UnresolvedType tv: typeParameters) {
+ s.append(tv.getSignature()).append(" ");
+ }
+ return s.toString().trim();
+ }
+
+ private String toString(TypeVariable[] tvs) {
+ StringBuilder s = new StringBuilder();
+ for (TypeVariable tv: tvs) {
+ s.append(tv.getName()).append(" ");
+ }
+ return s.toString().trim();
+ }
+
public List<ShadowMunger> getDeclaredAdvice() {
List<ShadowMunger> l = new ArrayList<ShadowMunger>();
ResolvedMember[] methods = getDeclaredMethods();