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

pmd / pmd / 277

27 Nov 2025 01:37PM UTC coverage: 78.778% (+0.03%) from 78.749%
277

push

github

adangel
[java] UseArraysAsList: skip when if-statements (#6228)

18419 of 24233 branches covered (76.01%)

Branch coverage included in aggregate %.

40090 of 50038 relevant lines covered (80.12%)

0.81 hits per line

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

91.3
/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AssignmentOp.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.ast;
6

7
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.ADD;
8
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.AND;
9
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.DIV;
10
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.LEFT_SHIFT;
11
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.MOD;
12
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.MUL;
13
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.OR;
14
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.RIGHT_SHIFT;
15
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.SUB;
16
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.UNSIGNED_RIGHT_SHIFT;
17
import static net.sourceforge.pmd.lang.java.ast.BinaryOp.XOR;
18
import static net.sourceforge.pmd.lang.java.ast.InternalInterfaces.OperatorLike;
19

20
import org.checkerframework.checker.nullness.qual.Nullable;
21

22

23
/**
24
 * An assignment operator for {@link ASTAssignmentExpression}.
25
 *
26
 * <pre class="grammar">
27
 *
28
 * AssignmentOp ::= "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "&lt;&lt;=" | "&gt;&gt;=" | "&gt;&gt;&gt;=" | "&amp;=" | "^=" | "|="
29
 *
30
 * </pre>
31
 *
32
 * @see BinaryOp
33
 * @see UnaryOp
34
 */
35
public enum AssignmentOp implements OperatorLike {
1✔
36
    ASSIGN("=", null),
1✔
37
    AND_ASSIGN("&=", AND),
1✔
38
    OR_ASSIGN("|=", OR),
1✔
39
    XOR_ASSIGN("^=", XOR),
1✔
40
    ADD_ASSIGN("+=", ADD),
1✔
41
    SUB_ASSIGN("-=", SUB),
1✔
42
    MUL_ASSIGN("*=", MUL),
1✔
43
    DIV_ASSIGN("/=", DIV),
1✔
44
    MOD_ASSIGN("%=", MOD),
1✔
45
    LEFT_SHIFT_ASSIGN("<<=", LEFT_SHIFT),
1✔
46
    RIGHT_SHIFT_ASSIGN(">>=", RIGHT_SHIFT),
1✔
47
    UNSIGNED_RIGHT_SHIFT_ASSIGN(">>>=", UNSIGNED_RIGHT_SHIFT);
1✔
48

49
    private final String code;
50
    private final BinaryOp binaryOp;
51

52

53
    AssignmentOp(String code,
54
                 @Nullable BinaryOp binaryOp) {
1✔
55
        this.code = code;
1✔
56
        this.binaryOp = binaryOp;
1✔
57
    }
1✔
58

59
    @Override
60
    public String getToken() {
61
        return code;
×
62
    }
63

64
    @Override
65
    public String toString() {
66
        return this.code;
1✔
67
    }
68

69

70
    /**
71
     * Returns true if this operator combines
72
     * a binary operator with the assignment.
73
     */
74
    public boolean isCompound() {
75
        return this != ASSIGN;
1✔
76
    }
77

78

79
    /**
80
     * Returns the binary operator this corresponds to
81
     * if this is a compound operator, otherwise returns
82
     * null.
83
     */
84
    public @Nullable BinaryOp getBinaryOp() {
85
        return binaryOp;
×
86
    }
87

88

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