Please review this small fix.

**Problem:**

After parsing the version number, the parser enters the pre-release parsing 
loop regardless of whether the delimiter was `-` or `+`. As a result, 
build-only versions such as `1+1` are parsed as pre-release versions, causing 
`1+1` to compare equal to `1-1`.

**Fix:**

Record whether the version number ended with `-`, and only parse the 
pre-release component in that case. If it ended with `+`, proceed directly to 
the build component.

**Testing:**

- Added regression cases to `VersionTest.java`.
- `make test TEST=test/jdk/java/lang/module`: 17 passed, 0 failed.




---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8250677: ModuleDescriptor.Version parsing treats pre-release identically to 
build

Changes: https://git.openjdk.org/jdk/pull/32715/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32715&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8250677
  Stats: 10 lines in 2 files changed: 7 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/32715.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32715/head:pull/32715

PR: https://git.openjdk.org/jdk/pull/32715

Reply via email to