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

pmd / pmd / 95

22 Jul 2025 05:33PM UTC coverage: 78.418% (-0.02%) from 78.436%
95

push

github

web-flow
chore: [scala] Fix javadoc config (#5920)

17758 of 23477 branches covered (75.64%)

Branch coverage included in aggregate %.

38997 of 48898 relevant lines covered (79.75%)

0.81 hits per line

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

35.19
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/types/ArrayMethodSigImpl.java
1
/*
2
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3
 */
4

5
package net.sourceforge.pmd.lang.java.types;
6

7
import static java.util.Collections.emptyList;
8

9
import java.util.Collections;
10
import java.util.List;
11
import java.util.Objects;
12
import java.util.function.Function;
13

14
import org.checkerframework.checker.nullness.qual.NonNull;
15
import org.checkerframework.checker.nullness.qual.Nullable;
16

17
import net.sourceforge.pmd.lang.java.symbols.JConstructorSymbol;
18
import net.sourceforge.pmd.lang.java.symbols.JExecutableSymbol;
19
import net.sourceforge.pmd.lang.java.types.internal.InternalMethodTypeItf;
20

21
// for array clone or array constructor
22
class ArrayMethodSigImpl implements JMethodSig, InternalMethodTypeItf {
23

24

25
    private final JArrayType owner;
26
    // either method or constructor
27
    private final JExecutableSymbol symbol;
28

29
    ArrayMethodSigImpl(JArrayType owner,
30
                       @NonNull JExecutableSymbol symbol) {
1✔
31
        this.owner = owner;
1✔
32
        this.symbol = symbol;
1✔
33
    }
1✔
34

35
    @Override
36
    public TypeSystem getTypeSystem() {
37
        return owner.getTypeSystem();
1✔
38
    }
39

40
    @Override
41
    public JExecutableSymbol getSymbol() {
42
        return symbol;
1✔
43
    }
44

45
    @Override
46
    public JArrayType getDeclaringType() {
47
        return owner;
1✔
48
    }
49

50
    @Override
51
    public JMethodSig getErasure() {
52
        JArrayType erasedOwner = owner.getErasure();
×
53
        return erasedOwner == owner ? this : new ArrayMethodSigImpl(erasedOwner, symbol); // NOPMD CompareObjectsWithEquals
×
54
    }
55

56
    @Override
57
    public JTypeMirror getAnnotatedReceiverType() {
58
        return owner;
×
59
    }
60

61
    @Override
62
    public JTypeMirror getReturnType() {
63
        return owner; // clone or cons
1✔
64
    }
65

66
    @Override
67
    public List<JTypeMirror> getFormalParameters() {
68
        if (getSymbol() instanceof JConstructorSymbol) {
1✔
69
            return Collections.singletonList(owner.getTypeSystem().INT);
1✔
70
        }
71
        return emptyList();
1✔
72
    }
73

74

75
    @Override
76
    public List<JTypeVar> getTypeParameters() {
77
        return emptyList();
1✔
78
    }
79

80
    @Override
81
    public List<JTypeMirror> getThrownExceptions() {
82
        return emptyList();
1✔
83
    }
84

85
    @Override
86
    public JMethodSig withReturnType(JTypeMirror returnType) {
87
        if (!returnType.equals(owner)) {
×
88
            throw new UnsupportedOperationException("Something went wrong");
×
89
        }
90
        return this;
×
91
    }
92

93
    @Override
94
    public JMethodSig withTypeParams(@Nullable List<JTypeVar> tparams) {
95
        if (tparams != null && !tparams.isEmpty()) {
×
96
            throw new UnsupportedOperationException("Something went wrong");
×
97
        }
98
        return this;
×
99
    }
100

101
    @Override
102
    public JMethodSig subst(Function<? super SubstVar, ? extends JTypeMirror> fun) {
103
        JArrayType subbed = (JArrayType) TypeOps.subst(owner, fun);
1✔
104
        return new ArrayMethodSigImpl(subbed, getSymbol());
1✔
105
    }
106

107
    @Override
108
    public JMethodSig withOwner(JTypeMirror newOwner) {
109
        if (newOwner instanceof JArrayType) {
×
110
            return new ArrayMethodSigImpl((JArrayType) newOwner, symbol);
×
111
        } else {
112
            throw new IllegalArgumentException(newOwner + " cannot be the owner of " + this);
×
113
        }
114
    }
115

116
    @Override
117
    public JMethodSig markAsAdapted() {
118
        return this;
×
119
    }
120

121
    @Override
122
    public JMethodSig originalMethod() {
123
        return new ArrayMethodSigImpl(owner, symbol);
1✔
124
    }
125

126
    @Override
127
    public JMethodSig adaptedMethod() {
128
        return originalMethod();
1✔
129
    }
130

131
    @Override
132
    public String toString() {
133
        return TypePrettyPrint.prettyPrint(this);
×
134
    }
135

136

137
    @Override
138
    public boolean equals(Object o) {
139
        if (this == o) {
×
140
            return true;
×
141
        }
142
        if (!(o instanceof JMethodSig)) {
×
143
            return false;
×
144
        }
145
        JMethodSig that = (JMethodSig) o;
×
146
        return TypeOps.isSameType(this, that);
×
147
    }
148

149
    @Override
150
    public int hashCode() {
151
        return Objects.hash(getName(), getFormalParameters(), getReturnType());
×
152
    }
153
}
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