]> source.dussan.org Git - aspectj.git/commitdiff
312839: smaller class files
authoraclement <aclement>
Wed, 19 May 2010 15:13:01 +0000 (15:13 +0000)
committeraclement <aclement>
Wed, 19 May 2010 15:13:01 +0000 (15:13 +0000)
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ConstantPoolSimulator.java [new file with mode: 0644]
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/DeclareErrorOrWarningTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ModifiersPatternTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/NamePatternTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternMatchSpeedTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/SignaturePatternTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternListTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/TypePatternTestCase.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/WithinTestCase.java

index 44d8d2b04efbae0c7d3d535a812fda8d368cdb1b..909db8e6ab09703105decbae30f9f9e111e24fa3 100644 (file)
@@ -81,12 +81,13 @@ public class AndOrNotTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                Pointcut p = makePointcut(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                Pointcut newP = Pointcut.read(in, null);
 
                assertEquals("write/read", p, newP);
diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ConstantPoolSimulator.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/ConstantPoolSimulator.java
new file mode 100644 (file)
index 0000000..57f9716
--- /dev/null
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Contributors
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     Andy Clement (SpringSource) - initial implementation
+ *******************************************************************************/
+package org.aspectj.weaver.patterns;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.aspectj.weaver.ConstantPoolReader;
+import org.aspectj.weaver.ConstantPoolWriter;
+
+public class ConstantPoolSimulator implements ConstantPoolWriter, ConstantPoolReader {
+       List<String> list = new ArrayList<String>();
+
+       public int writeUtf8(String string) {
+               int i = list.indexOf(string);
+               if (i != -1) {
+                       return i;
+               }
+               list.add(string);
+               return list.indexOf(string);
+       }
+
+       public String readUtf8(int constantPoolIndex) {
+               return list.get(constantPoolIndex);
+       }
+
+}
\ No newline at end of file
index 444db0c752286d1430e24770794322be5e59c237..ab5f6e6f24baaae863e549b28e41ac1c2e34f30d 100644 (file)
@@ -50,12 +50,13 @@ public class DeclareErrorOrWarningTestCase extends TestCase {
 
        private void checkSerialization(Declare declare) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                declare.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                Declare newDeclare = Declare.read(in, null);
 
                assertEquals("write/read", declare, newDeclare);
index a826263366fe3e39b4afbe01f42f25ef039d033e..fa561149e4c730c0ad2bab48e7979ddd882edbd6 100644 (file)
@@ -16,8 +16,12 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.aspectj.weaver.CompressingDataOutputStream;
+import org.aspectj.weaver.ConstantPoolReader;
+import org.aspectj.weaver.ConstantPoolWriter;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.reflect.ReflectionWorld;
@@ -91,12 +95,13 @@ public class ModifiersPatternTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                ModifiersPattern p = makeModifiersPattern(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                ModifiersPattern newP = ModifiersPattern.read(in);
 
                assertEquals("write/read", p, newP);
index 41685973ca97074aeab7081bbe92aa24d6dc6825..e1876cc3bb85f9d1c52535c1a63ffce64f809eb5 100644 (file)
@@ -90,12 +90,13 @@ public class NamePatternTestCase extends TestCase {
 
        private void checkSerialization(NamePattern p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                NamePattern newP = NamePattern.read(in);
 
                assertEquals("write/read", p, newP);
index 67cf5be98a2928dc1d9ec0571c6b026c3b638203..52f82bfd7bbc256ceb155124d5ca9d4d6dc17c78 100644 (file)
@@ -152,12 +152,13 @@ public class SignaturePatternMatchSpeedTestCase extends PatternsTestCase {
 
        private void checkSerialization(SignaturePattern p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                SignaturePattern newP = SignaturePattern.read(in, null);
 
                assertEquals("write/read", p, newP);
index 629e26719fe091c7a4a723c12d66ec19be67ee43..6c6f1f98545125f246c144f46cb744c0d24361eb 100644 (file)
@@ -16,7 +16,6 @@ package org.aspectj.weaver.patterns;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-
 import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.TestUtils;
@@ -171,12 +170,13 @@ public class SignaturePatternTestCase extends PatternsTestCase {
 
        private void checkSerialization(SignaturePattern p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                SignaturePattern newP = SignaturePattern.read(in, null);
 
                assertEquals("write/read", p, newP);
index 15460d4cf76907522b3cedaac01761de02d0749b..a141e2b0c10641f1dbffca7acaacd6555759d0b3 100644 (file)
@@ -156,12 +156,13 @@ public class TypePatternListTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                TypePatternList p = makeArgumentsPattern(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                TypePatternList newP = TypePatternList.read(in, null);
 
                assertEquals("write/read", p, newP);
index 416ccc11c93cf304d4b0b53024cd9b5a2affdc16..4654fbd4087da48995c9ec470b7e80e0e1501c71 100644 (file)
@@ -248,12 +248,13 @@ public class TypePatternTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                TypePattern p = makeTypePattern(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                TypePattern newP = TypePattern.read(in, null);
 
                assertEquals("write/read", p, newP);
index 2665b6e968bdc1acafd51de837ffcb2857a4605e..b8138b06721b32f7fdf4053252e02a51fd8c7b55 100644 (file)
@@ -15,7 +15,6 @@ package org.aspectj.weaver.patterns;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.IntMap;
@@ -107,12 +106,13 @@ public class WithinTestCase extends PatternsTestCase {
 
        private void checkSerialization(Pointcut p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
+               ConstantPoolSimulator cps = new ConstantPoolSimulator();
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo, cps);
                p.write(out);
                out.close();
 
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
-               VersionedDataInputStream in = new VersionedDataInputStream(bi);
+               VersionedDataInputStream in = new VersionedDataInputStream(bi, cps);
                Pointcut newP = Pointcut.read(in, null);
 
                assertEquals("write/read", p, newP);