Copilot commented on code in PR #2251: URL: https://github.com/apache/groovy/pull/2251#discussion_r2134427507
########## src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java: ########## @@ -304,6 +299,9 @@ protected boolean writeDirectMethodCall(final MethodNode target, final boolean i } ClassNode receiverType = receiver == null ? ClassHelper.OBJECT_TYPE : controller.getTypeChooser().resolveType(receiver, controller.getThisType()); + if (StaticTypeCheckingSupport.isClassClassNodeWrappingConcreteType(receiverType) && !ClassHelper.isClassType(declaringClass)) { + receiverType = receiverType.getGenericsTypes()[0].getType(); // GROOVY-11694 Review Comment: Consider adding a check to ensure that receiverType.getGenericsTypes() is not null and contains at least one element before accessing index 0 to prevent potential NullPointerExceptions. ```suggestion if (receiverType.getGenericsTypes() != null && receiverType.getGenericsTypes().length > 0) { receiverType = receiverType.getGenericsTypes()[0].getType(); // GROOVY-11694 } else { // Handle the case where generics types are null or empty receiverType = ClassHelper.OBJECT_TYPE; // Default to Object type } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@groovy.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org