You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stage2/ml9: Improve workaround for incorrectly reported versions
There are really two independent issues, the `toString` and the fact
that it returns no version, which may happen independently.
As such, this commit also unwraps the `toString` result of non-empty
`Optional`s, and runs the fallback version reading code when the raw
version reported is already `null`.
// ModLauncher somehow manages to report the version of some jars (really unsure which ones, best guess
61
-
// right now is all those without a `FMLModType` manifest attribute? seemingly completely irregardless of
62
-
// whether they have an `Implementation-Version` attribute!)
63
-
// as "Optional.empty" (yes, that's a String, somewhere someone must have blindly `toString`ed).
64
-
// We'll just go fetch it ourselves then I guess.
65
-
if (version.equals("Optional.empty")) {
59
+
60
+
// Some revisions of ModLauncher have a bug where they simply call `toString` on `Optional<String>`, resulting
61
+
// in versions being reported as the string "Optional.empty" or "Optional[1.2.3]" instead of `null` or "1.2.3".
62
+
// See https://github.com/McModLauncher/securejarhandler/blob/7cd8481364d73bacecf2b608479c6b903bff7f6c/src/main/java/cpw/mods/jarhandling/impl/ModuleJarMetadata.java#L137
63
+
// We need to unwrap those to get at the real version.
64
+
if (version != null && version.equals("Optional.empty")) {
0 commit comments