-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a22e388
commit fecdf7d
Showing
10 changed files
with
463 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
java-api/src/java7/java/xyz/wagyourtail/jvmdg/j7/stub/J_L_Throwable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package xyz.wagyourtail.jvmdg.j7.stub; | ||
|
||
import xyz.wagyourtail.jvmdg.version.Modify; | ||
import xyz.wagyourtail.jvmdg.version.Ref; | ||
import xyz.wagyourtail.jvmdg.version.Stub; | ||
|
||
import java.util.*; | ||
|
||
public class J_L_Throwable { | ||
private static final Map<Throwable, List<Throwable>> suppressed = Collections.synchronizedMap(new WeakHashMap<Throwable, List<Throwable>>()); | ||
private static final Throwable[] empty = new Throwable[0]; | ||
|
||
@Stub | ||
public static void addSuppressed(Throwable self, Throwable other) { | ||
if (!suppressed.containsKey(self)) { | ||
synchronized (suppressed) { | ||
if (!suppressed.containsKey(self)) { | ||
suppressed.put(self, new ArrayList<Throwable>()); | ||
} | ||
} | ||
} | ||
suppressed.get(self).add(other); | ||
} | ||
|
||
@Stub | ||
public static Throwable[] getSuppressed(Throwable self) { | ||
if (!suppressed.containsKey(self)) { | ||
synchronized (suppressed) { | ||
if (!suppressed.containsKey(self)) { | ||
return empty; | ||
} | ||
} | ||
} | ||
return suppressed.get(self).toArray(empty); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
java-api/src/main/java/xyz/wagyourtail/jvmdg/providers/Java6Downgrader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package xyz.wagyourtail.jvmdg.providers; | ||
|
||
import org.objectweb.asm.Opcodes; | ||
import org.objectweb.asm.tree.AbstractInsnNode; | ||
import org.objectweb.asm.tree.ClassNode; | ||
import org.objectweb.asm.tree.MethodNode; | ||
import xyz.wagyourtail.jvmdg.ClassDowngrader; | ||
import xyz.wagyourtail.jvmdg.version.VersionProvider; | ||
|
||
import java.io.IOException; | ||
import java.util.Iterator; | ||
|
||
public class Java6Downgrader extends VersionProvider { | ||
|
||
public Java6Downgrader() { | ||
super(Opcodes.V1_6, Opcodes.V1_5, 0); | ||
} | ||
|
||
@Override | ||
public void ensureInit(ClassDowngrader downgrader) { | ||
if (!isInitialized()) { | ||
downgrader.logger.warn("Java 6 -> 5 Stubs are VERY incomplete!"); | ||
} | ||
super.ensureInit(downgrader); | ||
} | ||
|
||
@Override | ||
public void init() { | ||
|
||
} | ||
|
||
@Override | ||
public ClassNode otherTransforms(ClassNode clazz) throws IOException { | ||
for (MethodNode method : clazz.methods) { | ||
if (method.instructions != null) { | ||
Iterator<AbstractInsnNode> it = method.instructions.iterator(); | ||
while (it.hasNext()) { | ||
AbstractInsnNode insn = it.next(); | ||
if (insn.getType() == AbstractInsnNode.FRAME) { | ||
it.remove(); | ||
} | ||
} | ||
} | ||
} | ||
return super.otherTransforms(clazz); | ||
} | ||
|
||
} |
Oops, something went wrong.