Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2690

Replace usages of getParameterTypes().length with getParameterCount()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 5.0.0.Alpha1
    • None
    • None
    • None

      getParameterTypes().length is inefficient because it creates an array clone, while getParameterCount() directly returns the length

      Targets
          Occurrences of 'getParameterTypes().length' in Directory
      Found Occurrences in Directory (27 usages found)
          Unclassified  (27 usages found)
              weld-core-impl  (26 usages found)
                  org.jboss.weld.annotated.enhanced.jlr  (2 usages found)
                      MethodSignatureImpl.java  (2 usages found)
                          MethodSignatureImpl(Method)  (2 usages found)
                              52 this.parameterTypes = new String[method.getParameterTypes().length];
                              53 for (int i = 0; i < method.getParameterTypes().length; i++) {
                  org.jboss.weld.annotated.slim.backed  (1 usage found)
                      BackedAnnotatedConstructor.java  (1 usage found)
                          initParameters(Constructor<X>, SharedObjectCache)  (1 usage found)
                              34 int length = member.getParameterTypes().length;
                  org.jboss.weld.bean  (2 usages found)
                      DecoratedMethods.java  (2 usages found)
                          matches(InvokableAnnotatedMethod<?>, Method)  (2 usages found)
                              104 if (candidate.getParameterTypes().length != decoratedMethod.getParameters().size()) {
                              110 for (int i = 0; i < candidate.getParameterTypes().length; i++) {
                  org.jboss.weld.bean.proxy  (14 usages found)
                      DecoratorProxyFactory.java  (3 usages found)
                          isEqual(Method, Method)  (2 usages found)
                              164 if (m.getName().equals(a.getName()) && m.getParameterTypes().length == a.getParameterTypes().length && m.getReturnType().isAssignableFrom(a.getReturnType())) {
                              165 for (int i = 0; i < m.getParameterTypes().length; i++) {
                          createDelegateInitializerCode(ClassMethod, MethodInformation, int)  (1 usage found)
                              233 for (int i = 0; i < initializerMethodInfo.getMethod().getParameterTypes().length; ++i) {
                      InterceptedProxyFactory.java  (4 usages found)
                          createNotInterceptedMethod(ClassMethod, MethodInformation, Method, ClassMethod)  (2 usages found)
                              191 b.iconst(method.getParameterTypes().length);
                              196 for (int i = 0; i < method.getParameterTypes().length; ++i) {
                          createInterceptedMethod(ClassMethod, MethodInformation, Method, ClassMethod)  (2 usages found)
                              241 b.iconst(method.getParameterTypes().length);
                              244 for (int i = 0; i < method.getParameterTypes().length; ++i) {
                      InterceptedSubclassFactory.java  (4 usages found)
                          invokeMethodHandler(ClassMethod, MethodInformation, boolean, BytecodeMethodResolver, boolean, ClassMethod)  (2 usages found)
                              478 b.iconst(methodInfo.getParameterTypes().length);
                              483 for (int i = 0; i < methodInfo.getParameterTypes().length; ++i) {
                          invokePrivateMethodHandler(CodeAttribute, ClassMethod, MethodInformation, ClassMethod)  (2 usages found)
                              600 b.iconst(methodInfo.getParameterTypes().length);
                              603 for (int i = 0; i < methodInfo.getParameterTypes().length; ++i) {
                      Marker.java  (1 usage found)
                          isMarker(int, Method, Object[])  (1 usage found)
                              35 return method.getParameterTypes().length > position && method.getParameterTypes()[position].equals(Marker.class) && INSTANCE.equals(args[position]);
                      ProxyFactory.java  (2 usages found)
                          invokeMethodHandler(ClassMethod, MethodInformation, boolean, BytecodeMethodResolver, ClassMethod)  (2 usages found)
                              771 b.iconst(method.getParameterTypes().length);
                              776 for (int i = 0; i < method.getParameterTypes().length; ++i) {
                  org.jboss.weld.tests.unit.util  (2 usages found)
                      DeclaredMemberIndexerTest.java  (2 usages found)
                          verifyConstructor(List<Constructor<?>>, int, Class<?>...)  (1 usage found)
                              90 assertEquals(constructor.getParameterTypes().length, expectedParamTypes.length);
                          verifyMethod(List<Method>, int, String, Class<?>...)  (1 usage found)
                              103 assertEquals(method.getParameterTypes().length, expectedParamTypes.length);
                  org.jboss.weld.util  (5 usages found)
                      AnnotatedTypes.java  (4 usages found)
                          compare(AnnotatedMethod<? super T>, AnnotatedMethod<? super T>)  (2 usages found)
                              121 result = arg0.getJavaMember().getParameterTypes().length - arg1.getJavaMember().getParameterTypes().length;
                              126 for (int i = 0; i < arg0.getJavaMember().getParameterTypes().length; ++i) {
                          compare(AnnotatedConstructor<? super T>, AnnotatedConstructor<? super T>)  (2 usages found)
                              154 result = arg0.getJavaMember().getParameterTypes().length - arg1.getJavaMember().getParameterTypes().length;
                              159 for (int i = 0; i < arg0.getJavaMember().getParameterTypes().length; ++i) {
                      Observers.java  (1 usage found)
                          hasNotifyOverriden(Class<?>, ObserverMethod<?>)  (1 usage found)
                              174 if (NOTIFY_METHOD_NAME.equals(method.getName()) && method.getParameterTypes().length == 1) {
              weld-ejb  (1 usage found)
                  org.jboss.weld.module.ejb  (1 usage found)
                      EnterpriseBeanProxyMethodHandler.java  (1 usage found)
                          isToStringMethod(Method)  (1 usage found)
                              145 return "toString".equals(method.getName()) && method.getParameterTypes().length == 0;
      

              Unassigned Unassigned
              clara0 Clara Fang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: