-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor: remove dead code #4016
refactor: remove dead code #4016
Conversation
...n/java/org/terasology/persistence/typeHandling/extensionTypes/ComponentClassTypeHandler.java
Outdated
Show resolved
Hide resolved
…xtensionTypes/ComponentClassTypeHandler.java
return context.getSandbox().getSubTypeIdentifier(item, Component.class); | ||
} | ||
|
||
@Override | ||
public Class<? extends Component> getFromString(String representation) { | ||
try { | ||
final Class<? extends Component> clazz = Class.forName(representation).asSubclass(Component.class); | ||
return clazz; | ||
} catch (ClassNotFoundException e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
return context.getSandbox().findSubTypeOf(representation, Component.class).orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only thing in this PR that's not just a straight deletion. And it looks okay from here.
It does change the constructor, but presumably that's the sort of thing that you'd find out pretty fast as soon as you tried to compile against it.
Actually ... where is this class used? it's not in my workspace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is actually some sneaky little code cleanup 🤓
This class here existed, but was never used. However, there existed another inner class with exact same name (and purpose) in ComponentClassTypeHandlerFactory
. As I don't like inner classes, I thought it would be better to have the correct code in this class, which is now used by the factory.
As @pollend found out in #3961 there are unused classes and other dead code in the engine.
Tested in Omega workspace, can run Josharias Survival without any (new) issues.