Version 0.8-preview

Add initial modlauncher support
Bump ASM version and remove renamed ASM for modlauncher interop
Conform static accessor target when transforming accessor, Fixes #342
Detect staticness mismatch on accessors, Fixes #341
Allow Invoker to invoke constructors, Closes #339
Remove commons-io and replace with guava, Fixes #327
Fix refmap generation for non-obfuscated derived classes, Fixes #326
Specify locale for case conversions, Fixes #315
Handle accessor overlap more intelligently, Fixes #307
Add SuppressWarnings support to Annotation Processor, Closes #306
Allow mixins applied to a class to be retrieved easily, Closes #302
Conform refmap entries as they are added to the mapper, fixes #296
Fold in misc lvt generation fixes from fabricmc, closes #295
Fail fast when final method is accidentally hidden by mixin, fixes #293
Fix bug handling 2-slot args in cb injector and args gen, fixes #287
Handle accessor mixin types correctly in mixins, Fixes #305, Fixes #288
This commit is contained in:
Mumfrey committed 2019-09-16 16:05:40 +01:00
1 parent ab935e061f
commit fd2f2c79c5
246 files changed
+10899 -3125

No files matched your search

@@ -24,9 +24,12 @@
*/
package org.spongepowered.asm.launch;
import java.util.ServiceLoader;
import java.util.HashMap;
import java.util.Map;
import org.spongepowered.asm.service.IGlobalPropertyService;
import org.spongepowered.asm.service.IPropertyKey;
import org.spongepowered.asm.service.MixinService;
/**
* Access to underlying global property service provided by the current
@@ -39,19 +42,56 @@ public final class GlobalProperties {
*/
public static final class Keys {
public static final String INIT = "mixin.initialised";
public static final String AGENTS = "mixin.agents";
public static final String CONFIGS = "mixin.configs";
public static final String TRANSFORMER = "mixin.transformer";
public static final String PLATFORM_MANAGER = "mixin.platform";
public static final Keys INIT = Keys.of("mixin.initialised");
public static final Keys AGENTS = Keys.of("mixin.agents");
public static final Keys CONFIGS = Keys.of("mixin.configs");
public static final Keys PLATFORM_MANAGER = Keys.of("mixin.platform");
public static final String FML_LOAD_CORE_MOD = "mixin.launch.fml.loadcoremodmethod";
public static final String FML_GET_REPARSEABLE_COREMODS = "mixin.launch.fml.reparseablecoremodsmethod";
public static final String FML_CORE_MOD_MANAGER = "mixin.launch.fml.coremodmanagerclass";
public static final String FML_GET_IGNORED_MODS = "mixin.launch.fml.ignoredmodsmethod";
public static final Keys FML_LOAD_CORE_MOD = Keys.of("mixin.launch.fml.loadcoremodmethod");
public static final Keys FML_GET_REPARSEABLE_COREMODS = Keys.of("mixin.launch.fml.reparseablecoremodsmethod");
public static final Keys FML_CORE_MOD_MANAGER = Keys.of("mixin.launch.fml.coremodmanagerclass");
public static final Keys FML_GET_IGNORED_MODS = Keys.of("mixin.launch.fml.ignoredmodsmethod");
private static Map<String, Keys> keys;
private final String name;
private IPropertyKey key;
private Keys() {}
private Keys(String name) {
this.name = name;
}
IPropertyKey resolve(IGlobalPropertyService service) {
if (this.key != null) {
return this.key;
}
if (service == null) {
return null;
}
return this.key = service.resolveKey(this.name);
}
/**
* Get or create a new global property key
*
* @param name name of key to get or create
* @return new or existing key
*/
public static Keys of(String name) {
if (Keys.keys == null) {
Keys.keys = new HashMap<String, Keys>();
}
Keys key = Keys.keys.get(name);
if (key == null) {
key = new Keys(name);
Keys.keys.put(name, key);
}
return key;
}
}
private static IGlobalPropertyService service;
@@ -60,9 +100,7 @@ public final class GlobalProperties {
private static IGlobalPropertyService getService() {
if (GlobalProperties.service == null) {
ServiceLoader<IGlobalPropertyService> serviceLoader =
ServiceLoader.<IGlobalPropertyService>load(IGlobalPropertyService.class, GlobalProperties.class.getClassLoader());
GlobalProperties.service = serviceLoader.iterator().next();
GlobalProperties.service = MixinService.getGlobalPropertyService();
}
return GlobalProperties.service;
}
@@ -74,8 +112,9 @@ public final class GlobalProperties {
* @param <T> duck type
* @return value
*/
public static <T> T get(String key) {
return GlobalProperties.getService().<T>getProperty(key);
public static <T> T get(Keys key) {
IGlobalPropertyService service = GlobalProperties.getService();
return service.<T>getProperty(key.resolve(service));
}
/**
@@ -84,8 +123,9 @@ public final class GlobalProperties {
* @param key blackboard key
* @param value new value
*/
public static void put(String key, Object value) {
GlobalProperties.getService().setProperty(key, value);
public static void put(Keys key, Object value) {
IGlobalPropertyService service = GlobalProperties.getService();
service.setProperty(key.resolve(service), value);
}
/**
@@ -97,8 +137,9 @@ public final class GlobalProperties {
* @param <T> duck type
* @return value from blackboard or default value
*/
public static <T> T get(String key, T defaultValue) {
return GlobalProperties.getService().getProperty(key, defaultValue);
public static <T> T get(Keys key, T defaultValue) {
IGlobalPropertyService service = GlobalProperties.getService();
return service.getProperty(key.resolve(service), defaultValue);
}
/**
@@ -110,8 +151,9 @@ public final class GlobalProperties {
* set or is null
* @return value from blackboard or default
*/
public static String getString(String key, String defaultValue) {
return GlobalProperties.getService().getPropertyString(key, defaultValue);
public static String getString(Keys key, String defaultValue) {
IGlobalPropertyService service = GlobalProperties.getService();
return service.getPropertyString(key.resolve(service), defaultValue);
}
}