1
1
/*
2
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
3
*
4
- * Copyright (c) 2013-2015 Oracle and/or its affiliates. All rights reserved.
4
+ * Copyright (c) 2013-2016 Oracle and/or its affiliates. All rights reserved.
5
5
*
6
6
* The contents of this file are subject to the terms of either the GNU
7
7
* General Public License Version 2 only ("GPL") or the Common Development
82
82
import javax .enterprise .inject .spi .InjectionTarget ;
83
83
import javax .enterprise .inject .spi .ProcessAnnotatedType ;
84
84
import javax .enterprise .inject .spi .ProcessInjectionTarget ;
85
- import javax .enterprise .inject .spi .WithAnnotations ;
86
85
import javax .enterprise .util .AnnotationLiteral ;
87
86
import javax .inject .Qualifier ;
88
- import javax .ws .rs .ApplicationPath ;
89
- import javax .ws .rs .BeanParam ;
90
- import javax .ws .rs .FormParam ;
91
- import javax .ws .rs .HeaderParam ;
92
- import javax .ws .rs .MatrixParam ;
93
- import javax .ws .rs .PathParam ;
94
- import javax .ws .rs .QueryParam ;
95
87
import javax .ws .rs .core .Application ;
96
88
import javax .ws .rs .core .Context ;
97
89
@@ -656,7 +648,7 @@ private void processInjectionTarget(@Observes final ProcessInjectionTarget event
656
648
657
649
Hk2InjectedCdiTarget target = null ;
658
650
if (isJerseyOrDependencyType (componentClass )) {
659
- target = new Hk2InjectedCdiTarget (componentClass , it ) {
651
+ target = new Hk2InjectedCdiTarget (it ) {
660
652
661
653
@ Override
662
654
public Set <InjectionPoint > getInjectionPoints () {
@@ -667,7 +659,7 @@ public Set<InjectionPoint> getInjectionPoints() {
667
659
};
668
660
} else if (isJaxRsComponentType (componentClass )
669
661
|| jaxrsInjectableTypes .contains (event .getAnnotatedType ().getBaseType ())) {
670
- target = new Hk2InjectedCdiTarget (componentClass , it ) {
662
+ target = new Hk2InjectedCdiTarget (it ) {
671
663
672
664
@ Override
673
665
public Set <InjectionPoint > getInjectionPoints () {
@@ -880,18 +872,11 @@ private StringBuilder listElements(final StringBuilder logMsgBuilder, final Coll
880
872
@ SuppressWarnings ("unchecked" )
881
873
private abstract class Hk2InjectedCdiTarget implements Hk2InjectedTarget {
882
874
883
- private final Class <?> componentClass ;
884
875
private final InjectionTarget delegate ;
885
- private final ClassLoader targetClassLoader ;
886
-
887
876
private volatile ServiceLocator effectiveLocator ;
888
- private volatile boolean multipleLocators = false ;
889
877
890
- public Hk2InjectedCdiTarget (final Class <?> componentClass ,
891
- final InjectionTarget delegate ) {
892
- this .componentClass = componentClass ;
878
+ public Hk2InjectedCdiTarget (InjectionTarget delegate ) {
893
879
this .delegate = delegate ;
894
- this .targetClassLoader = componentClass .getClassLoader ();
895
880
}
896
881
897
882
@ Override
@@ -901,8 +886,10 @@ public Hk2InjectedCdiTarget(final Class<?> componentClass,
901
886
public void inject (final Object t , final CreationalContext cc ) {
902
887
delegate .inject (t , cc );
903
888
904
- final ServiceLocator il = multipleLocators ? getEffectiveLocator () : effectiveLocator ;
905
- final ServiceLocator injectingLocator = (il != null ) ? il : getEffectiveLocator ();
889
+ ServiceLocator injectingLocator = getEffectiveLocator ();
890
+ if (injectingLocator == null ) {
891
+ injectingLocator = effectiveLocator ;
892
+ }
906
893
907
894
if (injectingLocator != null ) {
908
895
injectingLocator .inject (t , CdiComponentProvider .CDI_CLASS_ANALYZER );
@@ -931,9 +918,6 @@ public void dispose(final Object t) {
931
918
932
919
@ Override
933
920
public void setLocator (final ServiceLocator effectiveLocator ) {
934
- if (this .effectiveLocator != null ) {
935
- this .multipleLocators = true ;
936
- }
937
921
this .effectiveLocator = effectiveLocator ;
938
922
}
939
923
}
0 commit comments