Skip to content

Commit

Permalink
compilation error & failed test :(
Browse files Browse the repository at this point in the history
  • Loading branch information
ibessonov committed Aug 15, 2018
1 parent 44ed803 commit 457c9d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void assertValueCanBeTransformed(Class<? extends Annotation> clazz, Class

@SuppressWarnings("unchecked")
public <T extends Annotation> ValueTransformer<T> getValueTransformer(Class<T> clazz) {
List<? extends ValueTransformer<T>> list = (List<? extends ValueTransformer<T>>) valueTransformers.get(clazz);
List<? extends ValueTransformer<T>> list = (List) valueTransformers.get(clazz);
if (list == null) return null;
if (list.size() == 1) {
return list.get(0);
Expand All @@ -145,7 +145,7 @@ public boolean methodTransformerRegistered(Class<?> clazz) {

@SuppressWarnings("unchecked")
public <T extends Annotation> MethodTransformer<T> getMethodTransformer(Class<T> clazz) {
List<? extends MethodTransformer<T>> list = (List<? extends MethodTransformer<T>>) methodTransformers.get(clazz);
List<? extends MethodTransformer<T>> list = (List) methodTransformers.get(clazz);
if (list == null) return null;
if (list.size() == 1) {
return list.get(0);
Expand Down
14 changes: 3 additions & 11 deletions src/test/java/com/github/ibessonov/cdi/ContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,9 @@ public static class TestExtension implements Extension {

@Override
public void register(Registrar registrar) {
registrar.registerValueTransformer(NotNull.class, new ValueTransformer<NotNull>() {
@Override
public Object transform(NotNull annotation, Class<?> clazz, Object object) {
return Objects.requireNonNull(object, annotation.value());
}

@Override
public boolean isApplicable(Class<?> clazz) {
return !clazz.isPrimitive();
}
});
registrar.registerValueTransformer(NotNull.class, (annotation, clazz, object) ->
Objects.requireNonNull(object, annotation.value())
);
registrar.registerValueTransformer(Trimmed.class, new ValueTransformer<Trimmed>() {
@Override
public Object transform(Trimmed annotation, Class<?> clazz, Object object) {
Expand Down

0 comments on commit 457c9d2

Please sign in to comment.