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

pmd / pmd / 152

11 Sep 2025 09:46AM UTC coverage: 78.65% (+0.05%) from 78.603%
152

push

github

web-flow
[java] New rule: ModifierOrder (#5601)

18160 of 23935 branches covered (75.87%)

Branch coverage included in aggregate %.

175 of 182 new or added lines in 10 files covered. (96.15%)

2 existing lines in 2 files now uncovered.

39628 of 49540 relevant lines covered (79.99%)

0.81 hits per line

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

82.22
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symbols/internal/UnresolvedClassImpl.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.symbols.internal;
6

7
import java.lang.reflect.Modifier;
8
import java.util.Collections;
9
import java.util.List;
10

11
import org.checkerframework.checker.nullness.qual.NonNull;
12
import org.checkerframework.checker.nullness.qual.Nullable;
13

14
import net.sourceforge.pmd.lang.java.symbols.JClassSymbol;
15
import net.sourceforge.pmd.lang.java.symbols.JConstructorSymbol;
16
import net.sourceforge.pmd.lang.java.symbols.JExecutableSymbol;
17
import net.sourceforge.pmd.lang.java.symbols.JFieldSymbol;
18
import net.sourceforge.pmd.lang.java.symbols.JMethodSymbol;
19
import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol;
20
import net.sourceforge.pmd.lang.java.types.JClassType;
21
import net.sourceforge.pmd.lang.java.types.JTypeVar;
22
import net.sourceforge.pmd.lang.java.types.Substitution;
23
import net.sourceforge.pmd.lang.java.types.TypeSystem;
24

25
/**
26
 * Unresolved <i>external reference</i> to a class.
27
 *
28
 * @see JClassSymbol#isUnresolved()
29
 */
30
abstract class UnresolvedClassImpl implements JClassSymbol {
31

32
    private final TypeSystem ts;
33
    private final @Nullable JClassSymbol enclosing;
34
    private final String canonicalName;
35

36
    UnresolvedClassImpl(TypeSystem ts, @Nullable JClassSymbol enclosing, String canonicalName) {
1✔
37
        this.ts = ts;
1✔
38
        this.enclosing = enclosing;
1✔
39
        this.canonicalName = canonicalName;
1✔
40
    }
1✔
41

42
    @Override
43
    public TypeSystem getTypeSystem() {
44
        return ts;
1✔
45
    }
46

47
    /**
48
     * Set the number of type parameters of this type. Does nothing if
49
     * it is already set.
50
     */
51
    abstract void setTypeParameterCount(int newArity);
52

53
    abstract UnresolvedClassImpl getOrCreateUnresolvedChildClass(String simpleName);
54

55
    @Override
56
    public List<JTypeVar> getTypeParameters() {
57
        return Collections.emptyList();
×
58
    }
59

60
    @Override
61
    public boolean isUnresolved() {
62
        return true;
1✔
63
    }
64

65

66
    @Override
67
    public @Nullable JExecutableSymbol getEnclosingMethod() {
68
        return null;
×
69
    }
70

71
    @Override
72
    public boolean isPrimitive() {
73
        return false;
1✔
74
    }
75

76
    @Override
77
    public @NonNull String getBinaryName() {
78
        return canonicalName;
1✔
79
    }
80

81
    @NonNull
82
    @Override
83
    public String getSimpleName() {
84
        int idx = canonicalName.lastIndexOf('.');
1✔
85
        if (idx < 0) {
1✔
86
            return canonicalName;
1✔
87
        } else {
88
            return canonicalName.substring(idx + 1);
1✔
89
        }
90
    }
91

92
    @Override
93
    public String getCanonicalName() {
94
        return canonicalName;
1✔
95
    }
96

97
    @Override
98
    public @NonNull String getPackageName() {
99
        int idx = canonicalName.lastIndexOf('.');
1✔
100
        if (idx < 0) {
1✔
101
            return canonicalName;
1✔
102
        } else {
103
            return canonicalName.substring(0, idx);
1✔
104
        }
105
    }
106

107

108
    @Nullable
109
    @Override
110
    public JClassSymbol getSuperclass() {
111
        return getTypeSystem().OBJECT.getSymbol();
1✔
112
    }
113

114
    @Override
115
    public List<JClassType> getSuperInterfaceTypes(Substitution substitution) {
116
        return Collections.emptyList();
1✔
117
    }
118

119

120
    @Override
121
    public List<JClassSymbol> getSuperInterfaces() {
122
        return Collections.emptyList();
1✔
123
    }
124

125

126
    @Override
127
    public @Nullable JClassType getSuperclassType(Substitution substitution) {
128
        return getTypeSystem().OBJECT;
1✔
129
    }
130

131

132
    @Override
133
    public List<JClassSymbol> getDeclaredClasses() {
134
        return Collections.emptyList();
×
135
    }
136

137
    @Override
138
    public boolean isInterface() {
139
        return false;
1✔
140
    }
141

142
    @Override
143
    public boolean isEnum() {
144
        return false;
1✔
145
    }
146

147
    @Override
148
    public boolean isRecord() {
149
        return false;
×
150
    }
151

152
    @Override
153
    public boolean isAnnotation() {
UNCOV
154
        return false;
×
155
    }
156

157
    @Override
158
    public boolean isAnonymousClass() {
159
        return false;
1✔
160
    }
161

162
    @Override
163
    public boolean isLocalClass() {
164
        return false;
×
165
    }
166

167
    @Override
168
    public boolean isArray() {
169
        return false;
1✔
170
    }
171

172
    @Override
173
    public JClassSymbol getEnclosingClass() {
174
        return enclosing;
1✔
175
    }
176

177
    @Override
178
    public int getModifiers() {
179
        return Modifier.PUBLIC;
1✔
180
    }
181

182

183
    @Nullable
184
    @Override
185
    public JTypeDeclSymbol getArrayComponent() {
186
        return null;
×
187
    }
188

189
    @Override
190
    public List<JMethodSymbol> getDeclaredMethods() {
191
        return Collections.emptyList();
1✔
192
    }
193

194
    @Override
195
    public List<JConstructorSymbol> getConstructors() {
196
        return Collections.emptyList();
1✔
197
    }
198

199
    @Override
200
    public List<JFieldSymbol> getDeclaredFields() {
201
        return Collections.emptyList();
1✔
202
    }
203

204
    @Override
205
    public String toString() {
206
        return SymbolToStrings.SHARED.toString(this);
×
207
    }
208

209
    @Override
210
    public boolean equals(Object o) {
211
        return SymbolEquality.equals(this, o);
1✔
212
    }
213

214
    @Override
215
    public int hashCode() {
216
        return SymbolEquality.hash(this);
1✔
217
    }
218

219
}
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