mockito / mockito
Showing 1 of 1 files from the diff.

@@ -4,8 +4,6 @@
Loading
4 4
 */
5 5
package org.mockito.internal.util;
6 6
7 -
import com.sun.istack.internal.NotNull;
8 -
import com.sun.istack.internal.Nullable;
9 7
import org.mockito.internal.stubbing.BaseStubbing;
10 8
import org.mockito.internal.stubbing.OngoingStubbingImpl;
11 9
import org.mockito.invocation.MatchableInvocation;
@@ -18,7 +16,7 @@
Loading
18 16
    // underlying type.
19 17
    // So, `thenReturn` calls fails, because of non-compatible types.
20 18
    public static boolean isInlineClassWithAssignableUnderlyingType(
21 -
            @NotNull Class<?> inlineClass, @NotNull Class<?> underlyingType) {
19 +
            Class<?> inlineClass, Class<?> underlyingType) {
22 20
        Method boxImpl = findBoxImplMethod(inlineClass);
23 21
        if (boxImpl == null) return false;
24 22
@@ -32,12 +30,11 @@
Loading
32 30
        }
33 31
    }
34 32
35 -
    private static boolean isInlineClass(@NotNull Class<?> inlineClass) {
33 +
    private static boolean isInlineClass(Class<?> inlineClass) {
36 34
        return findBoxImplMethod(inlineClass) != null;
37 35
    }
38 36
39 -
    @Nullable
40 -
    private static Method findBoxImplMethod(@NotNull Class<?> inlineClass) {
37 +
    private static Method findBoxImplMethod(Class<?> inlineClass) {
41 38
        // All inline classes have 'box-impl' method, which accepts
42 39
        // underlying type and returns inline class.
43 40
        for (Method declaredMethod : inlineClass.getDeclaredMethods()) {
@@ -48,8 +45,7 @@
Loading
48 45
        return null;
49 46
    }
50 47
51 -
    @Nullable
52 -
    private static Object unboxInlineClass(@NotNull Object boxedValue)
48 +
    private static Object unboxInlineClass(Object boxedValue)
53 49
            throws InvocationTargetException, IllegalAccessException {
54 50
        Class<?> inlineClass = boxedValue.getClass();
55 51
        Method unboxImpl = null;
@@ -65,14 +61,13 @@
Loading
65 61
        return unboxImpl.invoke(boxedValue);
66 62
    }
67 63
68 -
    private static boolean returnsBoxedInlineClass(@NotNull BaseStubbing<?> stubbing) {
64 +
    private static boolean returnsBoxedInlineClass(BaseStubbing<?> stubbing) {
69 65
        Class<?> returnType = getReturnTypeOfInvocation(stubbing);
70 66
        if (returnType == null) return false;
71 67
        return isInlineClass(returnType);
72 68
    }
73 69
74 -
    @Nullable
75 -
    private static Class<?> getReturnTypeOfInvocation(@NotNull BaseStubbing<?> stubbing) {
70 +
    private static Class<?> getReturnTypeOfInvocation(BaseStubbing<?> stubbing) {
76 71
        if (!(stubbing instanceof OngoingStubbingImpl<?>)) {
77 72
            return null;
78 73
        }
@@ -84,15 +79,13 @@
Loading
84 79
        return invocationForStubbing.getInvocation().getRawReturnType();
85 80
    }
86 81
87 -
    private static boolean returnsUnderlyingTypeOf(
88 -
            @NotNull BaseStubbing<?> stubbing, @NotNull Object value) {
82 +
    private static boolean returnsUnderlyingTypeOf(BaseStubbing<?> stubbing, Object value) {
89 83
        Class<?> returnType = getReturnTypeOfInvocation(stubbing);
90 84
        if (returnType == null) return false;
91 85
        return isInlineClassWithAssignableUnderlyingType(value.getClass(), returnType);
92 86
    }
93 87
94 -
    public static Object unboxUnderlyingValueIfNeeded(
95 -
            @NotNull BaseStubbing<?> stubbing, @Nullable Object value) {
88 +
    public static Object unboxUnderlyingValueIfNeeded(BaseStubbing<?> stubbing, Object value) {
96 89
        if (value != null
97 90
                && isInlineClass(value.getClass())
98 91
                && !returnsBoxedInlineClass(stubbing)
Files Complexity Coverage
src/main/java/org/mockito 86.20% 84.95%
subprojects 79.07% 84.62%
Project Totals (327 files) 86.10% 84.94%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading