Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-13520

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 14.0.0.Final
    • None
    • Hot Rod, JCache
    • None

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

      Targets
          Occurrences of 'getParameterTypes().length' in Project
      Found Occurrences in Project  (11 usages found)
          Unclassified  (11 usages found)
              infinispan-cdi-common  (5 usages found)
                  org.infinispan.cdi.common.util  (2 usages found)
                      Annotateds.java  (2 usages found)
                          compare(AnnotatedMethod<? super T>, AnnotatedMethod<? super T>)  (1 usage found)
                              72 for (int i = 0; i < arg0.getJavaMember().getParameterTypes().length; ++i) {
                          compare(AnnotatedConstructor<? super T>, AnnotatedConstructor<? super T>)  (1 usage found)
                              98 for (int i = 0; i < arg0.getJavaMember().getParameterTypes().length; ++i) {
                  org.infinispan.cdi.common.util.annotatedtypebuilder  (3 usages found)
                      AnnotatedConstructorImpl.java  (1 usage found)
                          getGenericArray(Constructor<?>)  (1 usage found)
                              24 if (genericTypes.length + 1 == constructor.getParameterTypes().length) {
                      AnnotatedTypeBuilder.java  (2 usages found)
                          readFromType(Class<X>, boolean)  (2 usages found)
                              215 for (int i = 0; i < method.getParameterTypes().length; ++i) {
                              246 for (int i = 0; i < constructor.getParameterTypes().length; ++i) {
              infinispan-client-hotrod  (1 usage found)
                  org.infinispan.client.hotrod.event.impl  (1 usage found)
                      ClientEventDispatcher.java  (1 usage found)
                          testListenerMethodValidity(Method, Class<?>[], String)  (1 usage found)
                              89 if (m.getParameterTypes().length == 1 && m.getParameterTypes()[0].isAssignableFrom(allowedParameter)) {
              infinispan-commons  (1 usage found)
                  org.infinispan.commons.util  (1 usage found)
                      Util.java  (1 usage found)
                          getFactoryMethod(Class<?>)  (1 usage found)
                              213 if (m.getName().equals("getInstance") && m.getParameterTypes().length == 0 && Modifier.isStatic(m.getModifiers()))
              infinispan-core  (3 usages found)
                  org.infinispan.commands  (1 usage found)
                      CommandIdUniquenessTest.java  (1 usage found)
                          testCommandIdUniqueness()  (1 usage found)
                              27 if (declaredCtor.getParameterTypes().length == 0) {
                  org.infinispan.distribution.group.impl  (1 usage found)
                      GroupManagerImpl.java  (1 usage found)
                          GroupMetadataImpl(Method)  (1 usage found)
                              58 if (method.getParameterTypes().length > 0)
                  org.infinispan.notifications.impl  (1 usage found)
                      AbstractListenerImpl.java  (1 usage found)
                          testListenerMethodValidity(Method, Class<?>, String)  (1 usage found)
                              363 if (m.getParameterTypes().length != 1 || !m.getParameterTypes()[0].isAssignableFrom(allowedParameter))
              infinispan-jcache  (1 usage found)
                  org.infinispan.jcache.annotation  (1 usage found)
                      CacheLookupHelper.java  (1 usage found)
                          getDefaultMethodCacheName(Method)  (1 usage found)
                              144 int nbParameters = method.getParameterTypes().length;
      

              ttarrant@redhat.com Tristan Tarrant
              clara0 Clara Fang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: