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

Update ClassLoaderFixer to v2 #29

Open
wants to merge 1 commit into
base: 1.3.2-forge
Choose a base branch
from

Conversation

ThexXTURBOXx
Copy link
Contributor

Today I released ClassLoaderFixer 2. Most changes here are not really necessary, but I still applied some of them to be consistent :)
By the way, this exact same class also works for every version up to 1.4.5 - so feel free to incorporate it in every version up until then.
At least public static String FIXER_VERSION = "2"; would be important to add everywhere to tell Block Helper to shut up (otherwise it warns the user everytime that he needs a proper RelaunchClassLoader implementation - even though it is indeed fine)

Copy link
Member

@halotroop2288 halotroop2288 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of these style changes are unnecessary. It seems like very little of this was actually related to updating the dependency.

public RelaunchClassLoader() {
super(new URL[0], FMLRelauncher.class.getClassLoader());
this.sources = new ArrayList<>();
this.parent = this.getClass().getClassLoader();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'mon man.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh, get off your high horse. If you think this is unnecessary, just close this PR without any comment. But don't spend your time writing such comments if the explanation is already there in the premise of the PR.

this.addTransformerExclusion("cpw.mods.fml.common.asm.SideOnly");
this.addTransformerExclusion("cpw.mods.fml.common.Side");
this.addTransformerExclusion("fr.catcore.fabricatedforge.");
this.addClassLoaderExclusion("com.llamalad7.mixinextras.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did these become static? If not, just leave it be...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

// Class<?> cl = super.findClass(name);
// cachedClasses.put(name, cl);
// return cl;
// try
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point in adding yet more commented out code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the codebase consistent. Explains the working principle behind ClassLoaderFixer. If it's unnecessary, then this entire commented out code snippet should have already been removed ages ago

@@ -14,13 +14,11 @@
package cpw.mods.fml.relauncher;

import java.net.*;
import java.security.CodeSigner;
import java.security.CodeSource;
import java.util.jar.Attributes.Name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like an unnecessary style chane, to change this to an inner class import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary? Might be. Just copy-pasted from my ClassLoaderFixer source code.

public void addURL(URL url) {
super.addURL(url);

FabricLauncherBase.getLauncher().addToClassPath(UrlUtil.asPath(url));

this.sources.add(url);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, why would you remove this? It's making the type of call clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as one of the above here

@ThexXTURBOXx
Copy link
Contributor Author

Most changes here are not really necessary, but I still applied some of them to be consistent

Copy link
Contributor Author

@ThexXTURBOXx ThexXTURBOXx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, feel free to just close this PR without any comment or feel free to merge it. It's your decision. As already said in the description of this PR: Incrementing the FIXER_VERSION to 2 is the only important change in this PR. The rest would just have made the codebase more consistent with the original ClassLoaderFixer.
And as already said, just add the FIXER_VERSION line to all the versions between 1.3.1 and 1.4.5 (since the first Forge version for 1.4.6 already fixed it and makes ClassLoaderFixer unnecessary).

@@ -14,13 +14,11 @@
package cpw.mods.fml.relauncher;

import java.net.*;
import java.security.CodeSigner;
import java.security.CodeSource;
import java.util.jar.Attributes.Name;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary? Might be. Just copy-pasted from my ClassLoaderFixer source code.

public RelaunchClassLoader() {
super(new URL[0], FMLRelauncher.class.getClassLoader());
this.sources = new ArrayList<>();
this.parent = this.getClass().getClassLoader();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh, get off your high horse. If you think this is unnecessary, just close this PR without any comment. But don't spend your time writing such comments if the explanation is already there in the premise of the PR.

this.addTransformerExclusion("cpw.mods.fml.common.asm.SideOnly");
this.addTransformerExclusion("cpw.mods.fml.common.Side");
this.addTransformerExclusion("fr.catcore.fabricatedforge.");
this.addClassLoaderExclusion("com.llamalad7.mixinextras.");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

// Class<?> cl = super.findClass(name);
// cachedClasses.put(name, cl);
// return cl;
// try
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the codebase consistent. Explains the working principle behind ClassLoaderFixer. If it's unnecessary, then this entire commented out code snippet should have already been removed ages ago

public void addURL(URL url) {
super.addURL(url);

FabricLauncherBase.getLauncher().addToClassPath(UrlUtil.asPath(url));

this.sources.add(url);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as one of the above here

@thecatcore
Copy link
Member

Thanks for the contribution.
I'm currently working on a possible v2 of Fabricated-Legacy-Forge, if I'm successful with the rewrite I'll include it in v2 directly.

@ThexXTURBOXx
Copy link
Contributor Author

Perfect, thank you very much and good luck! :)
Let me know if you need something!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants