Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection of latest Java version is buggy #1367

Closed
hohwille opened this issue Nov 3, 2023 · 1 comment · Fixed by #1375
Closed

Detection of latest Java version is buggy #1367

hohwille opened this issue Nov 3, 2023 · 1 comment · Fixed by #1375
Assignees
Labels
bash related to bash shell or scripts bug Something isn't working functions related to the collection of bash functions in functions[-core] file java related to Java code, the Java Virtual Machine and directly related tooling (OpenJDK, Adoptium) setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) update related to updating software or the entire devonfw-ide

Comments

@hohwille
Copy link
Member

hohwille commented Nov 3, 2023

$ devon java version set 21
21.0.1_12  21_35

$ devon java version set 21*
JAVA_VERSION=21* has been set in /d/projects/mmm/settings/devon.properties
To install that version call the following command:
devon java setup

$ devon java setup
Updating java from version 17.0.8_7 to version 21_35...

Vising https://adoptium.net/ confirms that this is a bug and 21.0.1_12 is newer than 21_35.
Indeed an edge-case from the version compare function but with Java a very relevant one.
The problem is that semantics like . vs. _ are actually undefined.
However, if both versions have an underscore (_) it seems kind of natural to first compare the prefix part before the underscore and only if equal then compare the suffix part so:

  • 21.0.1 <=> 21 --> 21.0.1 > 21
  • only if it would be equal then compare 12 <=> 35 --> 12 < 35.

A remaining question would be the comparison of 21.0.1.12 with 21_35 and IMHO there can not be a clear answer as it may depend on the project/product creating these versions.

I guess for Java the suffix starting with the _ is some kind of build number.

@hohwille hohwille added bug Something isn't working bash related to bash shell or scripts setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) java related to Java code, the Java Virtual Machine and directly related tooling (OpenJDK, Adoptium) update related to updating software or the entire devonfw-ide functions related to the collection of bash functions in functions[-core] file labels Nov 3, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Nov 27, 2023
@hohwille
Copy link
Member Author

Suggestion:
Follow TDD with Red/Green pattern and first extend test-version-compare by adding the example from this story. Then this test should fail. After that try to implement the story and rerun the test until it is green.

@MattesMrzik MattesMrzik self-assigned this Jan 4, 2024
@MattesMrzik MattesMrzik moved this from 🆕 New to 🏗 In progress in IDEasy board Jan 4, 2024
MattesMrzik added a commit to MattesMrzik/ide that referenced this issue Jan 4, 2024
hohwille added a commit to MattesMrzik/ide that referenced this issue Jan 5, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in IDEasy board Jan 5, 2024
@hohwille hohwille added this to the release:2024.01.001 milestone Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bash related to bash shell or scripts bug Something isn't working functions related to the collection of bash functions in functions[-core] file java related to Java code, the Java Virtual Machine and directly related tooling (OpenJDK, Adoptium) setup related to the setup process of devonfw-ide (setup[.bat] and devon ... setup) update related to updating software or the entire devonfw-ide
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants