Use getParameterCount() in place of getParameterTypes().length
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
Usages of `getParameterTypes().length` should be replaced by `getParameterCount()`, as `getParameterTypes().length` is inefficient because it creates an array clone, while `getParameterCount()` directly returns the length.
```
Targets
Occurrences of 'getParameterTypes().length' in Sentinel
Found Occurrences in Directory Sentinel (4 usages found)
Unclassified (4 usages found)
sentinel-annotation-aspectj (2 usages found)
com.alibaba.csp.sentinel.annotation.aspectj (2 usages found)
AbstractSentinelAspectSupport.java (2 usages found)
handleFallback(ProceedingJoinPoint, String, String, Class[], Throwable) (1 usage found)
96 int paramCount = fallbackMethod.getParameterTypes().length;
handleDefaultFallback(ProceedingJoinPoint, String, Class[], Throwable) (1 usage found)
117 Object[] args = fallbackMethod.getParameterTypes().length == 0 ? new Object[0] : new Object[] {ex};
sentinel-annotation-cdi-interceptor (2 usages found)
com.alibaba.csp.sentinel.annotation.cdi.interceptor (2 usages found)
AbstractSentinelInterceptorSupport.java (2 usages found)
handleFallback(InvocationContext, String, String, Class[], Throwable) (1 usage found)
96 int paramCount = fallbackMethod.getParameterTypes().length;
handleDefaultFallback(InvocationContext, String, Class[], Throwable) (1 usage found)
125 Object[] args = fallbackMethod.getParameterTypes().length == 0 ? new Object[0] : new Object[] {ex};
```
Contributor guide
Assessment
This issue has not been assessed yet.