From 457c9d2b61ebe29a5139799b19a0f3c550a09bf0 Mon Sep 17 00:00:00 2001 From: ibessonov Date: Wed, 15 Aug 2018 10:17:02 +0300 Subject: [PATCH] compilation error & failed test :( --- .../github/ibessonov/cdi/runtime/ContextImpl.java | 4 ++-- .../java/com/github/ibessonov/cdi/ContextTest.java | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/github/ibessonov/cdi/runtime/ContextImpl.java b/src/main/java/com/github/ibessonov/cdi/runtime/ContextImpl.java index 8f1a7a9..cc9d349 100644 --- a/src/main/java/com/github/ibessonov/cdi/runtime/ContextImpl.java +++ b/src/main/java/com/github/ibessonov/cdi/runtime/ContextImpl.java @@ -125,7 +125,7 @@ public void assertValueCanBeTransformed(Class clazz, Class @SuppressWarnings("unchecked") public ValueTransformer getValueTransformer(Class clazz) { - List> list = (List>) valueTransformers.get(clazz); + List> list = (List) valueTransformers.get(clazz); if (list == null) return null; if (list.size() == 1) { return list.get(0); @@ -145,7 +145,7 @@ public boolean methodTransformerRegistered(Class clazz) { @SuppressWarnings("unchecked") public MethodTransformer getMethodTransformer(Class clazz) { - List> list = (List>) methodTransformers.get(clazz); + List> list = (List) methodTransformers.get(clazz); if (list == null) return null; if (list.size() == 1) { return list.get(0); diff --git a/src/test/java/com/github/ibessonov/cdi/ContextTest.java b/src/test/java/com/github/ibessonov/cdi/ContextTest.java index bc33259..60f07f6 100644 --- a/src/test/java/com/github/ibessonov/cdi/ContextTest.java +++ b/src/test/java/com/github/ibessonov/cdi/ContextTest.java @@ -62,17 +62,9 @@ public static class TestExtension implements Extension { @Override public void register(Registrar registrar) { - registrar.registerValueTransformer(NotNull.class, new ValueTransformer() { - @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() { @Override public Object transform(Trimmed annotation, Class clazz, Object object) {