Skip to content

Commit 78787bc

Browse files
committed
Remove deprecated features from default agent and allow it to reject
1 parent d396df0 commit 78787bc

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

src/main/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentDefault.java

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,36 @@
2424
*/
2525
package org.spongepowered.asm.launch.platform;
2626

27+
import org.spongepowered.asm.launch.platform.container.IContainerHandle;
2728
import org.spongepowered.asm.util.Constants.ManifestAttributes;
2829

2930
/**
3031
* Default platform agent, handles the mixin manifest keys such as
31-
* <tt>MixinConfigs</tt> and <tt>MixinTokenProviders</tt>.
32+
* <tt>MixinConfigs</tt> and <tt>MixinConnector</tt>.
33+
* CHANGED BY CLEANROOM:
34+
* Removed deprecated compatibility level, token providers manifest key support
35+
* Allow default agent to reject if no relevant manifest attributes are present
3236
*/
3337
public class MixinPlatformAgentDefault extends MixinPlatformAgentAbstract {
3438

39+
private String mixinConfigs, connectorClass;
40+
41+
@Override
42+
public AcceptResult accept(MixinPlatformManager manager, IContainerHandle handle) {
43+
this.mixinConfigs = this.handle.getAttribute(ManifestAttributes.MIXINCONFIGS);
44+
this.connectorClass = this.handle.getAttribute(ManifestAttributes.MIXINCONNECTOR);
45+
return this.mixinConfigs == null && this.connectorClass == null ? AcceptResult.REJECTED : super.accept(manager, handle);
46+
}
47+
3548
@Override
3649
public void prepare() {
37-
@SuppressWarnings("deprecation")
38-
String compatibilityLevel = this.handle.getAttribute(ManifestAttributes.COMPATIBILITY);
39-
if (compatibilityLevel != null) {
40-
this.manager.setCompatibilityLevel(compatibilityLevel);
41-
}
42-
43-
String mixinConfigs = this.handle.getAttribute(ManifestAttributes.MIXINCONFIGS);
44-
if (mixinConfigs != null) {
45-
for (String config : mixinConfigs.split(",")) {
50+
if (this.mixinConfigs != null) {
51+
for (String config : this.mixinConfigs.split(",")) {
4652
this.manager.addConfig(config.trim(), this.handle);
4753
}
4854
}
49-
50-
String tokenProviders = this.handle.getAttribute(ManifestAttributes.TOKENPROVIDERS);
51-
if (tokenProviders != null) {
52-
for (String provider : tokenProviders.split(",")) {
53-
this.manager.addTokenProvider(provider.trim());
54-
}
55-
}
56-
57-
String connectorClass = this.handle.getAttribute(ManifestAttributes.MIXINCONNECTOR);
58-
if (connectorClass != null) {
59-
this.manager.addConnector(connectorClass.trim());
55+
if (this.connectorClass != null) {
56+
this.manager.addConnector(this.connectorClass.trim());
6057
}
6158
}
6259

0 commit comments

Comments
 (0)