Permalink
Browse files

* Modified key used by RawConstructor to allow for 'mix-in' (instead …

…of constructor name use <init>).

* Updated test cases for key change...now have 100% coverage.
  • Loading branch information...
1 parent adaee3b commit ede6a6f2ab64f3a1c4eedfa0257b66d7b5b47fff @blangel blangel committed Apr 26, 2012
@@ -24,7 +24,7 @@ public RawConstructor(ResolvedType context, Constructor<?> constructor)
*/
public MethodKey createKey()
{
- String name = _constructor.getName();
+ String name = "<init>"; // do not use _constructor.getName() to allow for 'mix-ins'
Class<?>[] argTypes = _constructor.getParameterTypes(); // return of Constructor#getParameterTypes will never be null
return new MethodKey(name, argTypes);
}
@@ -144,18 +144,13 @@ public void resolveConstructors() {
ResolvedConstructor resolvedConstructor = resolvedConstructors[0];
assertNull(resolvedConstructor.get(Marker.class));
- // TODO - there's no way of making a mix-in constructor unless the key used for constructor is changed
- // TODO - to disregard the name as constructor's are not overridden
-
-// members = new ResolvedTypeWithMembers(typeResolver,
-// new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.INCLUDE_AND_INHERIT), mixinCandidateHierarchicType,
-// new HierarchicType[] { mixinAHierarchicType, mixinCandidateHierarchicType }, null, null, null);
-// resolvedConstructors = members.resolveConstructors();
-// assertEquals(1, resolvedConstructors.length);
-// resolvedConstructor = resolvedConstructors[0];
-// annotations = (Annotations) annotationsField.get(resolvedConstructor);
-// assertEquals(1, annotations.size());
-// assertNotNull(annotations.get(Marker.class));
+ members = new ResolvedTypeWithMembers(typeResolver,
+ new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.INCLUDE_AND_INHERIT), mixinCandidateHierarchicType,
+ new HierarchicType[] { mixinAHierarchicType, mixinCandidateHierarchicType }, null, null, null);
+ resolvedConstructors = members.resolveConstructors();
+ assertEquals(1, resolvedConstructors.length);
+ resolvedConstructor = resolvedConstructors[0];
+ assertNotNull(resolvedConstructor.get(Marker.class));
}
@Test
@@ -42,7 +42,7 @@ public void someMethod() { }
public void someMethod() { }
}
- @Test
+ @Test @SuppressWarnings("serial")
public void resolvingClasses() {
TypeResolver typeResolver = new TypeResolver();
ResolvedType listType = typeResolver.resolve(List.class);
@@ -39,6 +39,7 @@ public void createKey() {
RawConstructor rawConstructor = new RawConstructor(new ResolvedObjectType(Object.class, null, null, ResolvedType.NO_TYPES), stringConstructor);
MethodKey methodKey = rawConstructor.createKey();
assertNotNull(methodKey);
+ assertEquals("<init>()", methodKey.toString());
}
@Test

0 comments on commit ede6a6f

Please sign in to comment.