Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant Parameter implementation #2706

Merged
merged 1 commit into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Parameter;
import java.util.*;
import javax.annotation.Nullable;
import org.testng.DataProviderHolder;
Expand Down Expand Up @@ -36,7 +37,6 @@
import org.testng.internal.reflect.InjectableParameter;
import org.testng.internal.reflect.MethodMatcher;
import org.testng.internal.reflect.MethodMatcherContext;
import org.testng.internal.reflect.Parameter;
import org.testng.internal.reflect.ReflectionRecipes;
import org.testng.util.Strings;
import org.testng.xml.XmlSuite;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.testng.internal.reflect;

import java.lang.reflect.Parameter;
import java.util.List;
import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.testng.internal.reflect.InjectableParameter.Assistant.ALL_INJECTS;

import java.lang.reflect.Array;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.testng.internal.reflect.InjectableParameter.Assistant.ALL_INJECTS;
import static org.testng.internal.reflect.InjectableParameter.Assistant.NONE;

import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.testng.internal.reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import org.testng.ITestContext;
import org.testng.ITestResult;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.Arrays;
import org.testng.TestNGException;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.testng.internal.reflect;

import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.*;
import org.testng.ITestContext;
import org.testng.ITestResult;
Expand Down Expand Up @@ -151,7 +151,7 @@ public static Parameter[] getMethodParameters(final Method method) {
if (method == null) {
return new Parameter[] {};
}
return getParameters(method.getParameterTypes(), method.getParameterAnnotations());
return method.getParameters();
}

/**
Expand All @@ -164,16 +164,7 @@ public static Parameter[] getConstructorParameters(final Constructor<?> construc
if (constructor == null) {
return new Parameter[] {};
}
return getParameters(constructor.getParameterTypes(), constructor.getParameterAnnotations());
}

private static Parameter[] getParameters(
Class<?>[] parametersTypes, final Annotation[][] parametersAnnotations) {
final Parameter[] parameters = new Parameter[parametersTypes.length];
for (int i = 0; i < parametersTypes.length; i++) {
parameters[i] = new Parameter(i, parametersTypes[i], parametersAnnotations[i]);
}
return parameters;
return constructor.getParameters();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.lang.annotation.Target;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -19,7 +20,6 @@
import org.testng.annotations.NoInjection;
import org.testng.annotations.Test;
import org.testng.internal.reflect.InjectableParameter;
import org.testng.internal.reflect.Parameter;
import org.testng.internal.reflect.ReflectionRecipes;
import org.testng.log4testng.Logger;
import org.testng.xml.XmlTest;
Expand Down