DATACMNS-867 - Avoid allocations from Method.getParameterTypes() where possible.

We now prefer an explicit Method.getParameterCount() over accessing the parameter types array and its length to avoid the overhead of cloning the array.

Original pull request: #187.
This commit is contained in:
Christoph Dreis
2016-12-02 12:26:14 +01:00
committed by Oliver Gierke
parent 1ad82cb82d
commit 9b3dd05baa
6 changed files with 8 additions and 9 deletions

View File

@@ -116,7 +116,7 @@ public class ClassGeneratingPropertyAccessorFactoryTests {
Constructor<?>[] declaredConstructors = persistentPropertyAccessor.getClass().getDeclaredConstructors();
assertThat(declaredConstructors.length).isEqualTo(1);
assertThat(declaredConstructors[0].getParameterTypes().length).isEqualTo(1);
assertThat(declaredConstructors[0].getParameterCount()).isEqualTo(1);
assertThat(declaredConstructors[0].getParameterTypes()[0]).isEqualTo(expectedConstructorType);
}