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

devonfw / IDEasy / 28107441918

24 Jun 2026 02:51PM UTC coverage: 71.421% (+0.04%) from 71.381%
28107441918

Pull #2057

github

web-flow
Merge c00e7f2c6 into 459b15501
Pull Request #2057: #1178: Clean up and Solution for new qualifier snapshot

4732 of 7320 branches covered (64.64%)

Branch coverage included in aggregate %.

12142 of 16306 relevant lines covered (74.46%)

3.15 hits per line

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

92.0
cli/src/main/java/com/devonfw/tools/ide/version/VersionPhase.java
1
package com.devonfw.tools.ide.version;
2

3
/**
4
 * Enum with the available development phases of a {@link VersionSegment#getLettersString() letter-sequence} from a {@link VersionSegment}.
5
 */
6
public enum VersionPhase implements AbstractVersionPhase {
3✔
7

8
  /** An undefined {@link VersionPhase} such as "apple" or "banana". */
9
  UNDEFINED,
8✔
10

11
  /** A revision number (actually not a development phase like {@link #UNDEFINED}). */
12
  REVISION(Boolean.TRUE, "revision", "rev", "u"),
21✔
13

14
  /** Unstable marker - see {@link VersionSegment#PATTERN_MATCH_ANY_VERSION}. */
15
  UNSTABLE(Boolean.FALSE, "!"),
13✔
16

17
  /** A nightly build version from continuous-integration (CI) process. */
18
  NIGHTLY("nightly", "nb", "ci"),
20✔
19

20
  /** A version for alpha testing (unstable). */
21
  ALPHA(Boolean.TRUE, "alpha", "alph", "alp", "a", "unstable"),
29✔
22

23
  /**
24
   * A version for beta testing (should not have fundamental bugs like maybe in {@link #ALPHA} but still needs more testing).
25
   */
26
  BETA(Boolean.TRUE, "beta", "bet", "test"),
21✔
27

28
  /**
29
   * A "b" can be {@link #BETA} or {@link #BUILD} depending on the version scheme of the product. Please avoid such ambiguous
30
   * {@link VersionSegment#getLetters() letter-sequence}.
31
   */
32
  BETA_OR_BUILD(Boolean.TRUE, "b"),
13✔
33

34
  /** A build number (actually not a development phase like {@link #UNDEFINED}). */
35
  BUILD(Boolean.TRUE, "build"),
13✔
36

37
  /** A version that has passed quality gates but is in a phase for further end-user testing to collect feedback. */
38
  MILESTONE(Boolean.TRUE, "m", "milestone"),
17✔
39

40
  /**
41
   * A version close to the {@link #RELEASE} with expected good quality for final end-user testing and only relevant bugs will be fixed if found to come to the
42
   * final release (typically within a predefined time-frame).
43
   */
44
  RELEASE_CANDIDATE(Boolean.TRUE, "rc", "release-candidate", "candidate"),
21✔
45

46
  /** No phase specified. */
47
  NONE(Boolean.TRUE, ""),
13✔
48

49
  /** An official release that should have good quality. */
50
  RELEASE("release", "ga", "rel"),
20✔
51

52
  /** A bug-fix version from the previous release including important fix(es). */
53
  BUG_FIX(Boolean.TRUE, "bugfix", "fix", "quickfix"),
21✔
54

55
  /** An fix release, similar to {@link #BUG_FIX} but more urgent. */
56
  HOT_FIX(Boolean.TRUE, "hotfix", "hf");
17✔
57

58
  private final Boolean hasNumber;
59

60
  private final String[] ids;
61

62
  private VersionPhase(String... ids) {
4✔
63

64
    this.hasNumber = null;
3✔
65
    this.ids = ids;
3✔
66
  }
1✔
67

68
  private VersionPhase(Boolean hasNumber, String... ids) {
4✔
69

70
    this.hasNumber = hasNumber;
3✔
71
    this.ids = ids;
3✔
72
  }
1✔
73

74
  @Override
75
  public boolean isDevelopmentPhase() {
76

77
    return (this != UNDEFINED) && (this != NONE) && (this != REVISION) && (this != BUILD) && (this != BETA_OR_BUILD);
19!
78
  }
79

80
  /**
81
   * A valid combination of {@link VersionPhase} and {@link VersionSegment#getNumber() segment number} has to meet the following requirements:
82
   * <ul>
83
   * <li>{@link VersionPhase} is not {@link #UNDEFINED}.</li>
84
   * <li>{@link VersionPhase} is not {@link #BETA_OR_BUILD} ("b" is ambiguous and therefore discouraged).</li>
85
   * <li>The {@link VersionPhase}s {@link #REVISION}, {@link #ALPHA}, {@link #BETA}, {@link #BUILD}, {@link #MILESTONE},
86
   * {@link #RELEASE_CANDIDATE}, {@link #NONE}, {@link #BUG_FIX}, or {@link #HOT_FIX} have to be followed by
87
   * {@link VersionSegment#getDigits() digits} ({@link VersionSegment#getNumber() segment number} >= 0).</li>
88
   * ({@link VersionSegment#getNumber() segment number} == -1).</li>
89
   * </ul>
90
   *
91
   * @param number the {@link VersionSegment#getNumber() segment number}.
92
   * @return {@code true} if the combination of this {@link VersionPhase} with the given {@code number} is a valid according to version scheme best-practices.
93
   */
94
  public boolean isValid(int number) {
95

96
    if (this == UNDEFINED) {
3✔
97
      return false;
2✔
98
    }
99
    if (this.hasNumber != null) {
3✔
100
      if (this.hasNumber.booleanValue()) {
4!
101
        return (number >= 0);
6✔
102
      } else {
103
        return (number == -1);
×
104
      }
105
    }
106
    return true;
2✔
107
  }
108

109
  @Override
110
  public boolean isUnstable() {
111

112
    if (isDevelopmentPhase()) {
3✔
113
      if (ordinal() < NONE.ordinal()) {
5!
114
        return true;
2✔
115
      }
116
    }
117
    return false;
2✔
118
  }
119

120
  @Override
121
  public boolean isStable() {
122

123
    if (ordinal() >= NONE.ordinal()) {
5✔
124
      return true;
2✔
125
    }
126
    return false;
2✔
127

128
  }
129

130
  /**
131
   * @param letters the {@link VersionSegment#getLettersString() letter-sequence} of a {@link VersionSegment} in
132
   *     {@link String#toLowerCase(java.util.Locale) lower-case}.
133
   * @return the corresponding {@link VersionPhase}. Will be {@code #UNDEFINED} if undefined (e.g. "apple" or "banana").
134
   */
135
  public static VersionPhase of(String letters) {
136
    for (VersionPhase phase : values()) {
16✔
137
      for (String id : phase.ids) {
17✔
138
        if (id.equals(letters)) {
4✔
139
          return phase;
2✔
140
        }
141
      }
142
    }
143
    return UNDEFINED;
2✔
144
  }
145

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