Fix up all build errors and warnings up to JDK7

This commit is contained in:
Mumfrey committed 2015-01-15 14:15:45 +00:00
1 parent c73ba14656
commit 5ee69a22a2
7 files changed
+36 -33

No files matched your search

@@ -204,13 +204,15 @@ class MixinConfig implements Comparable<MixinConfig> {
this.initialiseMixins(this.mixinClasses, false);
switch (MixinEnvironment.getCurrentEnvironment().getSide()) {
case CLIENT :
case CLIENT:
this.initialiseMixins(this.mixinClassesClient, false);
break;
case SERVER :
case SERVER:
this.initialiseMixins(this.mixinClassesServer, false);
break;
case UNKNOWN :
case UNKNOWN:
//$FALL-THROUGH$
default:
this.logger.warn("Mixin environment was unable to detect the current side, sided mixins will not be applied");
break;
}
@@ -271,13 +271,13 @@ public class MixinData {
* @param annotation
* @param key
* @param annotationClass
* @return
* @return Value of the specified annotation node, default value if not specified, or null if no value or default
*/
private static String getAnnotationValue(AnnotationNode annotation, String key, Class<?> annotationClass) {
String value = ASMHelper.getAnnotationValue(annotation, key);
if (value == null) {
try {
value = (String)Shadow.class.getDeclaredMethod(key).getDefaultValue();
value = (String)annotationClass.getDeclaredMethod(key).getDefaultValue();
} catch (NoSuchMethodException ex) {
// Don't care
}
@@ -295,7 +295,7 @@ public class MixinTransformer extends TreeTransformer {
* @param transformedName
* @param basicClass
* @param mixins
* @return
* @return class bytecode after application of mixins
*/
private byte[] applyMixins(String transformedName, byte[] basicClass, SortedSet<MixinInfo> mixins) {
// Tree for target class
@@ -459,7 +459,6 @@ public class MixinTransformer extends TreeTransformer {
* @param mixin
* @param target
* @param method
* @return
*/
private void transformMethod(MixinData mixin, ClassNode target, MethodNode method) {
String fromClass = mixin.getClassRef();
@@ -519,14 +518,14 @@ public class MixinTransformer extends TreeTransformer {
if (target != null) {
AnnotationNode merged = ASMHelper.getVisibleAnnotation(target, MixinMerged.class);
if (merged != null) {
String sessionId = ASMHelper.getAnnotationValue(merged, "sessionId");
String sessionId = ASMHelper.<String>getAnnotationValue(merged, "sessionId");
if (!this.sessionId.equals(sessionId)) {
throw new ClassFormatError("Invalid @MixinMerged annotation found in" + mixin + " at " + method.name + " in " + targetClass.name);
}
String owner = ASMHelper.getAnnotationValue(merged, "mixin");
int priority = ASMHelper.getAnnotationValue(merged, "priority");
String owner = ASMHelper.<String>getAnnotationValue(merged, "mixin");
int priority = ASMHelper.<Integer>getAnnotationValue(merged, "priority");
if (priority >= mixin.getPriority() && !owner.equals(mixin.getClassName())) {
this.logger.warn("Method overwrite conflict for {}, previously written by {}. Skipping method.", method.name, owner);
@@ -646,7 +645,7 @@ public class MixinTransformer extends TreeTransformer {
* Identifies line numbers in the supplied ctor which correspond to the start and end of the method body.
*
* @param ctor
* @return
* @return range indicating the line numbers of the specified constructor and the position of the superclass ctor invocation
*/
private Range getConstructorRange(MethodNode ctor) {
int line = 0, start = 0, end = 0, superIndex = -1;
@@ -673,7 +672,7 @@ public class MixinTransformer extends TreeTransformer {
*
* @param mixin
* @param ctor
* @return
* @return initialiser bytecode extracted from the supplied constructor, or null if the constructor range could not be parsed
*/
private InsnList getInitialiser(MethodNode ctor) {
// Find the range of line numbers which corresponds to the constructor body
@@ -767,7 +766,7 @@ public class MixinTransformer extends TreeTransformer {
*
* @param targetClass
* @param searchFor
* @return
* @return Target method matching searchFor, or null if not found
*/
private MethodNode findTargetMethod(ClassNode targetClass, MethodNode searchFor) {
for (MethodNode target : targetClass.methods) {
@@ -784,7 +783,7 @@ public class MixinTransformer extends TreeTransformer {
*
* @param targetClass
* @param searchFor
* @return
* @return Target field matching searchFor, or null if not found
*/
private FieldNode findTargetField(ClassNode targetClass, FieldNode searchFor) {
for (FieldNode target : targetClass.fields) {
@@ -801,7 +800,7 @@ public class MixinTransformer extends TreeTransformer {
*
* @param method
* @param flag
* @return
* @return True if the specified flag is set in this method's access flags
*/
private static boolean hasFlag(MethodNode method, int flag) {
return (method.access & flag) == flag;
@@ -812,7 +811,7 @@ public class MixinTransformer extends TreeTransformer {
*
* @param field
* @param flag
* @return
* @return True if the specified flag is set in this field's access flags
*/
private static boolean hasFlag(FieldNode field, int flag) {
return (field.access & flag) == flag;
@@ -67,7 +67,7 @@ abstract class TreeInfo {
/**
* @param classBytes
* @param flags
* @return
* @return ASM Tree view of the specified class
*/
static ClassNode getClassNode(byte[] classBytes, int flags) {
ClassNode classNode = new ClassNode();
@@ -79,7 +79,7 @@ abstract class TreeInfo {
/**
* @param className
* @param runTransformers
* @return
* @return Transformed class bytecode for the specified class
*/
static byte[] loadClass(String className, boolean runTransformers) throws ClassNotFoundException, IOException {
className = className.replace('/', '.');
@@ -97,8 +97,8 @@ abstract class TreeInfo {
}
/**
* @param className
* @return
* @param className Name of the class to load
* @return raw class bytecode
* @throws IOException
*/
private static byte[] getClassBytes(String className) throws IOException {
@@ -126,7 +126,7 @@ abstract class TreeInfo {
*
* @param name
* @param basicClass
* @return
* @return class bytecode after processing by all registered transformers except re-entrant transformers
*/
private static byte[] applyTransformers(String name, byte[] basicClass) {
final List<IClassTransformer> transformers = Launch.classLoader.getTransformers();
@@ -144,7 +144,7 @@ abstract class TreeInfo {
* Map a class name back to its obfuscated counterpart
*
* @param className
* @return
* @return obfuscated name for the specified deobfuscated reference
*/
static String unmap(String className) {
if (TreeInfo.nameTransformer != null) {
@@ -392,9 +392,20 @@ public class ASMHelper {
method.invisibleAnnotations = ASMHelper.addAnnotation(method.invisibleAnnotations, node);
}
/**
* Create a new annotation node with the supplied values
*
* @param annotationType Name (internal name) of the annotation interface to create
* @param value Interleaved key/value pairs. Keys must be strings
* @return new annotation node
*/
private static AnnotationNode makeAnnotationNode(String annotationType, Object... value) {
AnnotationNode node = new AnnotationNode(annotationType);
for (int pos = 0; pos < value.length - 1; pos += 2) {
if (!(value[pos] instanceof String)) {
throw new IllegalArgumentException("Annotation keys must be strings, found " + value[pos].getClass().getSimpleName()
+ " with " + value[pos].toString() + " at index " + pos + " creating " + annotationType);
}
node.visit((String)value[pos], value[pos + 1]);
}
return node;
@@ -410,16 +421,6 @@ public class ASMHelper {
return annotations;
}
/**
* Get an invisible annotation of the specified class from the supplied field node
*
* @param field Source field
* @param annotationClass Type of annotation to search for
* @return the annotation, or null if not present
*/
public static void setInvisibleAnnotation(FieldNode field, Class<? extends Annotation> annotationClass) {
}
/**
* Get a runtime-visible annotation of the specified class from the supplied field node
*