• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / jmockit1 / 496

15 Nov 2025 05:33PM UTC coverage: 72.192% (-0.008%) from 72.2%
496

push

github

web-flow
Merge pull request #412 from hazendaz/renovate/major-spring-core

Update spring core to v7 (major)

5677 of 8360 branches covered (67.91%)

Branch coverage included in aggregate %.

11922 of 16018 relevant lines covered (74.43%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.43
/main/src/main/java/mockit/asm/types/ArrayType.java
1
/*
2
 * MIT License
3
 * Copyright (c) 2006-2025 JMockit developers
4
 * See LICENSE file for full license text.
5
 */
6
package mockit.asm.types;
7

8
import edu.umd.cs.findbugs.annotations.NonNull;
9

10
import org.checkerframework.checker.index.qual.NonNegative;
11

12
public final class ArrayType extends ReferenceType {
13
    @NonNull
14
    public static ArrayType create(@NonNull String typeDesc) {
15
        return new ArrayType(typeDesc.toCharArray());
1✔
16
    }
17

18
    /**
19
     * Initializes an array type.
20
     *
21
     * @param typeDesc
22
     *            a buffer containing the descriptor of the array type
23
     * @param off
24
     *            the offset of the descriptor in the buffer
25
     */
26
    @NonNull
27
    static ArrayType create(@NonNull char[] typeDesc, @NonNegative int off) {
28
        int len = findNumberOfDimensions(typeDesc, off);
1✔
29

30
        if (typeDesc[off + len] == 'L') {
1✔
31
            len = findTypeNameLength(typeDesc, off, len);
1✔
32
        }
33

34
        return new ArrayType(typeDesc, off, len + 1);
1✔
35
    }
36

37
    @NonNegative
38
    private static int findNumberOfDimensions(@NonNull char[] typeDesc, @NonNegative int off) {
39
        int dimensions = 1;
1✔
40

41
        while (typeDesc[off + dimensions] == '[') {
1✔
42
            dimensions++;
1✔
43
        }
44

45
        return dimensions;
1✔
46
    }
47

48
    private ArrayType(@NonNull char[] typeDesc, @NonNegative int off, @NonNegative int len) {
49
        super(typeDesc, off, len);
1✔
50
    }
1✔
51

52
    ArrayType(@NonNull char[] typeDesc) {
53
        super(typeDesc);
1✔
54
    }
1✔
55

56
    /**
57
     * Returns the number of dimensions of this array type.
58
     */
59
    @NonNegative
60
    public int getDimensions() {
61
        return findNumberOfDimensions(typeDescChars, off);
1✔
62
    }
63

64
    /**
65
     * Returns the type of the elements of this array type.
66
     */
67
    @NonNull
68
    public JavaType getElementType() {
69
        int dimensions = getDimensions();
1✔
70
        return getType(typeDescChars, off + dimensions);
1✔
71
    }
72

73
    @NonNull
74
    @Override
75
    public String getClassName() {
76
        String className = getElementType().getClassName();
×
77
        StringBuilder sb = new StringBuilder(className);
×
78
        int dimensions = getDimensions();
×
79

80
        for (int i = dimensions; i > 0; i--) {
×
81
            sb.append("[]");
×
82
        }
83

84
        return sb.toString();
×
85
    }
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc