elharo opened a new issue, #145:
URL: https://github.com/apache/maven-shared-jar/issues/145
In `JarIdentificationAnalysis.java:78-105`, the `normalize()` method uses
`pickSmallest()` to select the version and `pickLargest()` to select
artifactId/name/vendor:
```java
private String pickSmallest(List<String> values) {
String result = null;
for (String value : values) {
if (result == null || value.length() < result.length()) {
result = value;
}
}
return result;
}
private String pickLargest(List<String> values) {
String result = null;
for (String value : values) {
if (result == null || value.length() > result.length()) {
result = value;
}
}
return result;
}
```
These are arbitrary string-length-based heuristics:
- **For version**: `pickSmallest()` selects the shortest string. For
example, `"1.0"` (3 chars) would be chosen over `"1.0.3"` (5 chars) or
`"20030519"` (8 chars), potentially discarding the actual version.
- **For artifactId**: `pickLargest()` selects the longest match, which may
pick the most qualified but potentially incorrect name.
These heuristics can produce wrong results when multiple candidate values
are identified from different sources. A more robust approach would be needed
for reliable identification.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]