@@ -353,7 +353,7 @@ void registerProvidersFromAnnotations(CombinedIndexBuildItem indexBuildItem,
353
353
354
354
}
355
355
356
- addGeneratedProviders (index , constructor , annotationsByClassName , generatedProviders );
356
+ addGeneratedProviders (index , classCreator , constructor , annotationsByClassName , generatedProviders );
357
357
358
358
constructor .returnValue (null );
359
359
}
@@ -779,11 +779,13 @@ private Map<String, GeneratedClassResult> populateClientProviderFromAnnotations(
779
779
return result ;
780
780
}
781
781
782
- private void addGeneratedProviders (IndexView index , MethodCreator constructor ,
782
+ private void addGeneratedProviders (IndexView index , ClassCreator classCreator , MethodCreator constructor ,
783
783
Map <String , List <AnnotationInstance >> annotationsByClassName ,
784
784
Map <String , List <GeneratedClassResult >> generatedProviders ) {
785
+ int i = 1 ;
785
786
for (Map .Entry <String , List <AnnotationInstance >> annotationsForClass : annotationsByClassName .entrySet ()) {
786
- ResultHandle map = constructor .newInstance (MethodDescriptor .ofConstructor (HashMap .class ));
787
+ MethodCreator mc = classCreator .getMethodCreator ("addGeneratedProviders" + i , void .class );
788
+ ResultHandle map = mc .newInstance (MethodDescriptor .ofConstructor (HashMap .class ));
787
789
for (AnnotationInstance value : annotationsForClass .getValue ()) {
788
790
String className = value .value ().asString ();
789
791
AnnotationValue priorityAnnotationValue = value .value ("priority" );
@@ -794,21 +796,26 @@ private void addGeneratedProviders(IndexView index, MethodCreator constructor,
794
796
priority = priorityAnnotationValue .asInt ();
795
797
}
796
798
797
- constructor .invokeInterfaceMethod (MAP_PUT , map , constructor .loadClassFromTCCL (className ),
798
- constructor .load (priority ));
799
+ mc .invokeInterfaceMethod (MAP_PUT , map , mc .loadClassFromTCCL (className ),
800
+ mc .load (priority ));
799
801
}
800
802
String ifaceName = annotationsForClass .getKey ();
801
803
if (generatedProviders .containsKey (ifaceName )) {
802
804
// remove the interface from the generated provider since it's going to be handled now
803
805
// the remaining entries will be handled later
804
806
List <GeneratedClassResult > providers = generatedProviders .remove (ifaceName );
805
807
for (GeneratedClassResult classResult : providers ) {
806
- constructor .invokeInterfaceMethod (MAP_PUT , map , constructor .loadClass (classResult .generatedClassName ),
807
- constructor .load (classResult .priority ));
808
+ mc .invokeInterfaceMethod (MAP_PUT , map , mc .loadClass (classResult .generatedClassName ),
809
+ mc .load (classResult .priority ));
808
810
}
809
811
810
812
}
811
- addProviders (constructor , ifaceName , map );
813
+ addProviders (mc , ifaceName , map );
814
+ mc .returnVoid ();
815
+
816
+ constructor .invokeVirtualMethod (mc .getMethodDescriptor (), constructor .getThis ());
817
+
818
+ i ++;
812
819
}
813
820
814
821
for (Map .Entry <String , List <GeneratedClassResult >> entry : generatedProviders .entrySet ()) {
@@ -822,11 +829,11 @@ private void addGeneratedProviders(IndexView index, MethodCreator constructor,
822
829
}
823
830
}
824
831
825
- private void addProviders (MethodCreator constructor , String providerClass , ResultHandle map ) {
826
- constructor .invokeVirtualMethod (
832
+ private void addProviders (MethodCreator mc , String providerClass , ResultHandle map ) {
833
+ mc .invokeVirtualMethod (
827
834
MethodDescriptor .ofMethod (AnnotationRegisteredProviders .class , "addProviders" , void .class , String .class ,
828
835
Map .class ),
829
- constructor .getThis (), constructor .load (providerClass ), map );
836
+ mc .getThis (), mc .load (providerClass ), map );
830
837
}
831
838
832
839
private int getAnnotatedPriority (IndexView index , String className , int defaultPriority ) {
0 commit comments