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

devonfw / IDEasy / 28790126080

06 Jul 2026 12:03PM UTC coverage: 71.844% (+0.01%) from 71.83%
28790126080

push

github

web-flow
#1178: Clean up and Solution for new qualifier snapshot (#2057)

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>

4785 of 7350 branches covered (65.1%)

Branch coverage included in aggregate %.

12257 of 16371 relevant lines covered (74.87%)

3.17 hits per line

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

88.57
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 != NONE) && (this != REVISION) && (this != BUILD) && (this != BETA_OR_BUILD);
16!
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
    return !isStable();
×
113
  }
114

115
  @Override
116
  public boolean isStable() {
117

118
    if ((ordinal() >= NONE.ordinal()) || !isDevelopmentPhase()) {
8✔
119
      return true;
2✔
120
    }
121
    return false;
2✔
122

123
  }
124

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

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