@@ -49,7 +49,7 @@ public TreeVisitor<?, ExecutionContext> getVisitor() {
4949 public J .MethodInvocation visitMethodInvocation (J .MethodInvocation method , ExecutionContext ctx ) {
5050 J .MethodInvocation mi = super .visitMethodInvocation (method , ctx );
5151 List <Expression > arguments = mi .getArguments ();
52- if (fireEventMatcher .matches (method )) {
52+ if (fireEventMatcher .matches (method ) && mi . getSelect () != null ) {
5353 if (arguments .size () <= 1 ) {
5454 return JavaTemplate .builder ("#{any(jakarta.enterprise.inject.spi.BeanManager)}.getEvent()" +
5555 ".fire(#{any(jakarta.enterprise.inject.spi.BeforeBeanDiscovery)})" )
@@ -58,7 +58,7 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
5858 .apply (updateCursor (mi ), mi .getCoordinates ().replace (), mi .getSelect (), arguments .get (0 ));
5959 }
6060
61- J [] args = new J [arguments .size () + 1 ];
61+ Object [] args = new Expression [arguments .size () + 1 ];
6262 args [0 ] = mi .getSelect ();
6363 for (int i = 1 ; i < arguments .size (); i ++) {
6464 args [i ] = arguments .get (i );
@@ -72,14 +72,11 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
7272 .javaParser (JavaParser .fromJavaVersion ().classpathFromResources (ctx , "jakarta.enterprise.cdi-api-3.0.0-M4" ))
7373 .build ()
7474 .apply (updateCursor (mi ), mi .getCoordinates ().replace (), args );
75- } else if (createInjectionTargetMatcher .matches (method )) {
75+ } else if (createInjectionTargetMatcher .matches (method ) && mi . getSelect () != null ) {
7676 return JavaTemplate .builder ("#{any(jakarta.enterprise.inject.spi.BeanManager)}.getInjectionTargetFactory(#{any(jakarta.enterprise.inject.spi.AnnotatedType)}).createInjectionTarget(null)" )
7777 .javaParser (JavaParser .fromJavaVersion ().classpathFromResources (ctx , "jakarta.enterprise.cdi-api-3.0.0-M4" ))
7878 .build ()
79- .apply (updateCursor (mi ),
80- mi .getCoordinates ().replace (),
81- mi .getSelect (),
82- arguments .get (0 ));
79+ .apply (updateCursor (mi ), mi .getCoordinates ().replace (), mi .getSelect (), arguments .get (0 ));
8380 }
8481 return mi ;
8582 }
0 commit comments