@abaplint/core 2.113.12 → 2.113.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/abaplint.d.ts
CHANGED
|
@@ -305,6 +305,7 @@ class ABAPFileInformation {
|
|
|
305
305
|
identifier: new _identifier_1.Identifier(methodName, this.filename),
|
|
306
306
|
isRedefinition: def.findDirectExpression(Expressions.Redefinition) !== undefined,
|
|
307
307
|
isForTesting: def.concatTokens().toUpperCase().includes(" FOR TESTING"),
|
|
308
|
+
isFinal: def.concatTokens().toUpperCase().includes(" FINAL"),
|
|
308
309
|
isAbstract: def.findDirectExpression(Expressions.Abstract) !== undefined,
|
|
309
310
|
isEventHandler: def.findDirectExpression(Expressions.EventHandler) !== undefined,
|
|
310
311
|
visibility,
|
package/build/src/registry.js
CHANGED
|
@@ -63,7 +63,7 @@ class UnusedMethods {
|
|
|
63
63
|
extendedInformation: `Checks private and protected methods.
|
|
64
64
|
|
|
65
65
|
Unused methods are not reported if the object contains parser or syntax errors.
|
|
66
|
-
Quick fixes only appears for private methods.
|
|
66
|
+
Quick fixes only appears for private methods or projected methods where the class doesnt have any subclasses.
|
|
67
67
|
|
|
68
68
|
Skips:
|
|
69
69
|
* methods FOR TESTING
|
|
@@ -156,7 +156,9 @@ Skips:
|
|
|
156
156
|
continue;
|
|
157
157
|
}
|
|
158
158
|
let fix = undefined;
|
|
159
|
-
if (i.visibility === visibility_1.Visibility.Private
|
|
159
|
+
if (i.visibility === visibility_1.Visibility.Private
|
|
160
|
+
|| i.isFinal === true
|
|
161
|
+
|| (i.visibility === visibility_1.Visibility.Protected && this.hasSubClass(obj) === false)) {
|
|
160
162
|
const implementation = this.findMethodImplementation(i, file);
|
|
161
163
|
if (implementation !== undefined) {
|
|
162
164
|
const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);
|
|
@@ -169,6 +171,22 @@ Skips:
|
|
|
169
171
|
}
|
|
170
172
|
return issues;
|
|
171
173
|
}
|
|
174
|
+
hasSubClass(obj) {
|
|
175
|
+
var _a, _b, _c;
|
|
176
|
+
if (!(obj instanceof objects_1.Class)) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
if (((_a = obj.getDefinition()) === null || _a === void 0 ? void 0 : _a.isFinal()) === true) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
for (const r of this.reg.getObjects()) {
|
|
183
|
+
if (r instanceof objects_1.Class
|
|
184
|
+
&& ((_c = (_b = r.getDefinition()) === null || _b === void 0 ? void 0 : _b.getSuperClass()) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === obj.getName().toUpperCase()) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
172
190
|
findMethodImplementation(method, file) {
|
|
173
191
|
var _a, _b;
|
|
174
192
|
for (const classImplementation of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStructures(Structures.ClassImplementation)) || []) {
|