aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src/test
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2021-11-30 07:37:07 -0800
committerGitHub <noreply@github.com>2021-11-30 07:37:07 -0800
commit7a10203a7c9c846b6778c269cb529242b893149d (patch)
treeb1f5e5c734894aa94ab1de3bef9e814fdbc028bf /bcel-builder/src/test
parent5abc2f1dce1e97b92acc5562b3c5fa32cf0abb5d (diff)
parent7cec6ee4dae90cb30d750cd1e0451665383d871f (diff)
downloadaspectj-7a10203a7c9c846b6778c269cb529242b893149d.tar.gz
aspectj-7a10203a7c9c846b6778c269cb529242b893149d.zip
Merge pull request #102 from turbanoff/trim_trailing_whitespaces
Trim trailing whitespaces.
Diffstat (limited to 'bcel-builder/src/test')
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ClassloaderRepositoryTest.java14
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/Fundamentals.java42
-rw-r--r--bcel-builder/src/test/java/org/aspectj/apache/bcel/util/Play.java4
3 files changed, 30 insertions, 30 deletions
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ClassloaderRepositoryTest.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ClassloaderRepositoryTest.java
index 7202be3fa..05e9f8f73 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ClassloaderRepositoryTest.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/ClassloaderRepositoryTest.java
@@ -14,7 +14,7 @@ import junit.framework.TestCase;
public class ClassloaderRepositoryTest extends TestCase {
private ClassLoaderRepository rep1,rep2;
-
+
public void setUp() throws Exception {
super.setUp();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -25,7 +25,7 @@ public class ClassloaderRepositoryTest extends TestCase {
}
// Retrieve string 5 times from same repository, 4 hits should be from local cache
- public void testLocalCacheWorks() throws ClassNotFoundException {
+ public void testLocalCacheWorks() throws ClassNotFoundException {
ClassLoaderRepository.useSharedCache=false;
JavaClass jc = rep1.loadClass("java.lang.String");
jc = rep1.loadClass("java.lang.String");
@@ -36,7 +36,7 @@ public class ClassloaderRepositoryTest extends TestCase {
}
// Retrieve string 5 times from same repository, 4 hits should be from local cache
- public void testSharedCacheWorksOnOne() throws ClassNotFoundException {
+ public void testSharedCacheWorksOnOne() throws ClassNotFoundException {
ClassLoaderRepository.useSharedCache=true;
JavaClass jc = rep1.loadClass("java.lang.String");
jc = rep1.loadClass("java.lang.String");
@@ -47,16 +47,16 @@ public class ClassloaderRepositoryTest extends TestCase {
}
// Retrieve String through one repository then load again through another, should be shared cache hit
- public void testSharedCacheWorks() throws ClassNotFoundException {
+ public void testSharedCacheWorks() throws ClassNotFoundException {
ClassLoaderRepository.useSharedCache=true;
JavaClass jc = rep1.loadClass("java.lang.String");
jc = rep2.loadClass("java.lang.String");
assertTrue("Should have retrieved String from shared cache: "+reportSharedCacheHits(rep1),
reportSharedCacheHits(rep1)==1);
}
-
+
// Shared cache OFF, shouldn't get a shared cache hit
- public void testSharedCacheCanBeDeactivated() throws ClassNotFoundException {
+ public void testSharedCacheCanBeDeactivated() throws ClassNotFoundException {
try {
ClassLoaderRepository.useSharedCache=false;
JavaClass jc = rep1.loadClass("java.lang.String");
@@ -68,7 +68,7 @@ public class ClassloaderRepositoryTest extends TestCase {
ClassLoaderRepository.useSharedCache=true;
}
}
-
+
public void tearDown() throws Exception {
super.tearDown();
System.err.println("Rep1: "+rep1.reportStats());
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/Fundamentals.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/Fundamentals.java
index c54beb5b3..c47e60e37 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/Fundamentals.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/classfile/tests/Fundamentals.java
@@ -22,10 +22,10 @@ import junit.framework.TestCase;
// Check things that have to be true based on the specification
public class Fundamentals extends TestCase {
-
+
// Checking: opcode, length, consumed stack entries, produced stack entries
public void testInstructions() {
-
+
// Instructions 000-009
checkInstruction(InstructionConstants.NOP,0,1,0,0);
checkInstruction(InstructionConstants.ACONST_NULL,1,1,0,1);
@@ -49,7 +49,7 @@ public class Fundamentals extends TestCase {
checkInstruction(new InstructionShort(Constants.SIPUSH,s0),17,3,0,1);
checkInstruction(new InstructionCP(Constants.LDC,b0),18,2,0,1);
checkInstruction(new InstructionCP(Constants.LDC_W,s0),19,2,0,1);
-
+
// Instructions 020-029
checkInstruction(new InstructionCP(Constants.LDC2_W,s0),20,3,0,2);
checkInstruction(new InstructionLV(Constants.ILOAD,s20),21,2,0,1);
@@ -61,7 +61,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.ILOAD_1,27,1,0,1);
checkInstruction(InstructionConstants.ILOAD_2,28,1,0,1);
checkInstruction(InstructionConstants.ILOAD_3,29,1,0,1);
-
+
// Instructions 030-039
checkInstruction(InstructionConstants.LLOAD_0,30,1,0,2);
checkInstruction(InstructionConstants.LLOAD_1,31,1,0,2);
@@ -73,7 +73,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.FLOAD_3,37,1,0,1);
checkInstruction(InstructionConstants.DLOAD_0,38,1,0,2);
checkInstruction(InstructionConstants.DLOAD_1,39,1,0,2);
-
+
// Instructions 040-049
checkInstruction(InstructionConstants.DLOAD_2,40,1,0,2);
checkInstruction(InstructionConstants.DLOAD_3,41,1,0,2);
@@ -97,7 +97,7 @@ public class Fundamentals extends TestCase {
checkInstruction(new InstructionLV(Constants.DSTORE,s20),57,2,2,0);
checkInstruction(new InstructionLV(Constants.ASTORE,s20),58,2,1,0);
checkInstruction(InstructionConstants.ISTORE_0,59,1,1,0);
-
+
// Instructions 060-069
checkInstruction(InstructionConstants.ISTORE_1,60,1,1,0);
checkInstruction(InstructionConstants.ISTORE_2,61,1,1,0);
@@ -109,7 +109,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.FSTORE_0,67,1,1,0);
checkInstruction(InstructionConstants.FSTORE_1,68,1,1,0);
checkInstruction(InstructionConstants.FSTORE_2,69,1,1,0);
-
+
// Instructions 070-079
checkInstruction(InstructionConstants.FSTORE_3,70,1,1,0);
checkInstruction(InstructionConstants.DSTORE_0,71,1,2,0);
@@ -121,7 +121,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.ASTORE_2,77,1,1,0);
checkInstruction(InstructionConstants.ASTORE_3,78,1,1,0);
checkInstruction(InstructionConstants.IASTORE,79,1,3,0);
-
+
// Instructions 080-089
checkInstruction(InstructionConstants.LASTORE,80,1,4,0);
checkInstruction(InstructionConstants.FASTORE,81,1,3,0);
@@ -133,7 +133,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.POP,87,1,1,0);
checkInstruction(InstructionConstants.POP2,88,1,2,0);
checkInstruction(InstructionConstants.DUP,89,1,1,2);
-
+
// Instructions 090-099
checkInstruction(InstructionConstants.DUP_X1,90,1,2,3);
checkInstruction(InstructionConstants.DUP_X2,91,1,3,4);
@@ -157,7 +157,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.DMUL,107,1,4,2);
checkInstruction(InstructionConstants.IDIV,108,1,2,1);
checkInstruction(InstructionConstants.LDIV,109,1,4,2);
-
+
// Instructions 110-119
checkInstruction(InstructionConstants.FDIV,110,1,2,1);
checkInstruction(InstructionConstants.DDIV,111,1,4,2);
@@ -169,7 +169,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.LNEG,117,1,2,2);
checkInstruction(InstructionConstants.FNEG,118,1,1,1);
checkInstruction(InstructionConstants.DNEG,119,1,2,2);
-
+
// Instructions 120-129
checkInstruction(InstructionConstants.ISHL,120,1,2,1);
checkInstruction(InstructionConstants.LSHL,121,1,3,2);
@@ -181,7 +181,7 @@ public class Fundamentals extends TestCase {
checkInstruction(InstructionConstants.LAND,127,1,4,2);
checkInstruction(InstructionConstants.IOR,128,1,2,1);
checkInstruction(InstructionConstants.LOR,129,1,4,2);
-
+
// Instructions 130-139
checkInstruction(InstructionConstants.IXOR,130,1,2,1);
checkInstruction(InstructionConstants.LXOR,131,1,4,2);
@@ -229,7 +229,7 @@ public class Fundamentals extends TestCase {
checkInstruction(new InstructionBranch(Constants.GOTO,s0),167,3,0,0);
checkInstruction(new InstructionBranch(Constants.JSR,s0),168,3,0,1);
checkInstruction(new RET(0,false),169,2,0,0);
-
+
// Instructions 170-179
checkInstruction(new TABLESWITCH(new int[]{},new InstructionHandle[]{},null),170,VARIES,1,0);
checkInstruction(new LOOKUPSWITCH(new int[]{},new InstructionHandle[]{},null),171,VARIES,1,0);
@@ -265,19 +265,19 @@ public class Fundamentals extends TestCase {
checkInstruction(new MULTIANEWARRAY(s0,b0),197,4,VARIES,1);
checkInstruction(new InstructionBranch(Constants.IFNULL,s0),198,3,1,0);
checkInstruction(new InstructionBranch(Constants.IFNONNULL,s0),199,3,1,0);
-
- // Instructions 200-209
+
+ // Instructions 200-209
checkInstruction(new InstructionBranch(Constants.GOTO_W,0),200,5,0,0);
checkInstruction(new InstructionBranch(Constants.JSR_W,0),201,5,0,1);
-
+
// Internally used instructions skipped
}
-
+
public void checkInstruction(Instruction i,int opcode, int length, int stackConsumed, int stackProduced) {
String header = new String("Checking instruction '"+i+"' ");
if (i.opcode!=opcode)
fail(header+" expected opcode "+opcode+" but it is "+i.opcode);
-
+
if (length!=VARIES && i.getLength()!=length)
fail(header+" expected length "+length+" but it is "+i.getLength());
// if (stackConsumed>0) {
@@ -290,7 +290,7 @@ public class Fundamentals extends TestCase {
if (stackConsumed==VARIES) {
if (Constants.CONSUME_STACK[opcode]!=Constants.UNPREDICTABLE)
fail("Instruction '"+i+"' should be consuming some unpredictable number of stack entries but it says it will consume "+Constants.CONSUME_STACK[opcode]);
-
+
} else {
if (Constants.CONSUME_STACK[opcode]!=stackConsumed)
fail("Instruction '"+i+"' should be consuming "+stackConsumed+" stack entries but it says it will consume "+Constants.CONSUME_STACK[opcode]);
@@ -305,8 +305,8 @@ public class Fundamentals extends TestCase {
if (stackProduced==VARIES) {
if (Constants.stackEntriesProduced[opcode]!=Constants.UNPREDICTABLE)
fail(header+" should be producing some unpredictable number of stack entries but it says it will produce "+Constants.stackEntriesProduced[opcode]);
-
- } else {
+
+ } else {
if (Constants.stackEntriesProduced[opcode]!=stackProduced)
fail(header+" should be producing "+stackProduced+" stack entries but it says it will produce "+Constants.stackEntriesProduced[opcode]);
}
diff --git a/bcel-builder/src/test/java/org/aspectj/apache/bcel/util/Play.java b/bcel-builder/src/test/java/org/aspectj/apache/bcel/util/Play.java
index abea68c1d..2db809184 100644
--- a/bcel-builder/src/test/java/org/aspectj/apache/bcel/util/Play.java
+++ b/bcel-builder/src/test/java/org/aspectj/apache/bcel/util/Play.java
@@ -11,7 +11,7 @@ import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnos;
public class Play {
-
+
public static void printBytes(byte[] bs) {
StringBuilder sb = new StringBuilder("Bytes:"+bs.length+"[");
for (int i=0;i<bs.length;i++) {
@@ -21,7 +21,7 @@ public class Play {
sb.append("]");
System.out.println(sb);
}
-
+
public static void main(String[] args) throws Exception {
if (args==null || args.length==0 ) {
System.out.println("Specify a file");