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

moosetechnology / MooseIDE / 21818695493

09 Feb 2026 09:02AM UTC coverage: 65.926% (+0.1%) from 65.829%
21818695493

push

github

web-flow
Merge pull request #1588 from moosetechnology/dead-code-heuristic-groups

Dead code heuristic groups

508 of 568 new or added lines in 21 files covered. (89.44%)

21882 of 33192 relevant lines covered (65.93%)

1.32 hits per line

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

91.38
/src/MooseIDE-DeadCode/MiDeadJavaImplementsAbstractRule.class.st
1
"
2
A heuristic to recognize methods overriding another method that is called.
3

4
If a method in a super-class (or interface) is called, we assume any method implementing it in a concrete class can be called
5
"
6
Class {
7
        #name : 'MiDeadJavaImplementsAbstractRule',
8
        #superclass : 'MiDeadAbstractJavaRule',
9
        #category : 'MooseIDE-DeadCode-Rules',
10
        #package : 'MooseIDE-DeadCode',
11
        #tag : 'Rules'
12
}
13

14
{ #category : 'testing' }
15
MiDeadJavaImplementsAbstractRule >> any: tWithMethods declaresMethod: aTMethod [
2✔
16

2✔
17
        tWithMethods do: [ :aTWithMethods |
2✔
18
                aTWithMethods methods
2✔
19
                        detect: [ :mth | mth signature = aTMethod signature ]
2✔
20
                        ifOne: [ :mth | ^true ]
2✔
21
        ].
2✔
22

2✔
23
        ^false
2✔
24
]
2✔
25

26
{ #category : 'testing' }
27
MiDeadJavaImplementsAbstractRule >> collect: tWithMethods definedMethod: aTMethod [
2✔
28

2✔
29
        ^tWithMethods
2✔
30
                collect: [ :aTWithMethods |
2✔
31
                        aTWithMethods methods
2✔
32
                                detect: [ :mth | mth signature = aTMethod signature ]
2✔
33
                                ifNone: [ nil ]
2✔
34
                ]
2✔
35
                thenReject: #isNil
2✔
36

2✔
37
]
2✔
38

39
{ #category : 'accessing' }
NEW
40
MiDeadJavaImplementsAbstractRule >> description [
×
41

×
42
        ^super description ,
×
43
        'A method implementing an abstract method, even dead, is needed for the implementation'
×
44
]
×
45

46
{ #category : 'accessing' }
47
MiDeadJavaImplementsAbstractRule >> name [
2✔
48

2✔
49
        ^super name , 'Implements abstract method'
2✔
50
]
2✔
51

52
{ #category : 'testing' }
53
MiDeadJavaImplementsAbstractRule >> notDead: aTMethod [
2✔
54
        "- Get all methods defined in super-classes
2✔
55
           - if any one is not abstract, then return false, the rule does not apply
2✔
56
           - if there is one, it must be abstract, return true (is not dead)
2✔
57
         - Look at all methods defined in implemented interface
2✔
58
           if any matches this method then return true (is not dead)"
2✔
59

2✔
60
        | superclasses definedMethods implementedInterfaces |
2✔
61

2✔
62
        superclasses := aTMethod parentType superclassHierarchy
2✔
63
                reject: #isNil. "protect against a bug in VerveineJ"
2✔
64

2✔
65
        definedMethods := self collect: superclasses definedMethod: aTMethod.
2✔
66
        
2✔
67
        definedMethods
2✔
68
                detect: [ :definedMethod | definedMethod isAbstract not ]
2✔
69
                ifOne: [ :definedMethod | ^false ].
2✔
70

2✔
71
        definedMethods ifNotEmpty: [ ^true ].
2✔
72

2✔
73
        implementedInterfaces := ({ aTMethod parentType } , superclasses)
2✔
74
                flatCollectAsSet: [ :c | self implementedInterfaceHierarchy: c ].
2✔
75

2✔
76
        (self any: implementedInterfaces declaresMethod: aTMethod)
2✔
77
                ifTrue: [ ^true ].
2✔
78

2✔
79
        ^ false
2✔
80
]
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc