You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class TestClass {
public class GenericClass<T> {
private T field;
public T getField() { return this.field; }
public void setField(T field) { this.field = field; }
}
public class NonGenericClass extends GenericClass<String> { }
public static void main(String[] args) {
new JFixture().create(NonGenericClass.class);
}
}
This example throws NPE because it can't figure out the actual type for T when attempting to fixture field
Exception in thread "main" java.lang.NullPointerException
at com.flextrade.jfixture.utility.SpecimenType.<init>(SpecimenType.java:37)
at com.flextrade.jfixture.utility.SpecimenType.<init>(SpecimenType.java:12)
at com.flextrade.jfixture.utility.SpecimenType$3.<init>(SpecimenType.java:55)
at com.flextrade.jfixture.utility.SpecimenType.withGenericContext(SpecimenType.java:55)
at com.flextrade.jfixture.utility.ParameterUtils.convertPossibleGenericTypeToSpecimenType(ParameterUtils.java:50)
at com.flextrade.jfixture.builders.GenericMethodBuilder.getMethodReturnType(GenericMethodBuilder.java:36)
at com.flextrade.jfixture.builders.GenericMethodBuilder.create(GenericMethodBuilder.java:27)
at com.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)
at com.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)
at com.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)
at com.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)
at com.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)
at com.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)
at com.flextrade.jfixture.behaviours.autoproperty.AutoPropertyPopulater.populateSetters(AutoPropertyPopulater.java:34)
at com.flextrade.jfixture.behaviours.autoproperty.AutoPropertyPopulater.execute(AutoPropertyPopulater.java:23)
at com.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:25)
at com.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)
at com.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)
at com.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)
at com.flextrade.jfixture.JFixture.create(JFixture.java:82)
at com.flextrade.jfixture.JFixture.create(JFixture.java:78)
The text was updated successfully, but these errors were encountered:
Note there are more complex scenarios that aren't covered by this fix - for example if multiple generic types in an inheritance hierarchy use the same Type variable then it this won't work
* Add support for inheritance with generic types - fixes issue #36
* get travis CI builds to work again
Note there are more complex scenarios that aren't covered by this fix - for example if multiple generic types in an inheritance hierarchy use the same Type variable then it this won't work
…eUKLtd#36 (FlexTradeUKLtd#37)
* Add support for inheritance with generic types - fixes issue FlexTradeUKLtd#36
* get travis CI builds to work again
Note there are more complex scenarios that aren't covered by this fix - for example if multiple generic types in an inheritance hierarchy use the same Type variable then it this won't work
This example throws NPE because it can't figure out the actual type for
T
when attempting to fixturefield
The text was updated successfully, but these errors were encountered: