You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/01/04 13:30:50 UTC

[tomee] 01/12: some lambda improvements

This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 89a84e4abbc09b0ffed875301530331d97103cca
Author: ivanjunckes <ij...@tomitribe.com>
AuthorDate: Wed Jan 2 16:50:50 2019 -0200

    some lambda improvements
---
 .../apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java  | 11 ++---------
 .../microprofile/jwt/principal/JWTCallerPrincipalFactory.java |  9 +++------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java
index 00fc24e..2f7cf43 100644
--- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java
+++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java
@@ -24,9 +24,7 @@ import org.apache.tomee.microprofile.jwt.jaxrs.MPJWPProviderRegistration;
 import org.eclipse.microprofile.jwt.Claim;
 import org.eclipse.microprofile.jwt.JsonWebToken;
 
-import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.Dependent;
-import javax.enterprise.context.RequestScoped;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Any;
@@ -67,7 +65,7 @@ public class MPJWTCDIExtension implements Extension {
 
     private Set<InjectionPoint> injectionPoints = new HashSet<>();
 
-    public void collectConfigProducer(@Observes final ProcessInjectionPoint<?, ?> pip, final BeanManager bm) {
+    public void collectConfigProducer(@Observes final ProcessInjectionPoint<?, ?> pip) {
         final Claim claim = pip.getInjectionPoint().getAnnotated().getAnnotation(Claim.class);
         if (claim != null) {
             injectionPoints.add(pip.getInjectionPoint());
@@ -97,12 +95,7 @@ public class MPJWTCDIExtension implements Extension {
 
         types.stream()
                 .map(type -> new ClaimBean<>(bm, type))
-                .forEach(new Consumer<ClaimBean>() {
-                    @Override
-                    public void accept(final ClaimBean claimBean) {
-                        abd.addBean(claimBean);
-                    }
-                });
+                .forEach((Consumer<ClaimBean>) claimBean -> abd.addBean(claimBean));
 
         abd.addBean()
                 .id(MPJWTCDIExtension.class.getName() + "#" + JsonWebToken.class.getName())
diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java
index e7ebcd6..6ce6f8e 100644
--- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java
+++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/principal/JWTCallerPrincipalFactory.java
@@ -44,12 +44,9 @@ public abstract class JWTCallerPrincipalFactory {
                     return instance;
                 }
 
-                ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
-                    @Override
-                    public ClassLoader run() {
-                        return Thread.currentThread().getContextClassLoader();
-                    }
-                });
+                ClassLoader cl = AccessController.doPrivileged(
+                        (PrivilegedAction<ClassLoader>) () -> Thread.currentThread().getContextClassLoader()
+                );
                 if (cl == null) {
                     cl = JWTCallerPrincipalFactory.class.getClassLoader();
                 }