File tree 1 file changed +10
-4
lines changed
src/test/java/io/reactivex/validators
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,18 @@ static void checkCheckReturnValueSupport(Class<?> clazz) {
42
42
continue ;
43
43
}
44
44
if (m .getDeclaringClass () == clazz ) {
45
- boolean isSubscribeMethod = "subscribe" .equals (m .getName ()) && m .getParameterTypes ().length == 0 ;
45
+ boolean isSubscribeMethod = "subscribe" .equals (m .getName ());
46
+ boolean isNoArgSubscribeMethod = isSubscribeMethod && m .getParameterTypes ().length == 0 ;
46
47
boolean isAnnotationPresent = m .isAnnotationPresent (CheckReturnValue .class );
48
+ boolean isVoid = m .getReturnType ().equals (Void .TYPE );
47
49
48
50
if (isSubscribeMethod ) {
49
- if (isAnnotationPresent ) {
50
- b .append ("subscribe() method has @CheckReturnValue: " ).append (m ).append ("\r \n " );
51
+ if (isNoArgSubscribeMethod ) {
52
+ if (isAnnotationPresent ) {
53
+ b .append ("subscribe() method has @CheckReturnValue: " ).append (m ).append ("\r \n " );
54
+ }
55
+ } else if (!isVoid && !m .isAnnotationPresent (OptionalCheckReturnValue .class )) {
56
+ b .append ("subscribe() method missing @OptionalCheckReturnValue: " ).append (m ).append ("\r \n " );
51
57
}
52
58
continue ;
53
59
}
@@ -57,7 +63,7 @@ static void checkCheckReturnValueSupport(Class<?> clazz) {
57
63
continue ;
58
64
}
59
65
60
- if (m . getReturnType (). equals ( Void . TYPE ) ) {
66
+ if (isVoid ) {
61
67
if (isAnnotationPresent ) {
62
68
b .append ("Void method has @CheckReturnValue: " ).append (m ).append ("\r \n " );
63
69
}
You can’t perform that action at this time.
0 commit comments