Don't remove constructor with super call

This commit is contained in:
Skylot
2013-04-18 23:36:39 +04:00
parent 550659d372
commit 76feab3f2a
2 changed files with 13 additions and 3 deletions
@@ -36,7 +36,8 @@ public class ClassModifier extends AbstractVisitor {
&& mth.getArguments(false).isEmpty()) {
List<BlockNode> bb = mth.getBasicBlocks();
if (bb.isEmpty() || (bb.size() == 1 && bb.get(0).getInstructions().isEmpty())) {
it.remove();
if (mth.getSuperCall() == null)
it.remove();
}
}
}
+11 -2
View File
@@ -5,6 +5,11 @@ public class TestInner extends AbstractTest {
public static int count = -2;
public static class MyThread extends Thread {
public MyThread(String name) {
super(name);
}
@Override
public void run() {
count++;
@@ -12,7 +17,7 @@ public class TestInner extends AbstractTest {
}
}
public static class MyInceptionThread extends Thread {
public static class MyInceptionThread extends MyThread {
public static class MyThread2 extends Thread {
@Override
@@ -21,6 +26,10 @@ public class TestInner extends AbstractTest {
}
}
public MyInceptionThread() {
super("MyInceptionThread");
}
@Override
public void run() {
MyThread2 thr = new MyThread2();
@@ -62,7 +71,7 @@ public class TestInner extends AbstractTest {
};
myRunnable.run();
MyThread thread = new TestInner.MyThread();
MyThread thread = new TestInner.MyThread("my thread");
thread.start();
MyInceptionThread thread2 = new TestInner.MyInceptionThread();