Fix issue with LVT generation involving arrays, version bump to 0.4.2

This commit is contained in:
Mumfrey committed 2015-05-19 13:36:17 +01:00
1 parent 181eeca6d0
commit e743c1450f
4 files changed
+39 -29

No files matched your search

@@ -60,7 +60,7 @@ public abstract class MixinBootstrap {
/**
* Subsystem version
*/
public static final String VERSION = "0.4.1";
public static final String VERSION = "0.4.2";
/**
* Blackboard key where the subsystem version will be stored to indicate
@@ -1365,4 +1365,21 @@ public class ClassInfo extends TreeInfo {
return info;
}
/**
* Return a ClassInfo for the specified class type, fetches the ClassInfo
* from the cache where possible and generates the class meta if not.
*
* @param type Type to look up
* @return ClassInfo for the supplied type or null if the supplied type
* cannot be found or is a primitive type
*/
public static ClassInfo forType(org.spongepowered.asm.lib.Type type) {
if (type.getSort() == org.spongepowered.asm.lib.Type.ARRAY) {
return ClassInfo.forType(type.getElementType());
} else if (type.getSort() < org.spongepowered.asm.lib.Type.ARRAY) {
return null;
}
return ClassInfo.forName(type.getClassName().replace('.', '/'));
}
}
@@ -49,61 +49,54 @@ public class MixinVerifier extends SimpleVerifier {
}
@Override
protected boolean isInterface(final Type t) {
if (this.currentClass != null && t.equals(this.currentClass)) {
protected boolean isInterface(final Type type) {
if (this.currentClass != null && type.equals(this.currentClass)) {
return this.isInterface;
}
return this.getClassInfo(t).isInterface();
return ClassInfo.forType(type).isInterface();
}
@Override
protected Type getSuperClass(final Type t) {
if (this.currentClass != null && t.equals(this.currentClass)) {
protected Type getSuperClass(final Type type) {
if (this.currentClass != null && type.equals(this.currentClass)) {
return this.currentSuperClass;
}
ClassInfo c = this.getClassInfo(t).getSuperClass();
ClassInfo c = ClassInfo.forType(type).getSuperClass();
return c == null ? null : Type.getType("L" + c.getName() + ";");
}
@Override
protected boolean isAssignableFrom(final Type t, final Type u) {
if (t.equals(u)) {
protected boolean isAssignableFrom(final Type type, final Type other) {
if (type.equals(other)) {
return true;
}
if (this.currentClass != null && t.equals(this.currentClass)) {
if (this.getSuperClass(u) == null) {
if (this.currentClass != null && type.equals(this.currentClass)) {
if (this.getSuperClass(other) == null) {
return false;
}
if (this.isInterface) {
return u.getSort() == Type.OBJECT || u.getSort() == Type.ARRAY;
return other.getSort() == Type.OBJECT || other.getSort() == Type.ARRAY;
}
return this.isAssignableFrom(t, this.getSuperClass(u));
return this.isAssignableFrom(type, this.getSuperClass(other));
}
if (this.currentClass != null && u.equals(this.currentClass)) {
if (this.isAssignableFrom(t, this.currentSuperClass)) {
if (this.currentClass != null && other.equals(this.currentClass)) {
if (this.isAssignableFrom(type, this.currentSuperClass)) {
return true;
}
if (this.currentClassInterfaces != null) {
for (int i = 0; i < this.currentClassInterfaces.size(); ++i) {
Type v = this.currentClassInterfaces.get(i);
if (this.isAssignableFrom(t, v)) {
if (this.isAssignableFrom(type, v)) {
return true;
}
}
}
return false;
}
ClassInfo tc = this.getClassInfo(t);
if (tc.isInterface()) {
tc = ClassInfo.forName("java/lang/Object");
ClassInfo typeInfo = ClassInfo.forType(type);
if (typeInfo.isInterface()) {
typeInfo = ClassInfo.forName("java/lang/Object");
}
return this.getClassInfo(u).hasSuperClass(tc);
}
protected ClassInfo getClassInfo(final Type t) {
if (t.getSort() == Type.ARRAY) {
return ClassInfo.forName(t.getDescriptor().replace('/', '.'));
}
return ClassInfo.forName(t.getClassName().replace('.', '/'));
return ClassInfo.forType(other).hasSuperClass(typeInfo);
}
}