Skip to content

Commit 3ba5b9d

Browse files
committed
Fixed Sonar violations with missing generic signatures.
1 parent b784d47 commit 3ba5b9d

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/main/java/io/github/sskorol/core/DataProviderTransformer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ private DataSupplierMetaData getMetaData(final ITestContext context, final ITest
4444
}
4545

4646
@SuppressWarnings("FinalLocalVariable")
47-
private void assignCustomDataSupplier(final IDataProvidable annotation, final Method testMethod,
48-
final Class testClass) {
47+
private <T> void assignCustomDataSupplier(final IDataProvidable annotation, final Method testMethod,
48+
final Class<T> testClass) {
4949
var dataSupplierClass = getDataSupplierClass(annotation, testClass, testMethod);
5050
var dataSupplierAnnotation = getDataSupplierAnnotation(dataSupplierClass, annotation.getDataProvider());
5151

src/main/java/io/github/sskorol/core/IAnnotationTransformerInterceptor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
*/
1212
public interface IAnnotationTransformerInterceptor {
1313

14-
default void transform(final ITestAnnotation annotation, final Class testClass,
15-
final Constructor testConstructor, final Method testMethod) {
14+
default <T> void transform(final ITestAnnotation annotation, final Class<T> testClass,
15+
final Constructor<T> testConstructor, final Method testMethod) {
1616
// not implemented
1717
}
1818

1919
default void transform(final IFactoryAnnotation annotation, final Method testMethod) {
2020
// not implemented
2121
}
2222

23-
default void transform(final IConfigurationAnnotation annotation, final Class testClass,
24-
final Constructor testConstructor, final Method testMethod) {
23+
default <T> void transform(final IConfigurationAnnotation annotation, final Class<T> testClass,
24+
final Constructor<T> testConstructor, final Method testMethod) {
2525
// not implemented
2626
}
2727

2828
default void transform(final IDataProviderAnnotation annotation, final Method method) {
2929
// not implemented
3030
}
3131

32-
default void transform(final IListenersAnnotation annotation, final Class testClass) {
32+
default <T> void transform(final IListenersAnnotation annotation, final Class<T> testClass) {
3333
// not implemented
3434
}
3535
}

src/main/java/io/github/sskorol/utils/ReflectionUtils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
@UtilityClass
3838
public class ReflectionUtils {
3939

40-
public static Class<?> getDataSupplierClass(final IDataProvidable annotation, final Class testClass,
41-
final Method testMethod) {
40+
@SuppressWarnings("unchecked")
41+
public static <T> Class<T> getDataSupplierClass(final IDataProvidable annotation, final Class<T> testClass,
42+
final Method testMethod) {
4243
return ofNullable(annotation.getDataProviderClass())
4344
.map(dataProviderClass -> (Class) dataProviderClass)
4445
.orElseGet(() -> findParentDataSupplierClass(testMethod, testClass));
@@ -148,8 +149,9 @@ private static Tuple2<Class<?>, String> getFactoryAnnotationMetaData(final ITest
148149
return Tuple.of(dataProviderClass, dataProviderMethod);
149150
}
150151

151-
private static Class<?> findParentDataSupplierClass(final Method testMethod, final Class testClass) {
152-
return ofNullable(testMethod)
152+
@SuppressWarnings("unchecked")
153+
private static <T> Class<T> findParentDataSupplierClass(final Method testMethod, final Class<T> testClass) {
154+
return (Class<T>) ofNullable(testMethod)
153155
.map(m -> Tuple.of(m, new Reflections(m.getDeclaringClass().getPackage().getName())))
154156
.map(findParentDataSupplierClass())
155157
.orElse(testClass);

0 commit comments

Comments
 (0)