]> source.dussan.org Git - aspectj.git/commitdiff
change all relevant DataOutputStream usage to use CompressingDataOutputStream
authoraclement <aclement>
Tue, 18 May 2010 16:20:12 +0000 (16:20 +0000)
committeraclement <aclement>
Tue, 18 May 2010 16:20:12 +0000 (16:20 +0000)
91 files changed:
org.aspectj.matcher/src/org/aspectj/weaver/AjAttribute.java
org.aspectj.matcher/src/org/aspectj/weaver/AnnotationOnTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java
org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java
org.aspectj.matcher/src/org/aspectj/weaver/MethodDelegateTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/NewConstructorTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/NewFieldTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/NewMethodTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/NewParentTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/PerTypeWithinTargetTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/PersistenceSupport.java
org.aspectj.matcher/src/org/aspectj/weaver/PrivilegedAccessMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedPointcutDefinition.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedTypeMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/ShadowMunger.java
org.aspectj.matcher/src/org/aspectj/weaver/TypeVariable.java
org.aspectj.matcher/src/org/aspectj/weaver/UnresolvedType.java
org.aspectj.matcher/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java
org.aspectj.matcher/src/org/aspectj/weaver/WeaverStateInfo.java
org.aspectj.matcher/src/org/aspectj/weaver/internal/tools/PointcutDesignatorHandlerBasedPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AndTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPatternList.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnyAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ArgsPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingAnnotationFieldTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/CflowPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareParents.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareParentsMixin.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareSoft.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareTypeErrorOrWarning.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactAnnotationFieldTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ExactTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/HandlerPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/IfPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/KindedPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ModifiersPattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NamePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/NotTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/OrAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/OrPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/OrTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternNode.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerCflow.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerObject.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerSingleton.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerTypeWithin.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/Pointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ReferencePointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/ThrowsPattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePatternList.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeVariablePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeVariablePatternList.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WildTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithinPointcut.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/WithincodePointcut.java
org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/AndOrNotTestCase.java
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 dc90b4e430757b83d5a91ba5116c847c39670c69..07149a5183d8dcfd8a939374944b26b89e6972ab 100644 (file)
@@ -41,7 +41,7 @@ public abstract class AjAttribute {
 
        public static final String AttributePrefix = "org.aspectj.weaver";
 
-       protected abstract void write(DataOutputStream s) throws IOException;
+       protected abstract void write(CompressingDataOutputStream s) throws IOException;
 
        public abstract String getNameString();
 
@@ -55,7 +55,7 @@ public abstract class AjAttribute {
        public byte[] getBytes() {
                try {
                        ByteArrayOutputStream b0 = new ByteArrayOutputStream();
-                       DataOutputStream s0 = new DataOutputStream(b0);
+                       CompressingDataOutputStream s0 = new CompressingDataOutputStream(b0);
                        write(s0);
                        s0.close();
                        return b0.toByteArray();
@@ -158,7 +158,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                }
        }
 
@@ -177,7 +177,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        munger.write(s);
                }
 
@@ -201,7 +201,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        kind.write(s);
                }
 
@@ -286,7 +286,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        s.writeShort(CURRENT_VERSION_MAJOR);
                        s.writeShort(CURRENT_VERSION_MINOR);
                        s.writeLong(Version.getTime()); // build used to construct the
@@ -362,7 +362,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        s.writeUTF(sourceFileName);
                        FileUtil.writeIntArray(lineBreaks, s);
                }
@@ -409,7 +409,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        s.writeInt(lineNumber);
                        s.writeInt(offset);
                }
@@ -444,7 +444,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        pointcutDef.write(s);
                }
 
@@ -468,7 +468,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        declare.write(s);
                }
 
@@ -549,7 +549,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        kind.write(s);
                        pointcut.write(s);
                        s.writeByte(extraParameterFlags);
@@ -641,7 +641,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        perClause.write(s);
                }
 
@@ -661,7 +661,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        ResolvedMemberImpl.writeArray(accessedMembers, s);
                }
 
@@ -699,7 +699,7 @@ public abstract class AjAttribute {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        effectiveSignature.write(s);
                        shadowKind.write(s);
                        s.writeBoolean(weaveBody);
index 502d53c9a494569afe3d2cfcd1cd78b4b362cf65..6390ed31123347b1ced8a20a52780aa0ff232220 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 /**
@@ -26,7 +25,7 @@ public class AnnotationOnTypeMunger extends ResolvedTypeMunger {
                newAnnotation = anno;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                throw new RuntimeException("unimplemented");
        }
 
@@ -35,8 +34,9 @@ public class AnnotationOnTypeMunger extends ResolvedTypeMunger {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof AnnotationOnTypeMunger))
+               if (!(other instanceof AnnotationOnTypeMunger)) {
                        return false;
+               }
                AnnotationOnTypeMunger o = (AnnotationOnTypeMunger) other;
                // TODO does not check equality of annotation values
                return newAnnotation.getTypeSignature().equals(o.newAnnotation.getTypeSignature());
index 04d23488fefacedff331c03c2bbef58ed1fc82f3..d48dc18d3391b278bcfbbb09f9e7d0f18ccd4ece 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -379,7 +378,7 @@ public class CrosscuttingMembersSet {
 
        public int serializationVersion = 1;
 
-       public void write(DataOutputStream stream) throws IOException {
+       public void write(CompressingDataOutputStream stream) throws IOException {
                // stream.writeInt(serializationVersion);
                stream.writeInt(shadowMungers.size());
                for (Iterator iterator = shadowMungers.iterator(); iterator.hasNext();) {
index 70f58be9af45ff7396f49cfffc92a4c631904a60..8212f7f3c2383a86bc87d4955c49980d674ddeaa 100644 (file)
@@ -11,7 +11,6 @@
  * ******************************************************************/
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.List;
@@ -112,7 +111,7 @@ public class JoinPointSignature implements ResolvedMember {
                return realMember.isSynthetic();
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                realMember.write(s);
        }
 
index c1bc59d330f4b63e389fe940f4733a6dbd2adf55..79eab7d4d4f0aef0c62c20e505d57f4b2f8494bb 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.weaver.patterns.TypePattern;
@@ -78,8 +77,9 @@ public class MethodDelegateTypeMunger extends ResolvedTypeMunger {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof MethodDelegateTypeMunger))
+               if (!(other instanceof MethodDelegateTypeMunger)) {
                        return false;
+               }
                MethodDelegateTypeMunger o = (MethodDelegateTypeMunger) other;
                return ((o.aspect == null) ? (aspect == null) : aspect.equals(o.aspect))
                                && ((o.typePattern == null) ? (typePattern == null) : typePattern.equals(o.typePattern))
@@ -127,7 +127,7 @@ public class MethodDelegateTypeMunger extends ResolvedTypeMunger {
                return implClassName;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                kind.write(s);
                signature.write(s);
                aspect.write(s);
@@ -210,8 +210,9 @@ public class MethodDelegateTypeMunger extends ResolvedTypeMunger {
                }
 
                public boolean equals(Object other) {
-                       if (!(other instanceof FieldHostTypeMunger))
+                       if (!(other instanceof FieldHostTypeMunger)) {
                                return false;
+                       }
                        FieldHostTypeMunger o = (FieldHostTypeMunger) other;
                        return ((o.aspect == null) ? (aspect == null) : aspect.equals(o.aspect))
                                        && ((o.typePattern == null) ? (typePattern == null) : typePattern.equals(o.typePattern));
@@ -224,7 +225,7 @@ public class MethodDelegateTypeMunger extends ResolvedTypeMunger {
                        return result;
                }
 
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        kind.write(s);
                        signature.write(s);
                        aspect.write(s);
index fceb72f03837c663366c664326fa23643b6b22a3..47cfdf5059db51130d439233a3a7abf54917236b 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Set;
@@ -35,8 +34,9 @@ public class NewConstructorTypeMunger extends ResolvedTypeMunger {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof NewConstructorTypeMunger))
+               if (!(other instanceof NewConstructorTypeMunger)) {
                        return false;
+               }
                NewConstructorTypeMunger o = (NewConstructorTypeMunger) other;
                return ((syntheticConstructor == null) ? (o.syntheticConstructor == null) : syntheticConstructor
                                .equals(o.syntheticConstructor))
@@ -46,8 +46,9 @@ public class NewConstructorTypeMunger extends ResolvedTypeMunger {
 
        // pr262218 - equivalence ignores the explicit constructor since that won't have yet been set for an EclipseTypeMunger
        public boolean equivalentTo(Object other) {
-               if (!(other instanceof NewConstructorTypeMunger))
+               if (!(other instanceof NewConstructorTypeMunger)) {
                        return false;
+               }
                NewConstructorTypeMunger o = (NewConstructorTypeMunger) other;
                return ((syntheticConstructor == null) ? (o.syntheticConstructor == null) : syntheticConstructor
                                .equals(o.syntheticConstructor));
@@ -70,7 +71,7 @@ public class NewConstructorTypeMunger extends ResolvedTypeMunger {
        // return AjcMemberMaker.interMethodBody(signature, aspectType);
        // }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                kind.write(s);
                signature.write(s);
                syntheticConstructor.write(s);
@@ -90,8 +91,9 @@ public class NewConstructorTypeMunger extends ResolvedTypeMunger {
                List typeVarAliases = readInTypeAliases(s);
                ResolvedTypeMunger munger = new NewConstructorTypeMunger(sig, syntheticCtor, explicitCtor, superMethodsCalled,
                                typeVarAliases);
-               if (sloc != null)
+               if (sloc != null) {
                        munger.setSourceLocation(sloc);
+               }
                return munger;
        }
 
@@ -111,8 +113,9 @@ public class NewConstructorTypeMunger extends ResolvedTypeMunger {
 
        public ResolvedMember getMatchingSyntheticMember(Member member, ResolvedType aspectType) {
                ResolvedMember ret = getSyntheticConstructor();
-               if (ResolvedType.matches(ret, member))
+               if (ResolvedType.matches(ret, member)) {
                        return getSignature();
+               }
                return super.getMatchingSyntheticMember(member, aspectType);
        }
 
@@ -128,8 +131,9 @@ public class NewConstructorTypeMunger extends ResolvedTypeMunger {
         */
        public ResolvedTypeMunger parameterizedFor(ResolvedType target) {
                ResolvedType genericType = target;
-               if (target.isRawType() || target.isParameterizedType())
+               if (target.isRawType() || target.isParameterizedType()) {
                        genericType = genericType.getGenericType();
+               }
                ResolvedMember parameterizedSignature = null;
                // If we are parameterizing it for a generic type, we just need to 'swap the letters' from the ones used
                // in the original ITD declaration to the ones used in the actual target type declaration.
index 8427ca74b085994a840d1a698ab0dee46da87461..bb2cacbb1389664cd769a8a0d28a47052bb4bb49 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -46,7 +45,7 @@ public class NewFieldTypeMunger extends ResolvedTypeMunger {
                return AjcMemberMaker.interFieldInitializer(signature, aspectType);
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                kind.write(s);
                signature.write(s);
                writeSuperMethodsCalled(s);
@@ -62,8 +61,9 @@ public class NewFieldTypeMunger extends ResolvedTypeMunger {
                sloc = readSourceLocation(s);
                List aliases = readInTypeAliases(s);
                NewFieldTypeMunger munger = new NewFieldTypeMunger(fieldSignature, superMethodsCalled, aliases);
-               if (sloc != null)
+               if (sloc != null) {
                        munger.setSourceLocation(sloc);
+               }
                if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_AJ169) {
                        // there is a version int
                        munger.version = s.readInt();
@@ -76,21 +76,26 @@ public class NewFieldTypeMunger extends ResolvedTypeMunger {
        public ResolvedMember getMatchingSyntheticMember(Member member, ResolvedType aspectType) {
                // ??? might give a field where a method is expected
                ResolvedType onType = aspectType.getWorld().resolve(getSignature().getDeclaringType());
-               if (onType.isRawType())
+               if (onType.isRawType()) {
                        onType = onType.getGenericType();
+               }
 
                ResolvedMember ret = AjcMemberMaker.interFieldGetDispatcher(getSignature(), aspectType);
-               if (ResolvedType.matches(ret, member))
+               if (ResolvedType.matches(ret, member)) {
                        return getSignature();
+               }
                ret = AjcMemberMaker.interFieldSetDispatcher(getSignature(), aspectType);
-               if (ResolvedType.matches(ret, member))
+               if (ResolvedType.matches(ret, member)) {
                        return getSignature();
+               }
                ret = AjcMemberMaker.interFieldInterfaceGetter(getSignature(), onType, aspectType);
-               if (ResolvedType.matches(ret, member))
+               if (ResolvedType.matches(ret, member)) {
                        return getSignature();
+               }
                ret = AjcMemberMaker.interFieldInterfaceSetter(getSignature(), onType, aspectType);
-               if (ResolvedType.matches(ret, member))
+               if (ResolvedType.matches(ret, member)) {
                        return getSignature();
+               }
                return super.getMatchingSyntheticMember(member, aspectType);
        }
 
@@ -99,8 +104,9 @@ public class NewFieldTypeMunger extends ResolvedTypeMunger {
         */
        public ResolvedTypeMunger parameterizedFor(ResolvedType target) {
                ResolvedType genericType = target;
-               if (target.isRawType() || target.isParameterizedType())
+               if (target.isRawType() || target.isParameterizedType()) {
                        genericType = genericType.getGenericType();
+               }
                ResolvedMember parameterizedSignature = null;
                // If we are parameterizing it for a generic type, we just need to 'swap the letters' from the ones used
                // in the original ITD declaration to the ones used in the actual target type declaration.
index a2158954d5b30a8c16901661d81318feabc164c6..da5c3b1f4853b5486a7d80cdf897248e4816d554 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -59,7 +58,7 @@ public class NewMethodTypeMunger extends ResolvedTypeMunger {
                }
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                kind.write(s);
                signature.write(s);
                writeSuperMethodsCalled(s);
@@ -75,15 +74,17 @@ public class NewMethodTypeMunger extends ResolvedTypeMunger {
                List typeVarAliases = readInTypeAliases(s);
 
                ResolvedTypeMunger munger = new NewMethodTypeMunger(rmImpl, superMethodsCalled, typeVarAliases);
-               if (sloc != null)
+               if (sloc != null) {
                        munger.setSourceLocation(sloc);
+               }
                return munger;
        }
 
        public ResolvedMember getMatchingSyntheticMember(Member member, ResolvedType aspectType) {
                ResolvedMember ret = AjcMemberMaker.interMethodDispatcher(getSignature(), aspectType);
-               if (ResolvedType.matches(ret, member))
+               if (ResolvedType.matches(ret, member)) {
                        return getSignature();
+               }
                return super.getMatchingSyntheticMember(member, aspectType);
        }
 
@@ -92,8 +93,9 @@ public class NewMethodTypeMunger extends ResolvedTypeMunger {
         */
        public ResolvedTypeMunger parameterizedFor(ResolvedType target) {
                ResolvedType genericType = target;
-               if (target.isRawType() || target.isParameterizedType())
+               if (target.isRawType() || target.isParameterizedType()) {
                        genericType = genericType.getGenericType();
+               }
                ResolvedMember parameterizedSignature = null;
                // If we are parameterizing it for a generic type, we just need to 'swap the letters' from the ones used
                // in the original ITD declaration to the ones used in the actual target type declaration.
index 069711bc1545d693cd98a6a5a4362b0e92695f53..ebb419f5b418e9a3bdd5ea788c96024e4816d644 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 public class NewParentTypeMunger extends ResolvedTypeMunger {
@@ -25,7 +24,7 @@ public class NewParentTypeMunger extends ResolvedTypeMunger {
                this.isMixin = false;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                throw new RuntimeException("unimplemented");
        }
 
index 03ee00877eef6536284c8d80f36bd9c57cd8e0e0..ce4348241037943baa0bde204ae48f85cbb0b87d 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver;
 
+import java.io.IOException;
+
 import org.aspectj.weaver.patterns.PerFromSuper;
 import org.aspectj.weaver.patterns.PerObject;
 import org.aspectj.weaver.patterns.PerThisOrTargetPointcutVisitor;
 import org.aspectj.weaver.patterns.Pointcut;
 import org.aspectj.weaver.patterns.TypePattern;
 
-import java.io.DataOutputStream;
-import java.io.IOException;
-
 public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger {
 
        private final UnresolvedType interfaceType;
@@ -28,8 +27,9 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger {
        private TypePattern lazyTestTypePattern;
 
        public boolean equals(Object other) {
-               if (other == null || !(other instanceof PerObjectInterfaceTypeMunger))
+               if (other == null || !(other instanceof PerObjectInterfaceTypeMunger)) {
                        return false;
+               }
                PerObjectInterfaceTypeMunger o = (PerObjectInterfaceTypeMunger) other;
                return ((testPointcut == null) ? (o.testPointcut == null) : testPointcut.equals(o.testPointcut))
                                && ((lazyTestTypePattern == null) ? (o.lazyTestTypePattern == null) : lazyTestTypePattern
@@ -71,7 +71,7 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger {
                return lazyTestTypePattern;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                throw new RuntimeException("shouldn't be serialized");
        }
 
@@ -84,8 +84,9 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger {
        }
 
        public boolean matches(ResolvedType matchType, ResolvedType aspectType) {
-               if (matchType.isInterface())
+               if (matchType.isInterface()) {
                        return false;
+               }
                return getTestTypePattern(aspectType).matchesStatically(matchType);
        }
 
index 4cc4c9e1784acc11d835d8fbe1ef64084cb264a8..036ab9b7c7f41fb15e69bec95a63cde4638616f7 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
@@ -31,8 +30,9 @@ public class PerTypeWithinTargetTypeMunger extends ResolvedTypeMunger {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof PerTypeWithinTargetTypeMunger))
+               if (!(other instanceof PerTypeWithinTargetTypeMunger)) {
                        return false;
+               }
                PerTypeWithinTargetTypeMunger o = (PerTypeWithinTargetTypeMunger) other;
                return ((o.testPointcut == null) ? (testPointcut == null) : testPointcut.equals(o.testPointcut))
                                && ((o.aspectType == null) ? (aspectType == null) : aspectType.equals(o.aspectType));
@@ -50,7 +50,7 @@ public class PerTypeWithinTargetTypeMunger extends ResolvedTypeMunger {
                return hashCode;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                throw new RuntimeException("shouldn't be serialized");
        }
 
index 5eb1de13e399093b3da338f1a263d1f8dbf1400c..d98c7678d3a3e1985266cd2090dcb3ce99732dfc 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
@@ -19,11 +18,11 @@ import java.io.Serializable;
  */
 public class PersistenceSupport {
 
-       public static void write(DataOutputStream stream, ISourceContext sourceContext) throws IOException {
+       public static void write(CompressingDataOutputStream stream, ISourceContext sourceContext) throws IOException {
                throw new IllegalStateException();
        }
 
-       public static void write(DataOutputStream stream, Serializable serializableObject) throws IOException {
+       public static void write(CompressingDataOutputStream stream, Serializable serializableObject) throws IOException {
                ObjectOutputStream oos = new ObjectOutputStream(stream);
                oos.writeObject(serializableObject);
                oos.flush();
index 3e5a3be502dd6651b22c52732203651991d8326f..3acbf9b4b20c56ec7a1f3bafe10c4c76214fd2ae 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 /**
@@ -34,7 +33,7 @@ public class PrivilegedAccessMunger extends ResolvedTypeMunger {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                throw new RuntimeException("should not be serialized");
        }
 
index ffeedbbc3aaf8bccf44affb1c7838d6b17b25f7c..bc0a87151feccf7bcfa41d5813754235dfb08c12 100644 (file)
@@ -13,7 +13,6 @@
  * ******************************************************************/
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -56,7 +55,7 @@ public interface ResolvedMember extends Member, AnnotatedElement, TypeVariableDe
 
        public boolean isSynthetic();
 
-       public void write(DataOutputStream s) throws IOException;
+       public void write(CompressingDataOutputStream s) throws IOException;
 
        public ISourceContext getSourceContext(World world);
 
index c63c8a09c16c31eea8d1143ec78b5b509de2e51b..7f9330c87ea40d619dff57e0b4820c5612704161 100644 (file)
@@ -8,7 +8,6 @@
  * ******************************************************************/
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
@@ -379,7 +378,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                return (modifiers & 4096) != 0; // do we know better?
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                getKind().write(s);
                getDeclaringType().write(s);
                s.writeInt(modifiers);
@@ -460,7 +459,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                return sb.toString();
        }
 
-       public static void writeArray(ResolvedMember[] members, DataOutputStream s) throws IOException {
+       public static void writeArray(ResolvedMember[] members, CompressingDataOutputStream s) throws IOException {
                s.writeInt(members.length);
                for (int i = 0, len = members.length; i < len; i++) {
                        members[i].write(s);
index b3532ecaeb90810bf17d41ba0a478402d55ff95e..f42d554883731c0fbf306a5e8336a597e2030944 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -48,7 +47,7 @@ public class ResolvedPointcutDefinition extends ResolvedMemberImpl {
        // ----
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                getDeclaringType().write(s);
                s.writeInt(getModifiers());
                s.writeUTF(getName());
index 1c2cd4ca2f9c81b338589d28f3a04b375c0f3b7c..404d8790f30a4589e684105e8752fc00b12a4de4 100644 (file)
@@ -177,7 +177,7 @@ public abstract class ResolvedTypeMunger {
                return ret;
        }
 
-       protected void writeSuperMethodsCalled(DataOutputStream s) throws IOException {
+       protected void writeSuperMethodsCalled(CompressingDataOutputStream s) throws IOException {
 
                if (superMethodsCalled == null || superMethodsCalled.size() == 0) {
                        s.writeInt(0);
@@ -243,7 +243,7 @@ public abstract class ResolvedTypeMunger {
                oos.close();
        }
 
-       public abstract void write(DataOutputStream s) throws IOException;
+       public abstract void write(CompressingDataOutputStream s) throws IOException;
 
        public Kind getKind() {
                return kind;
index 1b6dbbe6f76ce560cec03045c3bfc1b8c69400e6..0937d546961e387e08c3554063d7b617264f82e0 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
@@ -259,7 +258,7 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
         */
        public abstract boolean mustCheckExceptions();
 
-       public void write(DataOutputStream stream) throws IOException {
+       public void write(CompressingDataOutputStream stream) throws IOException {
                stream.writeInt(VERSION_1);
                stream.writeInt(shadowMungerKind); // determines real subclass
                stream.writeInt(start);
index 98cbedf0a227f2c3b7b501d0e85a092a4b73c44d..a0cfd0c2bca90a83a17f2a0f30766030ad258e14 100644 (file)
@@ -8,7 +8,6 @@
  * ******************************************************************/
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 /**
@@ -314,7 +313,7 @@ public class TypeVariable {
                return declaringElementKind;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                // name, upperbound, additionalInterfaceBounds, lowerbound
                s.writeUTF(name);
                superclass.write(s);
index 8436c228ecd0d7a0dc84f9a5a055fc9035761040..3453eb1eb894529377ed13e0ce926c5b3b2c7053 100644 (file)
@@ -15,7 +15,6 @@
 package org.aspectj.weaver;
 
 import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
@@ -836,7 +835,7 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement {
                }
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public final void write(CompressingDataOutputStream s) throws IOException {
                s.writeUTF(getSignature());
        }
 
@@ -850,7 +849,7 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement {
                }
        }
 
-       public static void writeArray(UnresolvedType[] types, DataOutputStream s) throws IOException {
+       public static void writeArray(UnresolvedType[] types, CompressingDataOutputStream s) throws IOException {
                int len = types.length;
                s.writeShort(len);
                for (int i = 0; i < len; i++) {
index 33099b17b170c08f4b3205f93287435079d91fa2..2dcbbd91a3980bd4ecf90fea8eead112f88d3458 100644 (file)
@@ -8,8 +8,6 @@
  * ******************************************************************/
 package org.aspectj.weaver;
 
-import java.io.DataOutputStream;
-import java.io.IOException;
 
 /**
  * @author Adrian Colyer
@@ -85,11 +83,6 @@ public class UnresolvedTypeVariableReferenceType extends UnresolvedType implemen
                return typeVariable.getName();
        }
 
-       @Override
-       public void write(DataOutputStream s) throws IOException {
-               super.write(s);
-       }
-
        @Override
        public String getErasureSignature() {
                return typeVariable.getFirstBound().getSignature();
index fb496c9b515e5e74984ab179dd21b716a702f2d2..c09e656f9a7c80954938a58367fa882ce24f0a6e 100644 (file)
@@ -154,7 +154,7 @@ public class WeaverStateInfo {
         * be inserted. When the key is replaced with the diff, the 'kind' byte moves to the front of the attribute - thats why in the
         * read logic you'll see it expecting the kind as the first byte.
         */
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                if (oldStyle || reweavableCompressedMode) {
                        throw new RuntimeException("shouldn't be writing this");
                }
index 29471cbec5f7d253aefdfd315adcd05eb58ec4f8..9c508a1a3bfcb1cbe7f808c6242228685dcd36e4 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver.internal.tools;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.Shadow;
@@ -157,7 +157,7 @@ public class PointcutDesignatorHandlerBasedPointcut extends Pointcut {
         * 
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                throw new UnsupportedOperationException("can't write custom pointcut designator expressions to stream");
        }
 
index 4392a19d3281388648f2dcefc79d2d2ae197e19b..4889d0f9af60353537804780b655856c05b1d3e3 100644 (file)
@@ -9,28 +9,29 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
-import org.aspectj.weaver.ResolvedType;
+
 /**
  * @author colyer
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * 
+ *         TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
+ *         Templates
  */
 public class AndAnnotationTypePattern extends AnnotationTypePattern {
 
        private AnnotationTypePattern left;
        private AnnotationTypePattern right;
-       
+
        public AndAnnotationTypePattern(AnnotationTypePattern left, AnnotationTypePattern right) {
                this.left = left;
                this.right = right;
@@ -40,83 +41,96 @@ public class AndAnnotationTypePattern extends AnnotationTypePattern {
        public FuzzyBoolean matches(AnnotatedElement annotated) {
                return left.matches(annotated).and(right.matches(annotated));
        }
-       
-       public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations ) {
-               return left.matches(annotated,parameterAnnotations).and(right.matches(annotated,parameterAnnotations));
+
+       public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {
+               return left.matches(annotated, parameterAnnotations).and(right.matches(annotated, parameterAnnotations));
        }
 
        public void resolve(World world) {
                left.resolve(world);
                right.resolve(world);
        }
-       
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope, org.aspectj.weaver.patterns.Bindings, boolean)
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope,
+        * org.aspectj.weaver.patterns.Bindings, boolean)
         */
-       public AnnotationTypePattern resolveBindings(IScope scope,
-                       Bindings bindings, boolean allowBinding) {
-               left = left.resolveBindings(scope,bindings,allowBinding);
-               right =right.resolveBindings(scope,bindings,allowBinding);
+       public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) {
+               left = left.resolveBindings(scope, bindings, allowBinding);
+               right = right.resolveBindings(scope, bindings, allowBinding);
                return this;
        }
-       
-       public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) {
-               AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap,w);
-               AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap,w);
-               AndAnnotationTypePattern ret = new AndAnnotationTypePattern(newLeft,newRight);
+
+       public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+               AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w);
+               AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w);
+               AndAnnotationTypePattern ret = new AndAnnotationTypePattern(newLeft, newRight);
                ret.copyLocationFrom(this);
-               if (this.isForParameterAnnotationMatch()) ret.setForParameterAnnotationMatch();
+               if (this.isForParameterAnnotationMatch()) {
+                       ret.setForParameterAnnotationMatch();
+               }
                return ret;
        }
-       
+
        public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
-               AnnotationTypePattern p = new AndAnnotationTypePattern(
-                               AnnotationTypePattern.read(s,context),
-                               AnnotationTypePattern.read(s,context));
-               p.readLocation(context,s);
-               if (s.getMajorVersion()>=WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160) {
-                       if (s.readBoolean()) p.setForParameterAnnotationMatch();                        
+               AnnotationTypePattern p = new AndAnnotationTypePattern(AnnotationTypePattern.read(s, context), AnnotationTypePattern.read(
+                               s, context));
+               p.readLocation(context, s);
+               if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160) {
+                       if (s.readBoolean()) {
+                               p.setForParameterAnnotationMatch();
+                       }
                }
-               return p;               
+               return p;
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.AND);
                left.write(s);
                right.write(s);
                writeLocation(s);
                s.writeBoolean(isForParameterAnnotationMatch());
        }
-       
+
        public boolean equals(Object obj) {
-               if (!(obj instanceof AndAnnotationTypePattern)) return false;
+               if (!(obj instanceof AndAnnotationTypePattern)) {
+                       return false;
+               }
                AndAnnotationTypePattern other = (AndAnnotationTypePattern) obj;
-               return (left.equals(other.left) && right.equals(other.right) && left.isForParameterAnnotationMatch()==right.isForParameterAnnotationMatch());
+               return (left.equals(other.left) && right.equals(other.right) && left.isForParameterAnnotationMatch() == right
+                               .isForParameterAnnotationMatch());
        }
-       
+
        public int hashCode() {
                int result = 17;
-               result = result*37 + left.hashCode();
-               result = result*37 + right.hashCode();
-               result = result*37 + (isForParameterAnnotationMatch()?0:1);
-               return result;          
+               result = result * 37 + left.hashCode();
+               result = result * 37 + right.hashCode();
+               result = result * 37 + (isForParameterAnnotationMatch() ? 0 : 1);
+               return result;
        }
-       
+
        public String toString() {
                return left.toString() + " " + right.toString();
        }
-       
-       public AnnotationTypePattern getLeft() { return left; }
-       public AnnotationTypePattern getRight() { return right; }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public AnnotationTypePattern getLeft() {
+               return left;
+       }
+
+       public AnnotationTypePattern getRight() {
+               return right;
+       }
+
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
-               left.traverse(visitor,ret);
-               right.traverse(visitor,ret);
+               Object ret = accept(visitor, data);
+               left.traverse(visitor, ret);
+               right.traverse(visitor, ret);
                return ret;
        }
 
index 58608a7936621e429b5d2d3d1f585b045d1fd309..c3f003ad8ae2d6539c11fdc3872464652144952d 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -27,10 +26,10 @@ import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Test;
 
 public class AndPointcut extends Pointcut {
-       Pointcut left, right;  // exposed for testing
+       Pointcut left, right; // exposed for testing
 
        private int couldMatchKinds;
-       
+
        public AndPointcut(Pointcut left, Pointcut right) {
                super();
                this.left = left;
@@ -39,7 +38,7 @@ public class AndPointcut extends Pointcut {
                setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
                couldMatchKinds = left.couldMatchKinds() & right.couldMatchKinds();
        }
-       
+
        public int couldMatchKinds() {
                return couldMatchKinds;
        }
@@ -47,63 +46,65 @@ public class AndPointcut extends Pointcut {
        public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return left.fastMatch(type).and(right.fastMatch(type));
        }
-       
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                FuzzyBoolean leftMatch = left.match(shadow);
-               if (leftMatch.alwaysFalse()) return leftMatch;
+               if (leftMatch.alwaysFalse()) {
+                       return leftMatch;
+               }
                return leftMatch.and(right.match(shadow));
        }
-       
+
        public String toString() {
                return "(" + left.toString() + " && " + right.toString() + ")";
        }
-       
-       public boolean equals(Object other) { 
-               if (!(other instanceof AndPointcut)) return false;
-               AndPointcut o = (AndPointcut)other;
+
+       public boolean equals(Object other) {
+               if (!(other instanceof AndPointcut)) {
+                       return false;
+               }
+               AndPointcut o = (AndPointcut) other;
                return o.left.equals(left) && o.right.equals(right);
        }
-    
-    public int hashCode() {
-        int result = 19;
-        result = 37*result + left.hashCode();
-        result = 37*result + right.hashCode();
-        return result;
-    }
+
+       public int hashCode() {
+               int result = 19;
+               result = 37 * result + left.hashCode();
+               result = 37 * result + right.hashCode();
+               return result;
+       }
 
        public void resolveBindings(IScope scope, Bindings bindings) {
                left.resolveBindings(scope, bindings);
                right.resolveBindings(scope, bindings);
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.AND);
                left.write(s);
                right.write(s);
                writeLocation(s);
        }
-       
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AndPointcut ret = new AndPointcut(Pointcut.read(s, context), Pointcut.read(s, context));
                ret.readLocation(context, s);
                return ret;
        }
 
-
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                return Test.makeAnd(left.findResidue(shadow, state), right.findResidue(shadow, state));
        }
 
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
-               AndPointcut ret =  new AndPointcut(left.concretize(inAspect, declaringType, bindings),
-                                                                                  right.concretize(inAspect, declaringType, bindings));
+               AndPointcut ret = new AndPointcut(left.concretize(inAspect, declaringType, bindings), right.concretize(inAspect,
+                               declaringType, bindings));
                ret.copyLocationFrom(this);
                return ret;
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-               AndPointcut ret =  new AndPointcut(left.parameterizeWith(typeVariableMap,w),
-                                                                                   right.parameterizeWith(typeVariableMap,w));
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               AndPointcut ret = new AndPointcut(left.parameterizeWith(typeVariableMap, w), right.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
@@ -116,14 +117,14 @@ public class AndPointcut extends Pointcut {
                return right;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
-               left.traverse(visitor,ret);
-               right.traverse(visitor,ret);
+               Object ret = accept(visitor, data);
+               left.traverse(visitor, ret);
+               right.traverse(visitor, ret);
                return ret;
        }
 }
index ebf79de6d0eb3d4260f4357620de5db5cbad7088..d23404f7fb23779daa2e59e3211387ab6e5c353e 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -26,16 +25,17 @@ import org.aspectj.weaver.World;
 /**
  * left && right
  * 
- * <p>any binding to formals is explicitly forbidden for any composite by the language
+ * <p>
+ * any binding to formals is explicitly forbidden for any composite by the language
  * 
  * @author Erik Hilsdale
  * @author Jim Hugunin
  */
 public class AndTypePattern extends TypePattern {
        private TypePattern left, right;
-       
+
        public AndTypePattern(TypePattern left, TypePattern right) {
-               super(false,false);  //?? we override all methods that care about includeSubtypes
+               super(false, false); // ?? we override all methods that care about includeSubtypes
                this.left = left;
                this.right = right;
                setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
@@ -44,78 +44,79 @@ public class AndTypePattern extends TypePattern {
        protected boolean couldEverMatchSameTypesAs(TypePattern other) {
                return true; // don't dive into ands yet....
        }
+
        public FuzzyBoolean matchesInstanceof(ResolvedType type) {
                return left.matchesInstanceof(type).and(right.matchesInstanceof(type));
        }
 
        protected boolean matchesExactly(ResolvedType type) {
-               //??? if these had side-effects, this sort-circuit could be a mistake
+               // ??? if these had side-effects, this sort-circuit could be a mistake
                return left.matchesExactly(type) && right.matchesExactly(type);
        }
-       
+
        protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
-               return left.matchesExactly(type,annotatedType) && right.matchesExactly(type,annotatedType);             
+               return left.matchesExactly(type, annotatedType) && right.matchesExactly(type, annotatedType);
        }
-       
+
        public boolean matchesStatically(ResolvedType type) {
                return left.matchesStatically(type) && right.matchesStatically(type);
        }
-       
+
        public void setIsVarArgs(boolean isVarArgs) {
                this.isVarArgs = isVarArgs;
                left.setIsVarArgs(isVarArgs);
                right.setIsVarArgs(isVarArgs);
        }
-       
+
        public void setAnnotationTypePattern(AnnotationTypePattern annPatt) {
-               if (annPatt == AnnotationTypePattern.ANY) return;
+               if (annPatt == AnnotationTypePattern.ANY) {
+                       return;
+               }
                if (left.annotationPattern == AnnotationTypePattern.ANY) {
                        left.setAnnotationTypePattern(annPatt);
                } else {
-                       left.setAnnotationTypePattern(
-                                       new AndAnnotationTypePattern(left.annotationPattern,annPatt));
+                       left.setAnnotationTypePattern(new AndAnnotationTypePattern(left.annotationPattern, annPatt));
                }
                if (right.annotationPattern == AnnotationTypePattern.ANY) {
-                       right.setAnnotationTypePattern(annPatt);                        
+                       right.setAnnotationTypePattern(annPatt);
                } else {
-                       right.setAnnotationTypePattern(
-                                       new AndAnnotationTypePattern(right.annotationPattern,annPatt));                 
+                       right.setAnnotationTypePattern(new AndAnnotationTypePattern(right.annotationPattern, annPatt));
                }
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.AND);
                left.write(s);
                right.write(s);
                writeLocation(s);
        }
-       
+
        public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AndTypePattern ret = new AndTypePattern(TypePattern.read(s, context), TypePattern.read(s, context));
                ret.readLocation(context, s);
-               if (ret.left.isVarArgs && ret.right.isVarArgs) ret.isVarArgs = true;
+               if (ret.left.isVarArgs && ret.right.isVarArgs) {
+                       ret.isVarArgs = true;
+               }
                return ret;
        }
 
-       public TypePattern resolveBindings(
-               IScope scope,
-               Bindings bindings,
-               boolean allowBinding, boolean requireExactType)
-       {
-               if (requireExactType) return notExactType(scope);
+       public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
+               if (requireExactType) {
+                       return notExactType(scope);
+               }
                left = left.resolveBindings(scope, bindings, false, false);
                right = right.resolveBindings(scope, bindings, false, false);
                return this;
        }
-       
-       public TypePattern parameterizeWith(Map typeVariableMap,World w) {
-               TypePattern newLeft = left.parameterizeWith(typeVariableMap,w);
-               TypePattern newRight = right.parameterizeWith(typeVariableMap,w);
-               AndTypePattern ret = new AndTypePattern(newLeft,newRight);
+
+       public TypePattern parameterizeWith(Map typeVariableMap, World w) {
+               TypePattern newLeft = left.parameterizeWith(typeVariableMap, w);
+               TypePattern newRight = right.parameterizeWith(typeVariableMap, w);
+               AndTypePattern ret = new AndTypePattern(newLeft, newRight);
                ret.copyLocationFrom(this);
                return ret;
        }
-       
+
        public String toString() {
                StringBuffer buff = new StringBuffer();
                if (annotationPattern != AnnotationTypePattern.ANY) {
@@ -134,16 +135,18 @@ public class AndTypePattern extends TypePattern {
                return buff.toString();
        }
 
-    public TypePattern getLeft() {
-        return left;
-    }
+       public TypePattern getLeft() {
+               return left;
+       }
 
-    public TypePattern getRight() {
-        return right;
-    }
+       public TypePattern getRight() {
+               return right;
+       }
 
        public boolean equals(Object obj) {
-               if (! (obj instanceof AndTypePattern)) return false;
+               if (!(obj instanceof AndTypePattern)) {
+                       return false;
+               }
                AndTypePattern atp = (AndTypePattern) obj;
                return left.equals(atp.left) && right.equals(atp.right);
        }
@@ -151,8 +154,10 @@ public class AndTypePattern extends TypePattern {
        public boolean isStarAnnotation() {
                return left.isStarAnnotation() && right.isStarAnnotation();
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see java.lang.Object#hashCode()
         */
        public int hashCode() {
@@ -162,12 +167,12 @@ public class AndTypePattern extends TypePattern {
                return ret;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
+               Object ret = accept(visitor, data);
                left.traverse(visitor, ret);
                right.traverse(visitor, ret);
                return ret;
index f423eb350dd50c82a600f2a00f0948eda3b354f1..6b6d820b708047987dc23d7922d9e79f022148e2 100644 (file)
@@ -9,12 +9,12 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -23,21 +23,20 @@ import org.aspectj.weaver.World;
 
 /**
  * @author colyer
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * 
+ *         TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
+ *         Templates
  */
 public class AnnotationPatternList extends PatternNode {
 
        private AnnotationTypePattern[] typePatterns;
        int ellipsisCount = 0;
-       
-       public static final AnnotationPatternList EMPTY =
-               new AnnotationPatternList(new AnnotationTypePattern[] {});
-       
-       public static final AnnotationPatternList ANY =
-           new AnnotationPatternList(new AnnotationTypePattern[] {AnnotationTypePattern.ELLIPSIS});
-       
+
+       public static final AnnotationPatternList EMPTY = new AnnotationPatternList(new AnnotationTypePattern[] {});
+
+       public static final AnnotationPatternList ANY = new AnnotationPatternList(
+                       new AnnotationTypePattern[] { AnnotationTypePattern.ELLIPSIS });
+
        public AnnotationPatternList() {
                typePatterns = new AnnotationTypePattern[0];
                ellipsisCount = 0;
@@ -45,11 +44,13 @@ public class AnnotationPatternList extends PatternNode {
 
        public AnnotationPatternList(AnnotationTypePattern[] arguments) {
                this.typePatterns = arguments;
-               for (int i=0; i<arguments.length; i++) {
-                       if (arguments[i] == AnnotationTypePattern.ELLIPSIS) ellipsisCount++;
+               for (int i = 0; i < arguments.length; i++) {
+                       if (arguments[i] == AnnotationTypePattern.ELLIPSIS) {
+                               ellipsisCount++;
+                       }
                }
        }
-       
+
        public AnnotationPatternList(List l) {
                this((AnnotationTypePattern[]) l.toArray(new AnnotationTypePattern[l.size()]));
        }
@@ -57,34 +58,36 @@ public class AnnotationPatternList extends PatternNode {
        protected AnnotationTypePattern[] getAnnotationPatterns() {
                return typePatterns;
        }
-       
-       public AnnotationPatternList parameterizeWith(Map typeVariableMap,World w) {
+
+       public AnnotationPatternList parameterizeWith(Map typeVariableMap, World w) {
                AnnotationTypePattern[] parameterizedPatterns = new AnnotationTypePattern[this.typePatterns.length];
                for (int i = 0; i < parameterizedPatterns.length; i++) {
-                       parameterizedPatterns[i] = this.typePatterns[i].parameterizeWith(typeVariableMap,w);
+                       parameterizedPatterns[i] = this.typePatterns[i].parameterizeWith(typeVariableMap, w);
                }
                AnnotationPatternList ret = new AnnotationPatternList(parameterizedPatterns);
                ret.copyLocationFrom(this);
                return ret;
        }
-       
+
        public void resolve(World inWorld) {
                for (int i = 0; i < typePatterns.length; i++) {
                        typePatterns[i].resolve(inWorld);
                }
        }
-       
+
        public FuzzyBoolean matches(ResolvedType[] someArgs) {
                // do some quick length tests first
-               int numArgsMatchedByEllipsis = (someArgs.length + ellipsisCount) - typePatterns.length;
-               if (numArgsMatchedByEllipsis < 0) return FuzzyBoolean.NO;
+               int numArgsMatchedByEllipsis = (someArgs.length + ellipsisCount) - typePatterns.length;
+               if (numArgsMatchedByEllipsis < 0) {
+                       return FuzzyBoolean.NO;
+               }
                if ((numArgsMatchedByEllipsis > 0) && (ellipsisCount == 0)) {
                        return FuzzyBoolean.NO;
                }
                // now work through the args and the patterns, skipping at ellipsis
-       FuzzyBoolean ret = FuzzyBoolean.YES;
-       int argsIndex = 0;
-       for (int i = 0; i < typePatterns.length; i++) {
+               FuzzyBoolean ret = FuzzyBoolean.YES;
+               int argsIndex = 0;
+               for (int i = 0; i < typePatterns.length; i++) {
                        if (typePatterns[i] == AnnotationTypePattern.ELLIPSIS) {
                                // match ellipsisMatchCount args
                                argsIndex += numArgsMatchedByEllipsis;
@@ -93,28 +96,32 @@ public class AnnotationPatternList extends PatternNode {
                        } else {
                                // match the argument type at argsIndex with the ExactAnnotationTypePattern
                                // we know it is exact because nothing else is allowed in args
-                               if (someArgs[argsIndex].isPrimitiveType()) return FuzzyBoolean.NO; // can never match
-                               ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)typePatterns[i];
+                               if (someArgs[argsIndex].isPrimitiveType()) {
+                                       return FuzzyBoolean.NO; // can never match
+                               }
+                               ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern) typePatterns[i];
                                FuzzyBoolean matches = ap.matchesRuntimeType(someArgs[argsIndex]);
                                if (matches == FuzzyBoolean.NO) {
-                                       return FuzzyBoolean.MAYBE;  // could still match at runtime
+                                       return FuzzyBoolean.MAYBE; // could still match at runtime
                                } else {
                                        argsIndex++;
                                        ret = ret.and(matches);
                                }
                        }
-               }       
-       return ret;
+               }
+               return ret;
        }
-       
-       public int size() { return typePatterns.length; }
-       
+
+       public int size() {
+               return typePatterns.length;
+       }
+
        public AnnotationTypePattern get(int index) {
                return typePatterns[index];
        }
 
        public AnnotationPatternList resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) {
-               for (int i=0; i<typePatterns.length; i++) {
+               for (int i = 0; i < typePatterns.length; i++) {
                        AnnotationTypePattern p = typePatterns[i];
                        if (p != null) {
                                typePatterns[i] = typePatterns[i].resolveBindings(scope, bindings, allowBinding);
@@ -122,56 +129,64 @@ public class AnnotationPatternList extends PatternNode {
                }
                return this;
        }
-       
+
        public AnnotationPatternList resolveReferences(IntMap bindings) {
                int len = typePatterns.length;
                AnnotationTypePattern[] ret = new AnnotationTypePattern[len];
-               for (int i=0; i < len; i++) {
+               for (int i = 0; i < len; i++) {
                        ret[i] = typePatterns[i].remapAdviceFormals(bindings);
                }
                return new AnnotationPatternList(ret);
        }
 
-    public String toString() {
-       StringBuffer buf = new StringBuffer();
-       buf.append("(");
-       for (int i=0, len=typePatterns.length; i < len; i++) {
-               AnnotationTypePattern type = typePatterns[i];
-               if (i > 0) buf.append(", ");
-               if (type == AnnotationTypePattern.ELLIPSIS) {
-                       buf.append("..");
-               } else {
-                       String annPatt = type.toString();
-                       buf.append(annPatt.startsWith("@") ? annPatt.substring(1) : annPatt);
-               }
-       }
-       buf.append(")");
-       return buf.toString();
-    }
-    
+       public String toString() {
+               StringBuffer buf = new StringBuffer();
+               buf.append("(");
+               for (int i = 0, len = typePatterns.length; i < len; i++) {
+                       AnnotationTypePattern type = typePatterns[i];
+                       if (i > 0) {
+                               buf.append(", ");
+                       }
+                       if (type == AnnotationTypePattern.ELLIPSIS) {
+                               buf.append("..");
+                       } else {
+                               String annPatt = type.toString();
+                               buf.append(annPatt.startsWith("@") ? annPatt.substring(1) : annPatt);
+                       }
+               }
+               buf.append(")");
+               return buf.toString();
+       }
+
        public boolean equals(Object other) {
-               if (!(other instanceof AnnotationPatternList)) return false;
-               AnnotationPatternList o = (AnnotationPatternList)other;
+               if (!(other instanceof AnnotationPatternList)) {
+                       return false;
+               }
+               AnnotationPatternList o = (AnnotationPatternList) other;
                int len = o.typePatterns.length;
-               if (len != this.typePatterns.length) return false;
-               for (int i=0; i<len; i++) {
-                       if (!this.typePatterns[i].equals(o.typePatterns[i])) return false;
+               if (len != this.typePatterns.length) {
+                       return false;
+               }
+               for (int i = 0; i < len; i++) {
+                       if (!this.typePatterns[i].equals(o.typePatterns[i])) {
+                               return false;
+                       }
                }
                return true;
        }
-       
-    public int hashCode() {
-        int result = 41;
-        for (int i = 0, len = typePatterns.length; i < len; i++) {
-            result = 37*result + typePatterns[i].hashCode();
-        }
-        return result;
-    }
-    
-       public static AnnotationPatternList read(VersionedDataInputStream s, ISourceContext context) throws IOException  {
+
+       public int hashCode() {
+               int result = 41;
+               for (int i = 0, len = typePatterns.length; i < len; i++) {
+                       result = 37 * result + typePatterns[i].hashCode();
+               }
+               return result;
+       }
+
+       public static AnnotationPatternList read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                short len = s.readShort();
                AnnotationTypePattern[] arguments = new AnnotationTypePattern[len];
-               for (int i=0; i<len; i++) {
+               for (int i = 0; i < len; i++) {
                        arguments[i] = AnnotationTypePattern.read(s, context);
                }
                AnnotationPatternList ret = new AnnotationPatternList(arguments);
@@ -179,23 +194,22 @@ public class AnnotationPatternList extends PatternNode {
                return ret;
        }
 
-
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeShort(typePatterns.length);
-               for (int i=0; i<typePatterns.length; i++) {
+               for (int i = 0; i < typePatterns.length; i++) {
                        typePatterns[i].write(s);
                }
                writeLocation(s);
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
                Object ret = accept(visitor, data);
                for (int i = 0; i < typePatterns.length; i++) {
-                       typePatterns[i].traverse(visitor,ret);
+                       typePatterns[i].traverse(visitor, ret);
                }
                return ret;
        }
index 184615b6aab7d6c9c7f0ca5073b3966e9274694c..261e3a48168c60d2dc254c07501c01e4519e5807 100644 (file)
@@ -10,7 +10,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -23,6 +22,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AjcMemberMaker;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ConcreteTypeMunger;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
@@ -160,8 +160,9 @@ public class AnnotationPointcut extends NameBindingPointcut {
                ResolvedMember decMethods[] = aspectType.getDeclaredMethods();
                for (int i = 0; i < decMethods.length; i++) {
                        ResolvedMember member = decMethods[i];
-                       if (member.equals(ajcMethod))
+                       if (member.equals(ajcMethod)) {
                                return member;
+                       }
                }
                return null;
        }
@@ -230,18 +231,20 @@ public class AnnotationPointcut extends NameBindingPointcut {
                        // "]  shadow=["+shadow+" at "+shadow.getSourceLocation()+
                        // "]    pointcut is at ["+getSourceLocation()+"]");
                        if (var == null) {
-                               if (matchInternal(shadow).alwaysTrue())
+                               if (matchInternal(shadow).alwaysTrue()) {
                                        return Literal.TRUE;
-                               else
+                               } else {
                                        return Literal.FALSE;
+                               }
                        }
                        state.set(btp.getFormalIndex(), var);
                }
 
-               if (matchInternal(shadow).alwaysTrue())
+               if (matchInternal(shadow).alwaysTrue()) {
                        return Literal.TRUE;
-               else
+               } else {
                        return Literal.FALSE;
+               }
        }
 
        /*
@@ -254,8 +257,9 @@ public class AnnotationPointcut extends NameBindingPointcut {
                        List l = new ArrayList();
                        l.add(annotationTypePattern);
                        return l;
-               } else
+               } else {
                        return Collections.EMPTY_LIST;
+               }
        }
 
        /*
@@ -272,7 +276,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
         * 
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.ANNOTATION);
                annotationTypePattern.write(s);
                writeLocation(s);
@@ -286,8 +290,9 @@ public class AnnotationPointcut extends NameBindingPointcut {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof AnnotationPointcut))
+               if (!(other instanceof AnnotationPointcut)) {
                        return false;
+               }
                AnnotationPointcut o = (AnnotationPointcut) other;
                return o.annotationTypePattern.equals(this.annotationTypePattern);
        }
index 1d0a1cedfaa3e16fa2762ae2c7d09b616a104aef..88b84867d0befc8e9049d65ab8d736578176d685 100644 (file)
@@ -9,13 +9,13 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -124,7 +124,7 @@ class EllipsisAnnotationTypePattern extends AnnotationTypePattern {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.ELLIPSIS_KEY);
        }
 
index 245807df035b0c69be43050c0cf2e3df73f332d2..8af265b74e6bb2ea263a4f6a60a9026c2e158da7 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.World;
 
@@ -38,7 +38,7 @@ public class AnyAnnotationTypePattern extends AnnotationTypePattern {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.ANY_KEY);
        }
 
index 5c749cabd8ca7030696315b6253911ab3b936c5e..4339088138274634c25b8176405c9fed1efcd229 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -20,6 +19,7 @@ import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -34,9 +34,9 @@ import org.aspectj.weaver.ast.Var;
 
 /**
  * @author colyer
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * 
+ *         TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
+ *         Templates
  */
 public class ArgsAnnotationPointcut extends NameBindingPointcut {
 
@@ -53,39 +53,45 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
                buildDeclarationText();
        }
 
-    public AnnotationPatternList getArguments() {
-        return arguments;
-    }
+       public AnnotationPatternList getArguments() {
+               return arguments;
+       }
 
        public int couldMatchKinds() {
-               return Shadow.ALL_SHADOW_KINDS_BITS;  // empty args() matches jps with no args
+               return Shadow.ALL_SHADOW_KINDS_BITS; // empty args() matches jps with no args
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-               ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(arguments.parameterizeWith(typeVariableMap,w));
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(arguments.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#fastMatch(org.aspectj.weaver.patterns.FastMatchInfo)
         */
        public FuzzyBoolean fastMatch(FastMatchInfo info) {
                return FuzzyBoolean.MAYBE;
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#match(org.aspectj.weaver.Shadow)
         */
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                arguments.resolve(shadow.getIWorld());
-               FuzzyBoolean ret =
-                       arguments.matches(shadow.getIWorld().resolve(shadow.getArgTypes()));
+               FuzzyBoolean ret = arguments.matches(shadow.getIWorld().resolve(shadow.getArgTypes()));
                return ret;
        }
 
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.patterns.Pointcut#resolveBindings(org.aspectj.weaver.patterns.IScope, org.aspectj.weaver.patterns.Bindings)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.aspectj.weaver.patterns.Pointcut#resolveBindings(org.aspectj.weaver.patterns.IScope,
+        * org.aspectj.weaver.patterns.Bindings)
         */
        protected void resolveBindings(IScope scope, Bindings bindings) {
                if (!scope.getWorld().isInJava5Mode()) {
@@ -95,21 +101,21 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
                }
                arguments.resolveBindings(scope, bindings, true);
                if (arguments.ellipsisCount > 1) {
-                       scope.message(IMessage.ERROR, this,
-                                       "uses more than one .. in args (compiler limitation)");
+                       scope.message(IMessage.ERROR, this, "uses more than one .. in args (compiler limitation)");
                }
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#concretize1(org.aspectj.weaver.ResolvedType, org.aspectj.weaver.IntMap)
         */
        protected Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                if (isDeclare(bindings.getEnclosingAdvice())) {
-                         // Enforce rule about which designators are supported in declare
-                         inAspect.getWorld().showMessage(IMessage.ERROR,
-                                       WeaverMessages.format(WeaverMessages.ARGS_IN_DECLARE),
+                       // Enforce rule about which designators are supported in declare
+                       inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ARGS_IN_DECLARE),
                                        bindings.getEnclosingAdvice().getSourceLocation(), null);
-                         return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
+                       return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
                }
                AnnotationPatternList list = arguments.resolveReferences(bindings);
                Pointcut ret = new ArgsAnnotationPointcut(list);
@@ -117,22 +123,26 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
                return ret;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#findResidue(org.aspectj.weaver.Shadow, org.aspectj.weaver.patterns.ExposedState)
         */
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                int len = shadow.getArgCount();
-       
+
                // do some quick length tests first
                int numArgsMatchedByEllipsis = (len + arguments.ellipsisCount) - arguments.size();
-               if (numArgsMatchedByEllipsis < 0) return Literal.FALSE;  // should never happen
+               if (numArgsMatchedByEllipsis < 0) {
+                       return Literal.FALSE; // should never happen
+               }
                if ((numArgsMatchedByEllipsis > 0) && (arguments.ellipsisCount == 0)) {
                        return Literal.FALSE; // should never happen
                }
                // now work through the args and the patterns, skipping at ellipsis
-       Test ret = Literal.TRUE;
-       int argsIndex = 0;
-       for (int i = 0; i < arguments.size(); i++) {
+               Test ret = Literal.TRUE;
+               int argsIndex = 0;
+               for (int i = 0; i < arguments.size(); i++) {
                        if (arguments.get(i) == AnnotationTypePattern.ELLIPSIS) {
                                // match ellipsisMatchCount args
                                argsIndex += numArgsMatchedByEllipsis;
@@ -141,41 +151,37 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
                        } else {
                                // match the argument type at argsIndex with the ExactAnnotationTypePattern
                                // we know it is exact because nothing else is allowed in args
-                               ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)arguments.get(i);
+                               ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern) arguments.get(i);
                                UnresolvedType argType = shadow.getArgType(argsIndex);
                                ResolvedType rArgType = argType.resolve(shadow.getIWorld());
                                if (rArgType.isMissing()) {
-                                       shadow.getIWorld().getLint().cantFindType.signal(
-                                                       new String[] {WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_ARG_TYPE,argType.getName())},
-                                                       shadow.getSourceLocation(),
-                                                       new ISourceLocation[]{getSourceLocation()}
-                                                       );
-//                       IMessage msg = new Message(
-//                         WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_ARG_TYPE,argType.getName()),
-//                         "",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()});
-                   }
+                                       shadow.getIWorld().getLint().cantFindType.signal(new String[] { WeaverMessages.format(
+                                                       WeaverMessages.CANT_FIND_TYPE_ARG_TYPE, argType.getName()) }, shadow.getSourceLocation(),
+                                                       new ISourceLocation[] { getSourceLocation() });
+                                       // IMessage msg = new Message(
+                                       // WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_ARG_TYPE,argType.getName()),
+                                       // "",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()});
+                               }
 
                                ResolvedType rAnnType = ap.getAnnotationType().resolve(shadow.getIWorld());
                                if (ap instanceof BindingAnnotationTypePattern) {
-                                       BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)ap;
-                                       Var annvar = shadow.getArgAnnotationVar(argsIndex,rAnnType);
-                                       state.set(btp.getFormalIndex(),annvar);
+                                       BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern) ap;
+                                       Var annvar = shadow.getArgAnnotationVar(argsIndex, rAnnType);
+                                       state.set(btp.getFormalIndex(), annvar);
                                }
                                if (!ap.matches(rArgType).alwaysTrue()) {
                                        // we need a test...
-                                       ret = Test.makeAnd(ret,
-                                                               Test.makeHasAnnotation(
-                                                                               shadow.getArgVar(argsIndex),
-                                                                               rAnnType));
-                               }                       
+                                       ret = Test.makeAnd(ret, Test.makeHasAnnotation(shadow.getArgVar(argsIndex), rAnnType));
+                               }
                                argsIndex++;
                        }
-               }       
-       return ret;
+               }
+               return ret;
        }
 
-       
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns()
         */
        public List getBindingAnnotationTypePatterns() {
@@ -188,58 +194,72 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
                }
                return l;
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns()
         */
        public List getBindingTypePatterns() {
-               return Collections.EMPTY_LIST; 
+               return Collections.EMPTY_LIST;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.ATARGS);
                arguments.write(s);
                writeLocation(s);
        }
-       
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
-               AnnotationPatternList annotationPatternList = AnnotationPatternList.read(s,context);
+               AnnotationPatternList annotationPatternList = AnnotationPatternList.read(s, context);
                ArgsAnnotationPointcut ret = new ArgsAnnotationPointcut(annotationPatternList);
                ret.readLocation(context, s);
                return ret;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see java.lang.Object#equals(java.lang.Object)
         */
        public boolean equals(Object obj) {
-               if (!(obj instanceof ArgsAnnotationPointcut)) return false;
+               if (!(obj instanceof ArgsAnnotationPointcut)) {
+                       return false;
+               }
                ArgsAnnotationPointcut other = (ArgsAnnotationPointcut) obj;
                return other.arguments.equals(arguments);
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see java.lang.Object#hashCode()
         */
        public int hashCode() {
-               return 17 + 37*arguments.hashCode();
-       }
-       
-       /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
-    private void buildDeclarationText() {
-        StringBuffer buf = new StringBuffer("@args");
-        buf.append(arguments.toString());
-        this.declarationText = buf.toString();
-    }
-    
-    public String toString() { return this.declarationText; }
-
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
+               return 17 + 37 * arguments.hashCode();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see java.lang.Object#toString()
+        */
+       private void buildDeclarationText() {
+               StringBuffer buf = new StringBuffer("@args");
+               buf.append(arguments.toString());
+               this.declarationText = buf.toString();
+       }
+
+       public String toString() {
+               return this.declarationText;
+       }
+
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 }
index 68d2d62f1165be46077074a017818f822b43debe..c10e090d4469c1647bfa1ba1addb634055531ea0 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -24,6 +22,7 @@ import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -44,56 +43,56 @@ import org.aspectj.weaver.ast.Test;
 public class ArgsPointcut extends NameBindingPointcut {
        private static final String ASPECTJ_JP_SIGNATURE_PREFIX = "Lorg/aspectj/lang/JoinPoint";
        private static final String ASPECTJ_SYNTHETIC_SIGNATURE_PREFIX = "Lorg/aspectj/runtime/internal/";
-       
+
        private TypePatternList arguments;
        private String stringRepresentation;
-       
+
        public ArgsPointcut(TypePatternList arguments) {
                this.arguments = arguments;
                this.pointcutKind = ARGS;
                this.stringRepresentation = "args" + arguments.toString() + "";
        }
 
-    public TypePatternList getArguments() {
-        return arguments;
-    }
+       public TypePatternList getArguments() {
+               return arguments;
+       }
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               ArgsPointcut ret = new ArgsPointcut(this.arguments.parameterizeWith(typeVariableMap, w));
+               ret.copyLocationFrom(this);
+               return ret;
+       }
 
-    public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-       ArgsPointcut ret = new ArgsPointcut(this.arguments.parameterizeWith(typeVariableMap,w));
-       ret.copyLocationFrom(this);
-       return ret;
-    }
-    
        public int couldMatchKinds() {
-               return Shadow.ALL_SHADOW_KINDS_BITS;  // empty args() matches jps with no args
+               return Shadow.ALL_SHADOW_KINDS_BITS; // empty args() matches jps with no args
        }
 
-    public FuzzyBoolean fastMatch(FastMatchInfo type) {
+       public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return FuzzyBoolean.MAYBE;
        }
-       
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                ResolvedType[] argumentsToMatchAgainst = getArgumentsToMatchAgainst(shadow);
-               FuzzyBoolean ret =
-                       arguments.matches(argumentsToMatchAgainst, TypePattern.DYNAMIC);
+               FuzzyBoolean ret = arguments.matches(argumentsToMatchAgainst, TypePattern.DYNAMIC);
                return ret;
        }
-       
+
        private ResolvedType[] getArgumentsToMatchAgainst(Shadow shadow) {
-               
+
                if (shadow.isShadowForArrayConstructionJoinpoint()) {
-                  return shadow.getArgumentTypesForArrayConstructionShadow();
+                       return shadow.getArgumentTypesForArrayConstructionShadow();
                }
-               
+
                ResolvedType[] argumentsToMatchAgainst = shadow.getIWorld().resolve(shadow.getGenericArgTypes());
-               
+
                // special treatment for adviceexecution which may have synthetic arguments we
                // want to ignore.
                if (shadow.getKind() == Shadow.AdviceExecution) {
                        int numExtraArgs = 0;
                        for (int i = 0; i < argumentsToMatchAgainst.length; i++) {
                                String argumentSignature = argumentsToMatchAgainst[i].getSignature();
-                               if (argumentSignature.startsWith(ASPECTJ_JP_SIGNATURE_PREFIX) || argumentSignature.startsWith(ASPECTJ_SYNTHETIC_SIGNATURE_PREFIX)) {
+                               if (argumentSignature.startsWith(ASPECTJ_JP_SIGNATURE_PREFIX)
+                                               || argumentSignature.startsWith(ASPECTJ_SYNTHETIC_SIGNATURE_PREFIX)) {
                                        numExtraArgs++;
                                } else {
                                        // normal arg after AJ type means earlier arg was NOT synthetic
@@ -106,27 +105,31 @@ public class ArgsPointcut extends NameBindingPointcut {
                                System.arraycopy(argumentsToMatchAgainst, 0, argsSubset, 0, newArgLength);
                                argumentsToMatchAgainst = argsSubset;
                        }
-               } else if (shadow.getKind() == Shadow.ConstructorExecution) {           
+               } else if (shadow.getKind() == Shadow.ConstructorExecution) {
                        if (shadow.getMatchingSignature().getParameterTypes().length < argumentsToMatchAgainst.length) {
-                               // there are one or more synthetic args on the end, caused by non-public itd constructor 
+                               // there are one or more synthetic args on the end, caused by non-public itd constructor
                                int newArgLength = shadow.getMatchingSignature().getParameterTypes().length;
                                ResolvedType[] argsSubset = new ResolvedType[newArgLength];
                                System.arraycopy(argumentsToMatchAgainst, 0, argsSubset, 0, newArgLength);
-                               argumentsToMatchAgainst = argsSubset;                           
+                               argumentsToMatchAgainst = argsSubset;
                        }
                }
-               
+
                return argumentsToMatchAgainst;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns()
         */
        public List getBindingAnnotationTypePatterns() {
-               return Collections.EMPTY_LIST; 
+               return Collections.EMPTY_LIST;
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns()
         */
        public List getBindingTypePatterns() {
@@ -139,50 +142,48 @@ public class ArgsPointcut extends NameBindingPointcut {
                }
                return l;
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.ARGS);
                arguments.write(s);
                writeLocation(s);
        }
-       
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                ArgsPointcut ret = new ArgsPointcut(TypePatternList.read(s, context));
                ret.readLocation(context, s);
                return ret;
        }
 
-       
        public boolean equals(Object other) {
-               if (!(other instanceof ArgsPointcut)) return false;
-               ArgsPointcut o = (ArgsPointcut)other;
+               if (!(other instanceof ArgsPointcut)) {
+                       return false;
+               }
+               ArgsPointcut o = (ArgsPointcut) other;
                return o.arguments.equals(this.arguments);
        }
 
-    public int hashCode() {
-        return arguments.hashCode();
-    }
-  
+       public int hashCode() {
+               return arguments.hashCode();
+       }
+
        public void resolveBindings(IScope scope, Bindings bindings) {
                arguments.resolveBindings(scope, bindings, true, true);
                if (arguments.ellipsisCount > 1) {
-                       scope.message(IMessage.ERROR, this,
-                                       "uses more than one .. in args (compiler limitation)");
+                       scope.message(IMessage.ERROR, this, "uses more than one .. in args (compiler limitation)");
                }
        }
-       
+
        public void postRead(ResolvedType enclosingType) {
                arguments.postRead(enclosingType);
        }
 
-
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                if (isDeclare(bindings.getEnclosingAdvice())) {
-                 // Enforce rule about which designators are supported in declare
-                 inAspect.getWorld().showMessage(IMessage.ERROR,
-                               WeaverMessages.format(WeaverMessages.ARGS_IN_DECLARE),
-                               bindings.getEnclosingAdvice().getSourceLocation(), null);
-                 return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
+                       // Enforce rule about which designators are supported in declare
+                       inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ARGS_IN_DECLARE),
+                                       bindings.getEnclosingAdvice().getSourceLocation(), null);
+                       return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
                }
                TypePatternList args = arguments.resolveReferences(bindings);
                if (inAspect.crosscuttingMembers != null) {
@@ -196,29 +197,27 @@ public class ArgsPointcut extends NameBindingPointcut {
        private Test findResidueNoEllipsis(Shadow shadow, ExposedState state, TypePattern[] patterns) {
                ResolvedType[] argumentsToMatchAgainst = getArgumentsToMatchAgainst(shadow);
                int len = argumentsToMatchAgainst.length;
-               //System.err.println("boudn to : " + len + ", " + patterns.length);
+               // System.err.println("boudn to : " + len + ", " + patterns.length);
                if (patterns.length != len) {
                        return Literal.FALSE;
                }
-               
+
                Test ret = Literal.TRUE;
-               
-               for (int i=0; i < len; i++) {
+
+               for (int i = 0; i < len; i++) {
                        UnresolvedType argType = shadow.getGenericArgTypes()[i];
                        TypePattern type = patterns[i];
-            ResolvedType argRTX = shadow.getIWorld().resolve(argType,true);
+                       ResolvedType argRTX = shadow.getIWorld().resolve(argType, true);
                        if (!(type instanceof BindingTypePattern)) {
-                if (argRTX.isMissing()) {
-                                       shadow.getIWorld().getLint().cantFindType.signal(
-                                                       new String[] {WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_ARG_TYPE,argType.getName())},
-                                                       shadow.getSourceLocation(),
-                                                       new ISourceLocation[]{getSourceLocation()}
-                                                       );
-//                  IMessage msg = new Message(
-//                    WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_ARG_TYPE,argType.getName()),
-//                    "",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()});
-//                  shadow.getIWorld().getMessageHandler().handleMessage(msg);
-                }
+                               if (argRTX.isMissing()) {
+                                       shadow.getIWorld().getLint().cantFindType.signal(new String[] { WeaverMessages.format(
+                                                       WeaverMessages.CANT_FIND_TYPE_ARG_TYPE, argType.getName()) }, shadow.getSourceLocation(),
+                                                       new ISourceLocation[] { getSourceLocation() });
+                                       // IMessage msg = new Message(
+                                       // WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_ARG_TYPE,argType.getName()),
+                                       // "",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()});
+                                       // shadow.getIWorld().getMessageHandler().handleMessage(msg);
+                               }
                                if (type.matchesInstanceof(argRTX).alwaysTrue()) {
                                        continue;
                                }
@@ -227,42 +226,36 @@ public class ArgsPointcut extends NameBindingPointcut {
                        World world = shadow.getIWorld();
                        ResolvedType typeToExpose = type.getExactType().resolve(world);
                        if (typeToExpose.isParameterizedType()) {
-                               boolean inDoubt = (type.matchesInstanceof(argRTX) == FuzzyBoolean.MAYBE);                               
+                               boolean inDoubt = (type.matchesInstanceof(argRTX) == FuzzyBoolean.MAYBE);
                                if (inDoubt && world.getLint().uncheckedArgument.isEnabled()) {
                                        String uncheckedMatchWith = typeToExpose.getSimpleBaseName();
                                        if (argRTX.isParameterizedType() && (argRTX.getRawType() == typeToExpose.getRawType())) {
                                                uncheckedMatchWith = argRTX.getSimpleName();
                                        }
                                        if (!isUncheckedArgumentWarningSuppressed()) {
-                                               world.getLint().uncheckedArgument.signal(
-                                                               new String[] {
-                                                                               typeToExpose.getSimpleName(),
-                                                                               uncheckedMatchWith,
-                                                                               typeToExpose.getSimpleBaseName(),
-                                                                               shadow.toResolvedString(world)},
-                                                               getSourceLocation(),
-                                                               new ISourceLocation[] {shadow.getSourceLocation()});
-                                               }
+                                               world.getLint().uncheckedArgument.signal(new String[] { typeToExpose.getSimpleName(), uncheckedMatchWith,
+                                                               typeToExpose.getSimpleBaseName(), shadow.toResolvedString(world) }, getSourceLocation(),
+                                                               new ISourceLocation[] { shadow.getSourceLocation() });
+                                       }
                                }
-                       }                       
-                       
-                       ret = Test.makeAnd(ret,
-                               exposeStateForVar(shadow.getArgVar(i), type, state,shadow.getIWorld()));
+                       }
+
+                       ret = Test.makeAnd(ret, exposeStateForVar(shadow.getArgVar(i), type, state, shadow.getIWorld()));
                }
-               
-               return ret;             
+
+               return ret;
        }
 
        /**
-        * We need to find out if someone has put the @SuppressAjWarnings{"uncheckedArgument"}
-        * annotation somewhere. That somewhere is going to be an a piece of advice that uses this
-        * pointcut. But how do we find it???
+        * We need to find out if someone has put the @SuppressAjWarnings{"uncheckedArgument"} annotation somewhere. That somewhere is
+        * going to be an a piece of advice that uses this pointcut. But how do we find it???
+        * 
         * @return
         */
        private boolean isUncheckedArgumentWarningSuppressed() {
                return false;
        }
-       
+
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                ResolvedType[] argsToMatch = getArgumentsToMatchAgainst(shadow);
                if (arguments.matches(argsToMatch, TypePattern.DYNAMIC).alwaysFalse()) {
@@ -270,7 +263,7 @@ public class ArgsPointcut extends NameBindingPointcut {
                }
                int ellipsisCount = arguments.ellipsisCount;
                if (ellipsisCount == 0) {
-                       return findResidueNoEllipsis(shadow, state, arguments.getTypePatterns());               
+                       return findResidueNoEllipsis(shadow, state, arguments.getTypePatterns());
                } else if (ellipsisCount == 1) {
                        TypePattern[] patternsWithEllipsis = arguments.getTypePatterns();
                        TypePattern[] patternsWithoutEllipsis = new TypePattern[argsToMatch.length];
@@ -282,8 +275,7 @@ public class ArgsPointcut extends NameBindingPointcut {
                        while (indexWithoutEllipsis < lenWithoutEllipsis) {
                                TypePattern p = patternsWithEllipsis[indexWithEllipsis++];
                                if (p == TypePattern.ELLIPSIS) {
-                                       int newLenWithoutEllipsis =
-                                               lenWithoutEllipsis - (lenWithEllipsis-indexWithEllipsis);
+                                       int newLenWithoutEllipsis = lenWithoutEllipsis - (lenWithEllipsis - indexWithEllipsis);
                                        while (indexWithoutEllipsis < newLenWithoutEllipsis) {
                                                patternsWithoutEllipsis[indexWithoutEllipsis++] = TypePattern.ANY;
                                        }
@@ -296,12 +288,12 @@ public class ArgsPointcut extends NameBindingPointcut {
                        throw new BCException("unimplemented");
                }
        }
-       
+
        public String toString() {
                return this.stringRepresentation;
        }
-       
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
+
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 }
index 96a651e7fe27ff34b22bb8cd197a2ad5742fb325..47c4d4fb3e881d38d73d467a0cf20ce586cabef3 100644 (file)
@@ -11,7 +11,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
@@ -20,6 +19,7 @@ import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ReferenceType;
@@ -39,133 +39,138 @@ import org.aspectj.weaver.World;
  */
 public class BindingAnnotationFieldTypePattern extends ExactAnnotationTypePattern implements BindingPattern {
 
-    protected int formalIndex;
-    UnresolvedType formalType; // In this construct the formal type differs from the annotation type
-
-    public BindingAnnotationFieldTypePattern(UnresolvedType formalType, int formalIndex, UnresolvedType theAnnotationType) {
-        super(theAnnotationType, null);
-        this.formalIndex = formalIndex;
-        this.formalType = formalType;
-    }
-
-    public void resolveBinding(World world) {
-        if (resolved) return;
-        resolved = true;
-        formalType = world.resolve(formalType);
-        annotationType = world.resolve(annotationType);
-        ResolvedType annoType = (ResolvedType) annotationType;
-        if (!annoType.isAnnotation()) {
-            IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, annoType.getName()),
-                getSourceLocation());
-            world.getMessageHandler().handleMessage(m);
-            resolved = false;
-        }
-    }
-
-    public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
-        throw new BCException("Parameterization not implemented for annotation field binding construct (compiler limitation)");
-        // UnresolvedType newAnnotationType = annotationType;
-        // if (annotationType.isTypeVariableReference()) {
-        // TypeVariableReference t = (TypeVariableReference) annotationType;
-        // String key = t.getTypeVariable().getName();
-        // if (typeVariableMap.containsKey(key)) {
-        // newAnnotationType = (UnresolvedType) typeVariableMap.get(key);
-        // }
-        // } else if (annotationType.isParameterizedType()) {
-        // newAnnotationType = annotationType.parameterize(typeVariableMap);
-        // }
-        // BindingAnnotationTypePattern ret = new BindingAnnotationTypePattern(newAnnotationType, this.formalIndex);
-        // if (newAnnotationType instanceof ResolvedType) {
-        // ResolvedType rat = (ResolvedType) newAnnotationType;
-        // verifyRuntimeRetention(rat.getWorld(), rat);
-        // }
-        // ret.copyLocationFrom(this);
-        // return ret;
-    }
-
-    public int getFormalIndex() {
-        return formalIndex;
-    }
-
-    public boolean equals(Object obj) {
-        if (!(obj instanceof BindingAnnotationFieldTypePattern)) return false;
-        BindingAnnotationFieldTypePattern btp = (BindingAnnotationFieldTypePattern) obj;
-        return (btp.formalIndex == formalIndex) && (annotationType.equals(btp.annotationType)) && (formalType.equals(btp.formalType));
-    }
-
-    public int hashCode() {
-        return (annotationType.hashCode() * 37 + formalIndex * 37) + formalType.hashCode();
-    }
-
-    public AnnotationTypePattern remapAdviceFormals(IntMap bindings) {
-        if (!bindings.hasKey(formalIndex)) {
-            throw new BCException("Annotation field binding reference must be bound (compiler limitation)");
-            // must be something like returning the unbound form: return new ExactAnnotationTypePattern(annotationType,
-            // null);
-        } else {
-            int newFormalIndex = bindings.get(formalIndex);
-            return new BindingAnnotationFieldTypePattern(formalType, newFormalIndex, annotationType);
-        }
-    }
-
-    public void write(DataOutputStream s) throws IOException {
-        s.writeByte(AnnotationTypePattern.BINDINGFIELD);
-        formalType.write(s); // the type of the field within the annotation
-        s.writeShort((short) formalIndex);
-        annotationType.write(s); // the annotation type
-        writeLocation(s);
-    }
-
-    public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
-        AnnotationTypePattern ret = new BindingAnnotationFieldTypePattern(UnresolvedType.read(s), s.readShort(), UnresolvedType.read(s));
-        ret.readLocation(context, s);
-        return ret;
-    }
-    
-
-    public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {        
-        // Inheritance irrelevant because @annotation(Anno(x)) only supported at method execution join points (compiler limitation)
-//      boolean checkSupers = false;
-//        if (getResolvedAnnotationType().hasAnnotation(UnresolvedType.AT_INHERITED)) {
-//            if (annotated instanceof ResolvedType) {
-//                checkSupers = true;
-//            }
-//        }
-//
-        if (annotated.hasAnnotation(annotationType)) {
-            if (annotationType instanceof ReferenceType) {
-                ReferenceType rt = (ReferenceType) annotationType;
-                if (rt.getRetentionPolicy() != null && rt.getRetentionPolicy().equals("SOURCE")) {
-                    rt.getWorld().getMessageHandler().handleMessage(
-                        MessageUtil.warn(WeaverMessages.format(WeaverMessages.NO_MATCH_BECAUSE_SOURCE_RETENTION, annotationType, annotated),
-                            getSourceLocation()));
-                    return FuzzyBoolean.NO;
-                }
-                ResolvedMember[] methods = rt.getDeclaredMethods();
-                boolean found = false;
-                for (int i = 0; i < methods.length && !found; i++) {
-                    if (methods[i].getReturnType().equals(formalType)) {
-                        found = true;
-                    }
-                }
-                return (found ? FuzzyBoolean.YES : FuzzyBoolean.NO);
-            }
-        }
-//         else if (checkSupers) {
-//            ResolvedType toMatchAgainst = ((ResolvedType) annotated).getSuperclass();
-//            while (toMatchAgainst != null) {
-//                if (toMatchAgainst.hasAnnotation(annotationType)) {
-//                    return FuzzyBoolean.YES;
-//                }
-//                toMatchAgainst = toMatchAgainst.getSuperclass();
-//            }
-//        }
-//
-        return FuzzyBoolean.NO;
-    }
-
-    public UnresolvedType getFormalType() {
-        return formalType;
-    }
+       protected int formalIndex;
+       UnresolvedType formalType; // In this construct the formal type differs from the annotation type
+
+       public BindingAnnotationFieldTypePattern(UnresolvedType formalType, int formalIndex, UnresolvedType theAnnotationType) {
+               super(theAnnotationType, null);
+               this.formalIndex = formalIndex;
+               this.formalType = formalType;
+       }
+
+       public void resolveBinding(World world) {
+               if (resolved) {
+                       return;
+               }
+               resolved = true;
+               formalType = world.resolve(formalType);
+               annotationType = world.resolve(annotationType);
+               ResolvedType annoType = (ResolvedType) annotationType;
+               if (!annoType.isAnnotation()) {
+                       IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, annoType
+                                       .getName()), getSourceLocation());
+                       world.getMessageHandler().handleMessage(m);
+                       resolved = false;
+               }
+       }
+
+       public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+               throw new BCException("Parameterization not implemented for annotation field binding construct (compiler limitation)");
+               // UnresolvedType newAnnotationType = annotationType;
+               // if (annotationType.isTypeVariableReference()) {
+               // TypeVariableReference t = (TypeVariableReference) annotationType;
+               // String key = t.getTypeVariable().getName();
+               // if (typeVariableMap.containsKey(key)) {
+               // newAnnotationType = (UnresolvedType) typeVariableMap.get(key);
+               // }
+               // } else if (annotationType.isParameterizedType()) {
+               // newAnnotationType = annotationType.parameterize(typeVariableMap);
+               // }
+               // BindingAnnotationTypePattern ret = new BindingAnnotationTypePattern(newAnnotationType, this.formalIndex);
+               // if (newAnnotationType instanceof ResolvedType) {
+               // ResolvedType rat = (ResolvedType) newAnnotationType;
+               // verifyRuntimeRetention(rat.getWorld(), rat);
+               // }
+               // ret.copyLocationFrom(this);
+               // return ret;
+       }
+
+       public int getFormalIndex() {
+               return formalIndex;
+       }
+
+       public boolean equals(Object obj) {
+               if (!(obj instanceof BindingAnnotationFieldTypePattern)) {
+                       return false;
+               }
+               BindingAnnotationFieldTypePattern btp = (BindingAnnotationFieldTypePattern) obj;
+               return (btp.formalIndex == formalIndex) && (annotationType.equals(btp.annotationType))
+                               && (formalType.equals(btp.formalType));
+       }
+
+       public int hashCode() {
+               return (annotationType.hashCode() * 37 + formalIndex * 37) + formalType.hashCode();
+       }
+
+       public AnnotationTypePattern remapAdviceFormals(IntMap bindings) {
+               if (!bindings.hasKey(formalIndex)) {
+                       throw new BCException("Annotation field binding reference must be bound (compiler limitation)");
+                       // must be something like returning the unbound form: return new ExactAnnotationTypePattern(annotationType,
+                       // null);
+               } else {
+                       int newFormalIndex = bindings.get(formalIndex);
+                       return new BindingAnnotationFieldTypePattern(formalType, newFormalIndex, annotationType);
+               }
+       }
+
+       public void write(CompressingDataOutputStream s) throws IOException {
+               s.writeByte(AnnotationTypePattern.BINDINGFIELD);
+               formalType.write(s); // the type of the field within the annotation
+               s.writeShort((short) formalIndex);
+               annotationType.write(s); // the annotation type
+               writeLocation(s);
+       }
+
+       public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
+               AnnotationTypePattern ret = new BindingAnnotationFieldTypePattern(UnresolvedType.read(s), s.readShort(), UnresolvedType
+                               .read(s));
+               ret.readLocation(context, s);
+               return ret;
+       }
+
+       public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {
+               // Inheritance irrelevant because @annotation(Anno(x)) only supported at method execution join points (compiler limitation)
+               // boolean checkSupers = false;
+               // if (getResolvedAnnotationType().hasAnnotation(UnresolvedType.AT_INHERITED)) {
+               // if (annotated instanceof ResolvedType) {
+               // checkSupers = true;
+               // }
+               // }
+               //
+               if (annotated.hasAnnotation(annotationType)) {
+                       if (annotationType instanceof ReferenceType) {
+                               ReferenceType rt = (ReferenceType) annotationType;
+                               if (rt.getRetentionPolicy() != null && rt.getRetentionPolicy().equals("SOURCE")) {
+                                       rt.getWorld().getMessageHandler().handleMessage(
+                                                       MessageUtil.warn(WeaverMessages.format(WeaverMessages.NO_MATCH_BECAUSE_SOURCE_RETENTION,
+                                                                       annotationType, annotated), getSourceLocation()));
+                                       return FuzzyBoolean.NO;
+                               }
+                               ResolvedMember[] methods = rt.getDeclaredMethods();
+                               boolean found = false;
+                               for (int i = 0; i < methods.length && !found; i++) {
+                                       if (methods[i].getReturnType().equals(formalType)) {
+                                               found = true;
+                                       }
+                               }
+                               return (found ? FuzzyBoolean.YES : FuzzyBoolean.NO);
+                       }
+               }
+               // else if (checkSupers) {
+               // ResolvedType toMatchAgainst = ((ResolvedType) annotated).getSuperclass();
+               // while (toMatchAgainst != null) {
+               // if (toMatchAgainst.hasAnnotation(annotationType)) {
+               // return FuzzyBoolean.YES;
+               // }
+               // toMatchAgainst = toMatchAgainst.getSuperclass();
+               // }
+               // }
+               //
+               return FuzzyBoolean.NO;
+       }
+
+       public UnresolvedType getFormalType() {
+               return formalType;
+       }
 
 }
index f0be890a1d95229004882ee98d73534bf1f75625..142f6155e8e7817a39eb64a8299864503a87ef55 100644 (file)
@@ -9,13 +9,13 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -28,47 +28,49 @@ import org.aspectj.weaver.World;
 public class BindingAnnotationTypePattern extends ExactAnnotationTypePattern implements BindingPattern {
 
        protected int formalIndex;
-       
+
        /**
         * @param annotationType
         */
        public BindingAnnotationTypePattern(UnresolvedType annotationType, int index) {
-               super(annotationType,null);
+               super(annotationType, null);
                this.formalIndex = index;
        }
-               
+
        public BindingAnnotationTypePattern(FormalBinding binding) {
-               this(binding.getType(),binding.getIndex());
+               this(binding.getType(), binding.getIndex());
        }
-       
+
        public void resolveBinding(World world) {
-               if (resolved) return;
+               if (resolved) {
+                       return;
+               }
                resolved = true;
                annotationType = annotationType.resolve(world);
                ResolvedType resolvedAnnotationType = (ResolvedType) annotationType;
                if (!resolvedAnnotationType.isAnnotation()) {
-                       IMessage m = MessageUtil.error(
-                                       WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE,annotationType.getName()),
-                                       getSourceLocation());
+                       IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, annotationType
+                                       .getName()), getSourceLocation());
                        world.getMessageHandler().handleMessage(m);
                        resolved = false;
                }
-               if (annotationType.isTypeVariableReference()) return;  // we'll deal with this next check when the type var is actually bound...
-        verifyRuntimeRetention(world, resolvedAnnotationType);
+               if (annotationType.isTypeVariableReference()) {
+                       return; // we'll deal with this next check when the type var is actually bound...
+               }
+               verifyRuntimeRetention(world, resolvedAnnotationType);
        }
 
        private void verifyRuntimeRetention(World world, ResolvedType resolvedAnnotationType) {
                if (!resolvedAnnotationType.isAnnotationWithRuntimeRetention()) { // default is class visibility
-                   // default is class visibility
-                       IMessage m = MessageUtil.error(
-                                       WeaverMessages.format(WeaverMessages.BINDING_NON_RUNTIME_RETENTION_ANNOTATION,annotationType.getName()),
-                                       getSourceLocation());
+                       // default is class visibility
+                       IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.BINDING_NON_RUNTIME_RETENTION_ANNOTATION,
+                                       annotationType.getName()), getSourceLocation());
                        world.getMessageHandler().handleMessage(m);
-                       resolved = false;                   
+                       resolved = false;
                }
        }
-       
-       public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) {
+
+       public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
                UnresolvedType newAnnotationType = annotationType;
                if (annotationType.isTypeVariableReference()) {
                        TypeVariableReference t = (TypeVariableReference) annotationType;
@@ -79,56 +81,58 @@ public class BindingAnnotationTypePattern extends ExactAnnotationTypePattern imp
                } else if (annotationType.isParameterizedType()) {
                        newAnnotationType = annotationType.parameterize(typeVariableMap);
                }
-               BindingAnnotationTypePattern ret = new BindingAnnotationTypePattern(newAnnotationType,this.formalIndex);
+               BindingAnnotationTypePattern ret = new BindingAnnotationTypePattern(newAnnotationType, this.formalIndex);
                if (newAnnotationType instanceof ResolvedType) {
                        ResolvedType rat = (ResolvedType) newAnnotationType;
-                       verifyRuntimeRetention(rat.getWorld(),rat);                     
+                       verifyRuntimeRetention(rat.getWorld(), rat);
                }
                ret.copyLocationFrom(this);
                return ret;
        }
-       
+
        public int getFormalIndex() {
                return formalIndex;
        }
 
        public boolean equals(Object obj) {
-               if (!(obj instanceof BindingAnnotationTypePattern)) return false;
+               if (!(obj instanceof BindingAnnotationTypePattern)) {
+                       return false;
+               }
                BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern) obj;
                return (super.equals(btp) && (btp.formalIndex == formalIndex));
        }
-       
+
        public int hashCode() {
-               return super.hashCode()*37 + formalIndex;
+               return super.hashCode() * 37 + formalIndex;
        }
-       
-       public AnnotationTypePattern remapAdviceFormals(IntMap bindings) {                      
+
+       public AnnotationTypePattern remapAdviceFormals(IntMap bindings) {
                if (!bindings.hasKey(formalIndex)) {
-                       return new ExactAnnotationTypePattern(annotationType,null);
+                       return new ExactAnnotationTypePattern(annotationType, null);
                } else {
                        int newFormalIndex = bindings.get(formalIndex);
                        return new BindingAnnotationTypePattern(annotationType, newFormalIndex);
                }
        }
+
        private static final byte VERSION = 1; // rev if serialised form changed
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.patterns.ExactAnnotationTypePattern#write(java.io.DataOutputStream)
-        */
-       public void write(DataOutputStream s) throws IOException {
+
+       @Override
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.BINDING);
                s.writeByte(VERSION);
                annotationType.write(s);
-               s.writeShort((short)formalIndex);
+               s.writeShort((short) formalIndex);
                writeLocation(s);
-       }       
-       
+       }
+
        public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                byte version = s.readByte();
                if (version > VERSION) {
                        throw new BCException("BindingAnnotationTypePattern was written by a more recent version of AspectJ");
                }
-               AnnotationTypePattern ret = new BindingAnnotationTypePattern(UnresolvedType.read(s),s.readShort());
-               ret.readLocation(context,s);
+               AnnotationTypePattern ret = new BindingAnnotationTypePattern(UnresolvedType.read(s), s.readShort());
+               ret.readLocation(context, s);
                return ret;
        }
 }
index 28c5739adfc9103e36a7a4607adc394110905bcb..c24e779be7a040a8b2373637952d19fc8147f4de 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.weaver.AjAttribute;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.UnresolvedType;
@@ -27,54 +26,61 @@ import org.aspectj.weaver.World;
 public class BindingTypePattern extends ExactTypePattern implements BindingPattern {
        private int formalIndex;
 
-       public BindingTypePattern(UnresolvedType type, int index,boolean isVarArgs) {
-               super(type, false,isVarArgs);
+       public BindingTypePattern(UnresolvedType type, int index, boolean isVarArgs) {
+               super(type, false, isVarArgs);
                this.formalIndex = index;
        }
 
        public BindingTypePattern(FormalBinding binding, boolean isVarArgs) {
-               this(binding.getType(), binding.getIndex(),isVarArgs);
+               this(binding.getType(), binding.getIndex(), isVarArgs);
        }
-       
+
        public int getFormalIndex() {
                return formalIndex;
        }
 
-    public boolean equals(Object other) {
-       if (!(other instanceof BindingTypePattern)) return false;
-       BindingTypePattern o = (BindingTypePattern)other;
-       if (includeSubtypes != o.includeSubtypes) return false;
-       if (isVarArgs != o.isVarArgs) return false;
-       return o.type.equals(this.type) && o.formalIndex == this.formalIndex;
-    }
-    public int hashCode() {
-        int result = 17;
-        result = 37*result + super.hashCode();
-        result = 37*result + formalIndex;
-        return result;
-    }
-       
-       public void write(DataOutputStream out) throws IOException {
+       public boolean equals(Object other) {
+               if (!(other instanceof BindingTypePattern)) {
+                       return false;
+               }
+               BindingTypePattern o = (BindingTypePattern) other;
+               if (includeSubtypes != o.includeSubtypes) {
+                       return false;
+               }
+               if (isVarArgs != o.isVarArgs) {
+                       return false;
+               }
+               return o.type.equals(this.type) && o.formalIndex == this.formalIndex;
+       }
+
+       public int hashCode() {
+               int result = 17;
+               result = 37 * result + super.hashCode();
+               result = 37 * result + formalIndex;
+               return result;
+       }
+
+       public void write(CompressingDataOutputStream out) throws IOException {
                out.writeByte(TypePattern.BINDING);
                type.write(out);
-               out.writeShort((short)formalIndex);
+               out.writeShort((short) formalIndex);
                out.writeBoolean(isVarArgs);
                writeLocation(out);
        }
-       
+
        public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
-               UnresolvedType  type = UnresolvedType.read(s);
-               int            index = s.readShort();
-               boolean   isVarargs = false;
-               if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
+               UnresolvedType type = UnresolvedType.read(s);
+               int index = s.readShort();
+               boolean isVarargs = false;
+               if (s.getMajorVersion() >= AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) {
                        isVarargs = s.readBoolean();
                }
-               TypePattern ret = new BindingTypePattern(type,index,isVarargs);
+               TypePattern ret = new BindingTypePattern(type, index, isVarargs);
                ret.readLocation(context, s);
                return ret;
        }
-       
-       public TypePattern remapAdviceFormals(IntMap bindings) {                        
+
+       public TypePattern remapAdviceFormals(IntMap bindings) {
                if (!bindings.hasKey(formalIndex)) {
                        return new ExactTypePattern(type, false, isVarArgs);
                } else {
@@ -82,16 +88,16 @@ public class BindingTypePattern extends ExactTypePattern implements BindingPatte
                        return new BindingTypePattern(type, newFormalIndex, isVarArgs);
                }
        }
-       
-       public TypePattern parameterizeWith(Map typeVariableMap,World w) {
-               ExactTypePattern superParameterized = (ExactTypePattern) super.parameterizeWith(typeVariableMap,w);
-               BindingTypePattern ret = new BindingTypePattern(superParameterized.getExactType(),this.formalIndex,this.isVarArgs);
+
+       public TypePattern parameterizeWith(Map typeVariableMap, World w) {
+               ExactTypePattern superParameterized = (ExactTypePattern) super.parameterizeWith(typeVariableMap, w);
+               BindingTypePattern ret = new BindingTypePattern(superParameterized.getExactType(), this.formalIndex, this.isVarArgs);
                ret.copyLocationFrom(this);
                return ret;
        }
 
-    public String toString() {
-       //Thread.currentThread().dumpStack();
-       return "BindingTypePattern(" + super.toString() + ", " + formalIndex + ")";
-    }
+       public String toString() {
+               // Thread.currentThread().dumpStack();
+               return "BindingTypePattern(" + super.toString() + ", " + formalIndex + ")";
+       }
 }
index 6da40e523b3f983807f82e087d627530613abb34..1aa58dec049ad11ca289dac804c68c92edb06f96 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
@@ -24,6 +23,7 @@ import org.aspectj.bridge.IMessage;
 import org.aspectj.util.FileUtil;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.Advice;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.CrosscuttingMembers;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
@@ -87,7 +87,7 @@ public class CflowPointcut extends Pointcut {
                return FuzzyBoolean.MAYBE;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.CFLOW);
                entry.write(s);
                s.writeBoolean(isBelow);
index 842384b01d5921a616d261d4722b5d560164f633..443a58645db3f69863fa795cf94c9d6a0021f9fd 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
@@ -21,6 +20,7 @@ import java.util.Map;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.Message;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.MemberImpl;
@@ -80,8 +80,9 @@ public class ConcreteCflowPointcut extends Pointcut {
 
        // used by weaver when validating bindings
        public int[] getUsedFormalSlots() {
-               if (slots == null)
+               if (slots == null) {
                        return new int[0];
+               }
                int[] indices = new int[slots.size()];
                for (int i = 0; i < indices.length; i++) {
                        indices[i] = ((Slot) slots.get(i)).formalIndex;
@@ -89,7 +90,7 @@ public class ConcreteCflowPointcut extends Pointcut {
                return indices;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                throw new RuntimeException("unimplemented");
        }
 
@@ -102,8 +103,9 @@ public class ConcreteCflowPointcut extends Pointcut {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof ConcreteCflowPointcut))
+               if (!(other instanceof ConcreteCflowPointcut)) {
                        return false;
+               }
                ConcreteCflowPointcut o = (ConcreteCflowPointcut) other;
                return o.cflowField.equals(this.cflowField);
        }
@@ -161,8 +163,9 @@ public class ConcreteCflowPointcut extends Pointcut {
                }
 
                public boolean equals(Object other) {
-                       if (!(other instanceof Slot))
+                       if (!(other instanceof Slot)) {
                                return false;
+                       }
 
                        Slot o = (Slot) other;
                        return o.formalIndex == this.formalIndex && o.arrayIndex == this.arrayIndex && o.formalType.equals(this.formalType);
index 261a01c4a84b370a49b79242487fb2ae2a08185a..6f6d54c30245d7fdf754f5ef0778a0f9538520a6 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
 
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.weaver.AnnotationAJ;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedType;
@@ -221,7 +221,7 @@ public class DeclareAnnotation extends Declare {
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.ANNOTATION);
                s.writeInt(kind.id);
                s.writeUTF(annotationString);
index c8922933b05c0c978ff0d75dcedf1a5a7e6825fe..c3a698967fea50279003fe744b7afb55a84cdbce 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
@@ -31,15 +30,18 @@ public class DeclareErrorOrWarning extends Declare {
                this.pointcut = pointcut;
                this.message = message;
        }
-       
+
        /**
         * returns "declare warning: <message>" or "declare error: <message>"
         */
        public String toString() {
                StringBuffer buf = new StringBuffer();
                buf.append("declare ");
-               if (isError) buf.append("error: ");
-               else buf.append("warning: ");
+               if (isError) {
+                       buf.append("error: ");
+               } else {
+                       buf.append("warning: ");
+               }
                buf.append(pointcut);
                buf.append(": ");
                buf.append("\"");
@@ -47,27 +49,27 @@ public class DeclareErrorOrWarning extends Declare {
                buf.append("\";");
                return buf.toString();
        }
-       
-       public boolean equals(Object other) { 
-               if (!(other instanceof DeclareErrorOrWarning)) return false;
-               DeclareErrorOrWarning o = (DeclareErrorOrWarning)other;
-               return (o.isError == isError) &&
-                       o.pointcut.equals(pointcut) &&
-                       o.message.equals(message);
+
+       public boolean equals(Object other) {
+               if (!(other instanceof DeclareErrorOrWarning)) {
+                       return false;
+               }
+               DeclareErrorOrWarning o = (DeclareErrorOrWarning) other;
+               return (o.isError == isError) && o.pointcut.equals(pointcut) && o.message.equals(message);
+       }
+
+       public int hashCode() {
+               int result = isError ? 19 : 23;
+               result = 37 * result + pointcut.hashCode();
+               result = 37 * result + message.hashCode();
+               return result;
        }
-    
-    public int hashCode() {
-        int result = isError ? 19 : 23;
-        result = 37*result + pointcut.hashCode();
-        result = 37*result + message.hashCode();
-        return result;
-    }
 
        public Object accept(PatternNodeVisitor visitor, Object data) {
-               return visitor.visit(this,data);
+               return visitor.visit(this, data);
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.ERROR_OR_WARNING);
                s.writeBoolean(isError);
                pointcut.write(s);
@@ -76,16 +78,11 @@ public class DeclareErrorOrWarning extends Declare {
        }
 
        public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
-               Declare ret = new DeclareErrorOrWarning(
-                       s.readBoolean(),
-                       Pointcut.read(s, context),
-                       s.readUTF()
-               );
+               Declare ret = new DeclareErrorOrWarning(s.readBoolean(), Pointcut.read(s, context), s.readUTF());
                ret.readLocation(context, s);
                return ret;
        }
 
-
        public boolean isError() {
                return isError;
        }
@@ -97,17 +94,17 @@ public class DeclareErrorOrWarning extends Declare {
        public Pointcut getPointcut() {
                return pointcut;
        }
-       
-    public void resolve(IScope scope) {
-       pointcut = pointcut.resolve(scope);     
-    }
-    
-    public Declare parameterizeWith(Map typeVariableBindingMap,World w) {
-       Declare ret = new DeclareErrorOrWarning(isError,pointcut.parameterizeWith(typeVariableBindingMap,w),message);
-       ret.copyLocationFrom(this);
-       return ret;
-    }
-    
+
+       public void resolve(IScope scope) {
+               pointcut = pointcut.resolve(scope);
+       }
+
+       public Declare parameterizeWith(Map typeVariableBindingMap, World w) {
+               Declare ret = new DeclareErrorOrWarning(isError, pointcut.parameterizeWith(typeVariableBindingMap, w), message);
+               ret.copyLocationFrom(this);
+               return ret;
+       }
+
        public boolean isAdviceLike() {
                return true;
        }
@@ -115,15 +112,18 @@ public class DeclareErrorOrWarning extends Declare {
        public String getNameSuffix() {
                return "eow";
        }
-       
+
        /**
         * returns "declare warning" or "declare error"
         */
        public String getName() {
                StringBuffer buf = new StringBuffer();
                buf.append("declare ");
-               if (isError) buf.append("error");
-               else buf.append("warning");     
+               if (isError) {
+                       buf.append("error");
+               } else {
+                       buf.append("warning");
+               }
                return buf.toString();
        }
 }
index 1bef37c60201f49f100cd946dae9a20edeecfdbf..c11967fca8cae47216fac9358edd73b6d27cc629 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -23,6 +22,7 @@ import java.util.Map;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.Message;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.UnresolvedType;
@@ -46,8 +46,9 @@ public class DeclareParents extends Declare {
                this.child = child;
                this.parents = parents;
                this.isExtends = isExtends;
-               if (child instanceof WildTypePattern)
+               if (child instanceof WildTypePattern) {
                        isWildChild = true;
+               }
        }
 
        // public String[] getTypeParameterNames() {
@@ -59,8 +60,9 @@ public class DeclareParents extends Declare {
        // }
 
        public boolean match(ResolvedType typeX) {
-               if (!child.matchesStatically(typeX))
+               if (!child.matchesStatically(typeX)) {
                        return false;
+               }
                if (typeX.getWorld().getLint().typeNotExposedToWeaver.isEnabled() && !typeX.isExposedToWeaver()) {
                        typeX.getWorld().getLint().typeNotExposedToWeaver.signal(typeX.getName(), getSourceLocation());
                }
@@ -94,8 +96,9 @@ public class DeclareParents extends Declare {
 
        @Override
        public boolean equals(Object other) {
-               if (!(other instanceof DeclareParents))
+               if (!(other instanceof DeclareParents)) {
                        return false;
+               }
                DeclareParents o = (DeclareParents) other;
                return o.child.equals(child) && o.parents.equals(parents);
        }
@@ -110,7 +113,7 @@ public class DeclareParents extends Declare {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.PARENTS);
                child.write(s);
                parents.write(s);
@@ -136,16 +139,18 @@ public class DeclareParents extends Declare {
 
        public boolean parentsIncludeInterface(World w) {
                for (int i = 0; i < parents.size(); i++) {
-                       if (parents.get(i).getExactType().resolve(w).isInterface())
+                       if (parents.get(i).getExactType().resolve(w).isInterface()) {
                                return true;
+                       }
                }
                return false;
        }
 
        public boolean parentsIncludeClass(World w) {
                for (int i = 0; i < parents.size(); i++) {
-                       if (parents.get(i).getExactType().resolve(w).isClass())
+                       if (parents.get(i).getExactType().resolve(w).isClass()) {
                                return true;
+                       }
                }
                return false;
        }
@@ -182,8 +187,9 @@ public class DeclareParents extends Declare {
        }
 
        private ResolvedType maybeGetNewParent(ResolvedType targetType, TypePattern typePattern, World world, boolean reportErrors) {
-               if (typePattern == TypePattern.NO)
+               if (typePattern == TypePattern.NO) {
                        return null; // already had an error here
+               }
 
                // isWildChild = (child instanceof WildTypePattern);
                UnresolvedType iType = typePattern.getExactType();
@@ -199,12 +205,14 @@ public class DeclareParents extends Declare {
                if (parentType.isParameterizedType() || parentType.isRawType()) {
                        // Let's take a look at the parents we already have
                        boolean isOK = verifyNoInheritedAlternateParameterization(targetType, parentType, world);
-                       if (!isOK)
+                       if (!isOK) {
                                return null;
+                       }
                }
 
-               if (parentType.isAssignableFrom(targetType))
+               if (parentType.isAssignableFrom(targetType)) {
                        return null; // already a parent
+               }
 
                // Enum types that are targetted for decp through a wild type pattern get linted
                if (reportErrors && isWildChild && targetType.isEnum()) {
@@ -264,8 +272,9 @@ public class DeclareParents extends Declare {
                        return null;
                }
 
-               if (parentType.isAssignableFrom(targetType))
+               if (parentType.isAssignableFrom(targetType)) {
                        return null; // already a parent
+               }
 
                if (targetType.isAssignableFrom(parentType)) {
                        world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.CANT_EXTEND_SELF, targetType.getName()), this
@@ -305,8 +314,9 @@ public class DeclareParents extends Declare {
         */
        private boolean verifyNoInheritedAlternateParameterization(ResolvedType typeToVerify, ResolvedType newParent, World world) {
 
-               if (typeToVerify.equals(ResolvedType.OBJECT))
+               if (typeToVerify.equals(ResolvedType.OBJECT)) {
                        return true;
+               }
 
                ResolvedType newParentGenericType = newParent.getGenericType();
                Iterator iter = typeToVerify.getDirectSupertypes();
@@ -342,16 +352,19 @@ public class DeclareParents extends Declare {
        }
 
        public List<ResolvedType> findMatchingNewParents(ResolvedType onType, boolean reportErrors) {
-               if (onType.isRawType())
+               if (onType.isRawType()) {
                        onType = onType.getGenericType();
-               if (!match(onType))
+               }
+               if (!match(onType)) {
                        return Collections.emptyList();
+               }
 
                List<ResolvedType> ret = new ArrayList<ResolvedType>();
                for (int i = 0; i < parents.size(); i++) {
                        ResolvedType t = maybeGetNewParent(onType, parents.get(i), onType.getWorld(), reportErrors);
-                       if (t != null)
+                       if (t != null) {
                                ret.add(t);
+                       }
                }
 
                return ret;
index 2c4e727cadaa1da1dc1268b59e8b611cf18fd59c..9c2db1156b00287bb6f72abf21cd94b6b3534c8c 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.VersionedDataInputStream;
 
@@ -50,7 +50,7 @@ public class DeclareParentsMixin extends DeclareParents {
                return result;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.PARENTSMIXIN);
                child.write(s);
                parents.write(s);
index 896344557c9177562f5fe00d682cdcb4fe1d34ae..678ea89e6567e58bf183a71fb095d295a60cb5ce 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
 import org.aspectj.bridge.IMessage;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -55,8 +55,9 @@ public class DeclarePrecedence extends Declare {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof DeclarePrecedence))
+               if (!(other instanceof DeclarePrecedence)) {
                        return false;
+               }
                DeclarePrecedence o = (DeclarePrecedence) other;
                return o.patterns.equals(patterns);
        }
@@ -65,7 +66,7 @@ public class DeclarePrecedence extends Declare {
                return patterns.hashCode();
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.DOMINATES);
                patterns.write(s);
                writeLocation(s);
@@ -106,8 +107,9 @@ public class DeclarePrecedence extends Declare {
                                continue;
                        }
                        ResolvedType exactType = pi.getExactType().resolve(scope.getWorld());
-                       if (exactType.isMissing())
+                       if (exactType.isMissing()) {
                                continue;
+                       }
 
                        // Cannot do a dec prec specifying a non-aspect types unless suffixed with a '+'
                        if (!exactType.isAspect() && !exactType.isAnnotationStyleAspect() && !pi.isIncludeSubtypes()
@@ -118,11 +120,13 @@ public class DeclarePrecedence extends Declare {
                        }
 
                        for (int j = 0; j < patterns.size(); j++) {
-                               if (j == i)
+                               if (j == i) {
                                        continue;
+                               }
                                TypePattern pj = patterns.get(j);
-                               if (pj.isStar())
+                               if (pj.isStar()) {
                                        continue;
+                               }
                                if (pj.matchesStatically(exactType)) {
                                        scope.getWorld().showMessage(IMessage.ERROR,
                                                        WeaverMessages.format(WeaverMessages.TWO_PATTERN_MATCHES_IN_PRECEDENCE, exactType.getName()),
@@ -156,10 +160,11 @@ public class DeclarePrecedence extends Declare {
                                }
                        }
                }
-               if (knownMatch == -1)
+               if (knownMatch == -1) {
                        return starMatch;
-               else
+               } else {
                        return knownMatch;
+               }
        }
 
        public int compare(ResolvedType aspect1, ResolvedType aspect2) {
@@ -169,15 +174,17 @@ public class DeclarePrecedence extends Declare {
 
                // System.out.println("a1: " + aspect1 + ", " + aspect2 + " = " + index1 + ", " + index2);
 
-               if (index1 == -1 || index2 == -1)
+               if (index1 == -1 || index2 == -1) {
                        return 0;
+               }
 
-               if (index1 == index2)
+               if (index1 == index2) {
                        return 0;
-               else if (index1 > index2)
+               } else if (index1 > index2) {
                        return -1;
-               else
+               } else {
                        return +1;
+               }
        }
 
        public boolean isAdviceLike() {
index 7e8d831ca50b0f7e7427f344cf848d58020900d5..3714d5fdc4f5ace1b53cea6c7e6ce5201245b09d 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.bridge.IMessage;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.TypeVariableReferenceType;
@@ -76,7 +76,7 @@ public class DeclareSoft extends Declare {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.SOFT);
                exception.write(s);
                pointcut.write(s);
index bf477e542984b435672d682f856b874bc683d825..daaf844967c0c4a9c0ce6065ee56706f35841c96 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
@@ -43,10 +43,11 @@ public class DeclareTypeErrorOrWarning extends Declare {
        public String toString() {
                StringBuffer buf = new StringBuffer();
                buf.append("declare ");
-               if (isError)
+               if (isError) {
                        buf.append("error: ");
-               else
+               } else {
                        buf.append("warning: ");
+               }
                buf.append(typePattern);
                buf.append(": ");
                buf.append("\"");
@@ -56,8 +57,9 @@ public class DeclareTypeErrorOrWarning extends Declare {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof DeclareTypeErrorOrWarning))
+               if (!(other instanceof DeclareTypeErrorOrWarning)) {
                        return false;
+               }
                DeclareTypeErrorOrWarning o = (DeclareTypeErrorOrWarning) other;
                return (o.isError == isError) && o.typePattern.equals(typePattern) && o.message.equals(message);
        }
@@ -73,7 +75,7 @@ public class DeclareTypeErrorOrWarning extends Declare {
                return visitor.visit(this, data);
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.TYPE_ERROR_OR_WARNING);
                s.writeBoolean(isError);
                typePattern.write(s);
@@ -123,10 +125,11 @@ public class DeclareTypeErrorOrWarning extends Declare {
        public String getName() {
                StringBuffer buf = new StringBuffer();
                buf.append("declare type ");
-               if (isError)
+               if (isError) {
                        buf.append("error");
-               else
+               } else {
                        buf.append("warning");
+               }
                return buf.toString();
        }
 }
index ea2ec2a70e1c51dd212c953e363d4c53042994a7..41b276075819491428df3188e82f96e418300e7b 100644 (file)
@@ -11,7 +11,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
@@ -19,6 +18,7 @@ import org.aspectj.bridge.IMessage;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ReferenceType;
 import org.aspectj.weaver.ResolvedMember;
@@ -127,7 +127,7 @@ public class ExactAnnotationFieldTypePattern extends ExactAnnotationTypePattern
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.EXACTFIELD);
                s.writeUTF(formalName);
                annotationType.write(s);
index 1105d87cfe361d140e598f38546204b857ebcb72..f332f1c1bcdb07a5f994b9bdc9020d0f5d3e378b 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -22,6 +21,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.AnnotationAJ;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ReferenceType;
 import org.aspectj.weaver.ResolvedMember;
@@ -346,7 +346,7 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern {
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.EXACT);
                s.writeByte(VERSION);
                s.writeBoolean(bindingPattern);
index 1f126231786b410a693a87e913268ef48c52f656..7bc560305d122b1c3a112f700b7fe5c840f7b7a9 100644 (file)
@@ -13,7 +13,6 @@
 package org.aspectj.weaver.patterns;
 
 import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -21,6 +20,7 @@ import java.util.Map;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.TypeVariableReference;
@@ -243,7 +243,7 @@ public class ExactTypePattern extends TypePattern {
        private static final byte EXACT_VERSION = 1; // rev if changed
 
        @Override
-       public void write(DataOutputStream out) throws IOException {
+       public void write(CompressingDataOutputStream out) throws IOException {
                out.writeByte(TypePattern.EXACT);
                out.writeByte(EXACT_VERSION);
                type.write(out);
index b26dc9bb7488f8564f2a7bcc339372fefccead4c..3f92ab04a0b3f85cb2a532151578cee7e7a4ce42 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -31,16 +30,14 @@ import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
 
 /**
- * This is a kind of KindedPointcut.  This belongs either in 
- * a hierarchy with it or in a new place to share code
- * with other potential future statement-level pointcuts like
- * synchronized and throws
+ * This is a kind of KindedPointcut. This belongs either in a hierarchy with it or in a new place to share code with other potential
+ * future statement-level pointcuts like synchronized and throws
  */
 public class HandlerPointcut extends Pointcut {
        TypePattern exceptionType;
 
        private static final int MATCH_KINDS = Shadow.ExceptionHandler.bit;
-       
+
        public HandlerPointcut(TypePattern exceptionType) {
                this.exceptionType = exceptionType;
                this.pointcutKind = HANDLER;
@@ -49,40 +46,43 @@ public class HandlerPointcut extends Pointcut {
        public int couldMatchKinds() {
                return MATCH_KINDS;
        }
-       
-    public FuzzyBoolean fastMatch(FastMatchInfo type) {
-       //??? should be able to do better by finding all referenced types in type
+
+       public FuzzyBoolean fastMatch(FastMatchInfo type) {
+               // ??? should be able to do better by finding all referenced types in type
                return FuzzyBoolean.MAYBE;
        }
-       
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
-               if (shadow.getKind() != Shadow.ExceptionHandler) return FuzzyBoolean.NO;
-               
+               if (shadow.getKind() != Shadow.ExceptionHandler) {
+                       return FuzzyBoolean.NO;
+               }
+
                exceptionType.resolve(shadow.getIWorld());
-               
+
                // we know we have exactly one parameter since we're checking an exception handler
-               return exceptionType.matches(
-                               shadow.getSignature().getParameterTypes()[0].resolve(shadow.getIWorld()), 
-                               TypePattern.STATIC);
+               return exceptionType.matches(shadow.getSignature().getParameterTypes()[0].resolve(shadow.getIWorld()), TypePattern.STATIC);
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-               HandlerPointcut ret = new HandlerPointcut(exceptionType.parameterizeWith(typeVariableMap,w));
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               HandlerPointcut ret = new HandlerPointcut(exceptionType.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
-       
+
        public boolean equals(Object other) {
-               if (!(other instanceof HandlerPointcut)) return false;
-               HandlerPointcut o = (HandlerPointcut)other;
-               return o.exceptionType.equals(this.exceptionType);      }
-    
-    public int hashCode() {
-        int result = 17;
-        result = 37*result + exceptionType.hashCode();
-        return result;
-    }
-       
+               if (!(other instanceof HandlerPointcut)) {
+                       return false;
+               }
+               HandlerPointcut o = (HandlerPointcut) other;
+               return o.exceptionType.equals(this.exceptionType);
+       }
+
+       public int hashCode() {
+               int result = 17;
+               result = 37 * result + exceptionType.hashCode();
+               return result;
+       }
+
        public String toString() {
                StringBuffer buf = new StringBuffer();
                buf.append("handler(");
@@ -90,14 +90,13 @@ public class HandlerPointcut extends Pointcut {
                buf.append(")");
                return buf.toString();
        }
-       
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.HANDLER);
                exceptionType.write(s);
                writeLocation(s);
        }
-       
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                HandlerPointcut ret = new HandlerPointcut(TypePattern.read(s, context));
                ret.readLocation(context, s);
@@ -111,29 +110,32 @@ public class HandlerPointcut extends Pointcut {
        public void resolveBindings(IScope scope, Bindings bindings) {
                exceptionType = exceptionType.resolveBindings(scope, bindings, false, false);
                boolean invalidParameterization = false;
-               if (exceptionType.getTypeParameters().size() > 0) invalidParameterization = true ;
+               if (exceptionType.getTypeParameters().size() > 0) {
+                       invalidParameterization = true;
+               }
                UnresolvedType exactType = exceptionType.getExactType();
-               if (exactType != null && exactType.isParameterizedType()) invalidParameterization = true;
+               if (exactType != null && exactType.isParameterizedType()) {
+                       invalidParameterization = true;
+               }
                if (invalidParameterization) {
                        // no parameterized or generic types for handler
-                       scope.message(
-                                       MessageUtil.error(WeaverMessages.format(WeaverMessages.HANDLER_PCD_DOESNT_SUPPORT_PARAMETERS),
-                                                                       getSourceLocation()));
+                       scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.HANDLER_PCD_DOESNT_SUPPORT_PARAMETERS),
+                                       getSourceLocation()));
                }
-               //XXX add error if exact binding and not an exception
+               // XXX add error if exact binding and not an exception
        }
-       
+
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                return match(shadow).alwaysTrue() ? Literal.TRUE : Literal.FALSE;
        }
-       
+
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                Pointcut ret = new HandlerPointcut(exceptionType);
                ret.copyLocationFrom(this);
                return ret;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 }
index 3cfc62c7bea312e88a45bab0dabdd9003ea9589e..c0715c857039ad0efa36f2be62e7799b70225b3d 100644 (file)
@@ -11,7 +11,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.Iterator;
@@ -20,6 +19,7 @@ import java.util.Map;
 
 import org.aspectj.bridge.IMessage;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ConcreteTypeMunger;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.Member;
@@ -162,7 +162,7 @@ public class HasMemberTypePattern extends TypePattern {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.HAS_MEMBER);
                signaturePattern.write(s);
                writeLocation(s);
index c0e0f2b206cb22bda39cbaded29513a8d817d3cc..a3b5e79e27b78aeb7d0f54af646ba80689c1a4c6 100644 (file)
@@ -12,7 +12,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -25,6 +24,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AjcMemberMaker;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedMember;
@@ -110,7 +110,7 @@ public class IfPointcut extends Pointcut {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.IF);
                s.writeBoolean(testMethod != null); // do we have a test method?
                if (testMethod != null) {
@@ -506,7 +506,7 @@ public class IfPointcut extends Pointcut {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        s.writeByte(Pointcut.IF_FALSE);
                }
 
@@ -575,7 +575,7 @@ public class IfPointcut extends Pointcut {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        s.writeByte(IF_TRUE);
                }
 
index bdfab6714226fad8501c9a0847c1b18da890c865..13770253afb36d2b7501772a07adf13f9fa6bee8 100644 (file)
@@ -14,7 +14,6 @@ package org.aspectj.weaver.patterns;
 
 import static org.aspectj.util.FuzzyBoolean.MAYBE;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
@@ -23,6 +22,7 @@ import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.Checker;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.Member;
@@ -323,7 +323,7 @@ public class KindedPointcut extends Pointcut {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.KINDED);
                kind.write(s);
                signature.write(s);
index 7d304c6bc4f0695b9326cfc603a6ab11d1a78c1d..a8d2680e3495215c8517014f8caa41b27b122cc6 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.VersionedDataInputStream;
 
 public class ModifiersPattern extends PatternNode {
        private int requiredModifiers;
        private int forbiddenModifiers;
-       
+
        public static final ModifiersPattern ANY = new ModifiersPattern(0, 0);
-       
+
        public ModifiersPattern(int requiredModifiers, int forbiddenModifiers) {
                this.requiredModifiers = requiredModifiers;
                this.forbiddenModifiers = forbiddenModifiers;
        }
 
        public String toString() {
-               if (this == ANY) return "";
-               
+               if (this == ANY) {
+                       return "";
+               }
+
                String ret = Modifier.toString(requiredModifiers);
-               if (forbiddenModifiers == 0) return ret;
-               else return ret + " !" + Modifier.toString(forbiddenModifiers);
+               if (forbiddenModifiers == 0) {
+                       return ret;
+               } else {
+                       return ret + " !" + Modifier.toString(forbiddenModifiers);
+               }
        }
-    
+
        public boolean equals(Object other) {
-               if (!(other instanceof ModifiersPattern)) return false;
-               ModifiersPattern o = (ModifiersPattern)other;
-               return o.requiredModifiers == this.requiredModifiers &&
-                               o.forbiddenModifiers == this.forbiddenModifiers;
+               if (!(other instanceof ModifiersPattern)) {
+                       return false;
+               }
+               ModifiersPattern o = (ModifiersPattern) other;
+               return o.requiredModifiers == this.requiredModifiers && o.forbiddenModifiers == this.forbiddenModifiers;
        }
-    public int hashCode() {
-        int result = 17;
-        result = 37*result + requiredModifiers;
-        result = 37*result + forbiddenModifiers;
-        return result;
-    }  
-    
+
+       public int hashCode() {
+               int result = 17;
+               result = 37 * result + requiredModifiers;
+               result = 37 * result + forbiddenModifiers;
+               return result;
+       }
+
        public boolean matches(int modifiers) {
-               return ((modifiers & requiredModifiers) == requiredModifiers) &&
-                       ((modifiers & forbiddenModifiers) == 0);
+               return ((modifiers & requiredModifiers) == requiredModifiers) && ((modifiers & forbiddenModifiers) == 0);
        }
-       
 
        public static ModifiersPattern read(VersionedDataInputStream s) throws IOException {
                int requiredModifiers = s.readShort();
                int forbiddenModifiers = s.readShort();
-               if (requiredModifiers == 0 && forbiddenModifiers == 0) return ANY;
+               if (requiredModifiers == 0 && forbiddenModifiers == 0) {
+                       return ANY;
+               }
                return new ModifiersPattern(requiredModifiers, forbiddenModifiers);
        }
 
-       /**
-        * @see org.aspectj.weaver.patterns.PatternNode#write(DataOutputStream)
-        */
-       public void write(DataOutputStream s) throws IOException {
-               //s.writeByte(MODIFIERS_PATTERN);
+       public void write(CompressingDataOutputStream s) throws IOException {
+               // s.writeByte(MODIFIERS_PATTERN);
                s.writeShort(requiredModifiers);
                s.writeShort(forbiddenModifiers);
        }
-       
-       
+
        private static Map modifierFlags = null;
 
        public static int getModifierFlag(String name) {
@@ -88,12 +90,14 @@ public class ModifiersPattern extends PatternNode {
                                flag = flag << 1;
                        }
                }
-               Integer flag = (Integer)modifierFlags.get(name);
-               if (flag == null) return -1;
+               Integer flag = (Integer) modifierFlags.get(name);
+               if (flag == null) {
+                       return -1;
+               }
                return flag.intValue();
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 }
index f4b61f4ea546ca29e7023305db3b7d668e6837dd..561b991975505395a25d33b42f0e6dae90e4596d 100644 (file)
@@ -12,9 +12,9 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.VersionedDataInputStream;
 
 public class NamePattern extends PatternNode {
@@ -168,7 +168,7 @@ public class NamePattern extends PatternNode {
        }
 
        @Override
-       public void write(DataOutputStream out) throws IOException {
+       public void write(CompressingDataOutputStream out) throws IOException {
                out.writeUTF(new String(pattern));
        }
 
index 02802946a874de0df77039ac3b3cf2645e1382c8..76acc110ab7b515542f1aeff50fa31073c3af44b 100644 (file)
@@ -9,12 +9,12 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -24,51 +24,61 @@ import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 public class NotAnnotationTypePattern extends AnnotationTypePattern {
 
        AnnotationTypePattern negatedPattern;
-       
+
        public NotAnnotationTypePattern(AnnotationTypePattern pattern) {
                this.negatedPattern = pattern;
                setLocation(pattern.getSourceContext(), pattern.getStart(), pattern.getEnd());
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.AnnotationTypePattern#matches(org.aspectj.weaver.AnnotatedElement)
         */
        public FuzzyBoolean matches(AnnotatedElement annotated) {
                return negatedPattern.matches(annotated).not();
        }
-       
-       public FuzzyBoolean matches(AnnotatedElement annotated,ResolvedType[] parameterAnnotations) {
-               return negatedPattern.matches(annotated,parameterAnnotations).not();
+
+       public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {
+               return negatedPattern.matches(annotated, parameterAnnotations).not();
        }
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolve(org.aspectj.weaver.World)
         */
        public void resolve(World world) {
                negatedPattern.resolve(world);
        }
 
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope, org.aspectj.weaver.patterns.Bindings, boolean)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope,
+        * org.aspectj.weaver.patterns.Bindings, boolean)
         */
-       public AnnotationTypePattern resolveBindings(IScope scope,
-                       Bindings bindings, boolean allowBinding) {
-               negatedPattern = negatedPattern.resolveBindings(scope,bindings,allowBinding);
+       public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) {
+               negatedPattern = negatedPattern.resolveBindings(scope, bindings, allowBinding);
                return this;
        }
 
-       
-       public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) {
-               AnnotationTypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap,w);
+       public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+               AnnotationTypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap, w);
                NotAnnotationTypePattern ret = new NotAnnotationTypePattern(newNegatedPattern);
                ret.copyLocationFrom(this);
-               if (this.isForParameterAnnotationMatch()) ret.setForParameterAnnotationMatch();
+               if (this.isForParameterAnnotationMatch()) {
+                       ret.setForParameterAnnotationMatch();
+               }
                return ret;
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.NOT);
                negatedPattern.write(s);
                writeLocation(s);
@@ -76,41 +86,46 @@ public class NotAnnotationTypePattern extends AnnotationTypePattern {
        }
 
        public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
-               AnnotationTypePattern ret = new NotAnnotationTypePattern(AnnotationTypePattern.read(s,context));
-               ret.readLocation(context,s);
-               if (s.getMajorVersion()>=WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160) {
-                       if (s.readBoolean()) ret.setForParameterAnnotationMatch();
+               AnnotationTypePattern ret = new NotAnnotationTypePattern(AnnotationTypePattern.read(s, context));
+               ret.readLocation(context, s);
+               if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160) {
+                       if (s.readBoolean()) {
+                               ret.setForParameterAnnotationMatch();
+                       }
                }
                return ret;
        }
-       
+
        public boolean equals(Object obj) {
-               if (!(obj instanceof NotAnnotationTypePattern)) return false;
+               if (!(obj instanceof NotAnnotationTypePattern)) {
+                       return false;
+               }
                NotAnnotationTypePattern other = (NotAnnotationTypePattern) obj;
-               return other.negatedPattern.equals(negatedPattern) && other.isForParameterAnnotationMatch()==isForParameterAnnotationMatch();
+               return other.negatedPattern.equals(negatedPattern)
+                               && other.isForParameterAnnotationMatch() == isForParameterAnnotationMatch();
        }
 
        public int hashCode() {
-               int result = 17 + 37*negatedPattern.hashCode();
-               result = 37*result +(isForParameterAnnotationMatch()?0:1);
+               int result = 17 + 37 * negatedPattern.hashCode();
+               result = 37 * result + (isForParameterAnnotationMatch() ? 0 : 1);
                return result;
        }
-       
+
        public String toString() {
                return "!" + negatedPattern.toString();
        }
-       
+
        public AnnotationTypePattern getNegatedPattern() {
                return negatedPattern;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
-               negatedPattern.traverse(visitor,ret);
+               Object ret = accept(visitor, data);
+               negatedPattern.traverse(visitor, ret);
                return ret;
        }
 
index 4a131c9a84712f8c1e25a13a03b4392cd644b5df..09ce1f6d861347fd220671ee2e0e6422e33b2f40 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -28,28 +27,31 @@ import org.aspectj.weaver.ast.Test;
 
 public class NotPointcut extends Pointcut {
        private Pointcut body;
+
        public NotPointcut(Pointcut negated) {
                super();
                this.body = negated;
                this.pointcutKind = NOT;
-               setLocation(negated.getSourceContext(), negated.getStart(),negated.getEnd()); // should that be at least start-1?
+               setLocation(negated.getSourceContext(), negated.getStart(), negated.getEnd()); // should that be at least start-1?
        }
 
        public NotPointcut(Pointcut pointcut, int startPos) {
                this(pointcut);
-               setLocation(pointcut.getSourceContext(), startPos, pointcut.getEnd());          
+               setLocation(pointcut.getSourceContext(), startPos, pointcut.getEnd());
        }
 
        public int couldMatchKinds() {
                return Shadow.ALL_SHADOW_KINDS_BITS;
        }
-       
-       public Pointcut getNegatedPointcut() { return body; }
+
+       public Pointcut getNegatedPointcut() {
+               return body;
+       }
 
        public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return body.fastMatch(type).not();
        }
-       
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                return body.match(shadow).not();
        }
@@ -58,36 +60,37 @@ public class NotPointcut extends Pointcut {
                return "!" + body.toString();
 
        }
-       
-       public boolean equals(Object other) { 
-               if (!(other instanceof NotPointcut)) return false;
-               NotPointcut o = (NotPointcut)other;
+
+       public boolean equals(Object other) {
+               if (!(other instanceof NotPointcut)) {
+                       return false;
+               }
+               NotPointcut o = (NotPointcut) other;
                return o.body.equals(body);
        }
-    public int hashCode() {
-        return 37*23 + body.hashCode();
-    }
 
+       public int hashCode() {
+               return 37 * 23 + body.hashCode();
+       }
 
        public void resolveBindings(IScope scope, Bindings bindings) {
-               //Bindings old = bindings.copy();
-               
-               //Bindings newBindings = new Bindings(bindings.size());
-               
-               
+               // Bindings old = bindings.copy();
+
+               // Bindings newBindings = new Bindings(bindings.size());
+
                body.resolveBindings(scope, null);
-               
-               //newBindings.checkEmpty(scope, "negation does not allow binding");
-               //bindings.checkEquals(old, scope);
-               
+
+               // newBindings.checkEmpty(scope, "negation does not allow binding");
+               // bindings.checkEquals(old, scope);
+
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.NOT);
                body.write(s);
                writeLocation(s);
        }
-       
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                NotPointcut ret = new NotPointcut(Pointcut.read(s, context));
                ret.readLocation(context, s);
@@ -97,26 +100,26 @@ public class NotPointcut extends Pointcut {
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                return Test.makeNot(body.findResidue(shadow, state));
        }
-       
+
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                Pointcut ret = new NotPointcut(body.concretize(inAspect, declaringType, bindings));
                ret.copyLocationFrom(this);
                return ret;
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-               Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap,w));
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               Pointcut ret = new NotPointcut(body.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
-               this.body.traverse(visitor,ret);
+               Object ret = accept(visitor, data);
+               this.body.traverse(visitor, ret);
                return ret;
        }
 
index 14f7dad6d0f9b53a411783e7043fe56cfa9b96d2..cea4b84d459432715d70bf740c38bae7138511f1 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AjAttribute;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -83,7 +83,7 @@ public class NotTypePattern extends TypePattern {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.NOT);
                negatedPattern.write(s);
                annotationPattern.write(s);
index 9c70ac337f27229917db1aee047bc5a1464c170b..559b0046a6882204e9fb9a3e67b19a16b5324ba4 100644 (file)
@@ -9,12 +9,12 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -25,7 +25,7 @@ public class OrAnnotationTypePattern extends AnnotationTypePattern {
 
        private AnnotationTypePattern left;
        private AnnotationTypePattern right;
-       
+
        public OrAnnotationTypePattern(AnnotationTypePattern left, AnnotationTypePattern right) {
                this.left = left;
                this.right = right;
@@ -36,84 +36,97 @@ public class OrAnnotationTypePattern extends AnnotationTypePattern {
                return left.matches(annotated).or(right.matches(annotated));
        }
 
-       public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations ) {
-               return left.matches(annotated,parameterAnnotations).or(right.matches(annotated,parameterAnnotations));
+       public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) {
+               return left.matches(annotated, parameterAnnotations).or(right.matches(annotated, parameterAnnotations));
        }
-       
+
        public void resolve(World world) {
                left.resolve(world);
                right.resolve(world);
        }
 
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope, org.aspectj.weaver.patterns.Bindings, boolean)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope,
+        * org.aspectj.weaver.patterns.Bindings, boolean)
         */
-       public AnnotationTypePattern resolveBindings(IScope scope,
-                       Bindings bindings, boolean allowBinding) {
-               left = left.resolveBindings(scope,bindings,allowBinding);
-               right =right.resolveBindings(scope,bindings,allowBinding);
+       public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) {
+               left = left.resolveBindings(scope, bindings, allowBinding);
+               right = right.resolveBindings(scope, bindings, allowBinding);
                return this;
        }
 
-       public AnnotationTypePattern parameterizeWith(Map typeVariableMap,World w) {
-               AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap,w);
-               AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap,w);
-               OrAnnotationTypePattern ret = new OrAnnotationTypePattern(newLeft,newRight);
+       public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) {
+               AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w);
+               AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w);
+               OrAnnotationTypePattern ret = new OrAnnotationTypePattern(newLeft, newRight);
                ret.copyLocationFrom(this);
-               if (isForParameterAnnotationMatch()) ret.setForParameterAnnotationMatch();
+               if (isForParameterAnnotationMatch()) {
+                       ret.setForParameterAnnotationMatch();
+               }
                return ret;
        }
 
        public Object accept(PatternNodeVisitor visitor, Object data) {
-               return visitor.visit(this,data);
+               return visitor.visit(this, data);
        }
-       
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
-               left.traverse(visitor,ret);
-               right.traverse(visitor,ret);
+               Object ret = accept(visitor, data);
+               left.traverse(visitor, ret);
+               right.traverse(visitor, ret);
                return ret;
        }
-       
+
        public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
-               AnnotationTypePattern p = new OrAnnotationTypePattern(
-                               AnnotationTypePattern.read(s,context),
-                               AnnotationTypePattern.read(s,context));
-               p.readLocation(context,s);
-               if (s.getMajorVersion()>=WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160) {
-                       if (s.readBoolean()) p.setForParameterAnnotationMatch();
+               AnnotationTypePattern p = new OrAnnotationTypePattern(AnnotationTypePattern.read(s, context), AnnotationTypePattern.read(s,
+                               context));
+               p.readLocation(context, s);
+               if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160) {
+                       if (s.readBoolean()) {
+                               p.setForParameterAnnotationMatch();
+                       }
                }
-               return p;               
+               return p;
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.OR);
                left.write(s);
                right.write(s);
                writeLocation(s);
                s.writeBoolean(isForParameterAnnotationMatch());
        }
-       
+
        public boolean equals(Object obj) {
-               if (!(obj instanceof OrAnnotationTypePattern)) return false;
+               if (!(obj instanceof OrAnnotationTypePattern)) {
+                       return false;
+               }
                OrAnnotationTypePattern other = (OrAnnotationTypePattern) obj;
-               return (left.equals(other.left) && right.equals(other.right)) && isForParameterAnnotationMatch()==other.isForParameterAnnotationMatch();
+               return (left.equals(other.left) && right.equals(other.right))
+                               && isForParameterAnnotationMatch() == other.isForParameterAnnotationMatch();
        }
-       
+
        public int hashCode() {
                int result = 17;
-               result = result*37 + left.hashCode();
-               result = result*37 + right.hashCode();
-               result = result*37 + (isForParameterAnnotationMatch()?0:1);
-               return result;          
+               result = result * 37 + left.hashCode();
+               result = result * 37 + right.hashCode();
+               result = result * 37 + (isForParameterAnnotationMatch() ? 0 : 1);
+               return result;
        }
-       
+
        public String toString() {
                return "(" + left.toString() + " || " + right.toString() + ")";
        }
 
-       public AnnotationTypePattern getLeft() { return left; }
-       public AnnotationTypePattern getRight() { return right; }
+       public AnnotationTypePattern getLeft() {
+               return left;
+       }
+
+       public AnnotationTypePattern getRight() {
+               return right;
+       }
 
        public void setForParameterAnnotationMatch() {
                left.setForParameterAnnotationMatch();
index 01637f3b64c316cc8d105217b1321a5eec14ca2b..d1426e60650cdc2b354709b47c519d6eac6e7da6 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -46,71 +45,79 @@ public class OrPointcut extends Pointcut {
        public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return left.fastMatch(type).or(right.fastMatch(type));
        }
-       
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
                FuzzyBoolean leftMatch = left.match(shadow);
-               if (leftMatch.alwaysTrue()) return leftMatch;
+               if (leftMatch.alwaysTrue()) {
+                       return leftMatch;
+               }
                return leftMatch.or(right.match(shadow));
        }
-       
+
        public String toString() {
                return "(" + left.toString() + " || " + right.toString() + ")";
        }
-       
-       public boolean equals(Object other) { 
-               if (!(other instanceof OrPointcut)) return false;
-               OrPointcut o = (OrPointcut)other;
+
+       public boolean equals(Object other) {
+               if (!(other instanceof OrPointcut)) {
+                       return false;
+               }
+               OrPointcut o = (OrPointcut) other;
                return o.left.equals(left) && o.right.equals(right);
        }
-    public int hashCode() {
-        int result = 31;
-        result = 37*result + left.hashCode();
-        result = 37*result + right.hashCode();
-        return result;
-    }
+
+       public int hashCode() {
+               int result = 31;
+               result = 37 * result + left.hashCode();
+               result = 37 * result + right.hashCode();
+               return result;
+       }
+
        /**
         * @see org.aspectj.weaver.patterns.Pointcut#resolveBindings(IScope, Bindings)
         */
        public void resolveBindings(IScope scope, Bindings bindings) {
                Bindings old = bindings == null ? null : bindings.copy();
-               
+
                left.resolveBindings(scope, bindings);
                right.resolveBindings(scope, old);
-               if (bindings != null) bindings.checkEquals(old, scope);
-               
+               if (bindings != null) {
+                       bindings.checkEquals(old, scope);
+               }
+
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.OR);
                left.write(s);
                right.write(s);
                writeLocation(s);
        }
-       
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                OrPointcut ret = new OrPointcut(Pointcut.read(s, context), Pointcut.read(s, context));
                ret.readLocation(context, s);
                return ret;
-       
+
        }
+
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                return Test.makeOr(left.findResidue(shadow, state), right.findResidue(shadow, state));
        }
-       
+
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
-               Pointcut ret = new OrPointcut(left.concretize(inAspect, declaringType, bindings),
-                                                               right.concretize(inAspect, declaringType, bindings));
+               Pointcut ret = new OrPointcut(left.concretize(inAspect, declaringType, bindings), right.concretize(inAspect, declaringType,
+                               bindings));
                ret.copyLocationFrom(this);
                return ret;
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-               Pointcut ret = new OrPointcut(left.parameterizeWith(typeVariableMap,w),
-                                                                         right.parameterizeWith(typeVariableMap,w));
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               Pointcut ret = new OrPointcut(left.parameterizeWith(typeVariableMap, w), right.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
-       
+
        public Pointcut getLeft() {
                return left;
        }
@@ -119,14 +126,14 @@ public class OrPointcut extends Pointcut {
                return right;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
+               Object ret = accept(visitor, data);
                left.traverse(visitor, ret);
-               right.traverse(visitor,ret);
+               right.traverse(visitor, ret);
                return ret;
        }
 }
index 52a18d50a43167ac24d8b9f1824f55f767876fce..d61917a998b20330f55df8d79db8205e20e134ab 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -26,109 +25,112 @@ import org.aspectj.weaver.World;
 /**
  * left || right
  * 
- * <p>any binding to formals is explicitly forbidden for any composite by the language
+ * <p>
+ * any binding to formals is explicitly forbidden for any composite by the language
  * 
  * @author Erik Hilsdale
  * @author Jim Hugunin
  */
 public class OrTypePattern extends TypePattern {
        private TypePattern left, right;
-       
+
        public OrTypePattern(TypePattern left, TypePattern right) {
-               super(false,false);  //??? we override all methods that care about includeSubtypes
+               super(false, false); // ??? we override all methods that care about includeSubtypes
                this.left = left;
                this.right = right;
                setLocation(left.getSourceContext(), left.getStart(), right.getEnd());
        }
 
-    public TypePattern getRight() {
-        return right;
-    }
+       public TypePattern getRight() {
+               return right;
+       }
 
-    public TypePattern getLeft() {
-        return left;
-    }
+       public TypePattern getLeft() {
+               return left;
+       }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
         */
        protected boolean couldEverMatchSameTypesAs(TypePattern other) {
                return true; // don't dive at the moment...
        }
-       
+
        public FuzzyBoolean matchesInstanceof(ResolvedType type) {
                return left.matchesInstanceof(type).or(right.matchesInstanceof(type));
        }
 
        protected boolean matchesExactly(ResolvedType type) {
-               //??? if these had side-effects, this sort-circuit could be a mistake
+               // ??? if these had side-effects, this sort-circuit could be a mistake
                return left.matchesExactly(type) || right.matchesExactly(type);
        }
 
        protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
-               //??? if these had side-effects, this sort-circuit could be a mistake
-               return left.matchesExactly(type,annotatedType) || right.matchesExactly(type,annotatedType);
+               // ??? if these had side-effects, this sort-circuit could be a mistake
+               return left.matchesExactly(type, annotatedType) || right.matchesExactly(type, annotatedType);
        }
-       
+
        public boolean matchesStatically(ResolvedType type) {
                return left.matchesStatically(type) || right.matchesStatically(type);
        }
-       
+
        public void setIsVarArgs(boolean isVarArgs) {
                this.isVarArgs = isVarArgs;
                left.setIsVarArgs(isVarArgs);
                right.setIsVarArgs(isVarArgs);
        }
-       
+
        public void setAnnotationTypePattern(AnnotationTypePattern annPatt) {
-               if (annPatt == AnnotationTypePattern.ANY) return;
+               if (annPatt == AnnotationTypePattern.ANY) {
+                       return;
+               }
                if (left.annotationPattern == AnnotationTypePattern.ANY) {
                        left.setAnnotationTypePattern(annPatt);
                } else {
-                       left.setAnnotationTypePattern(
-                                       new AndAnnotationTypePattern(left.annotationPattern,annPatt));
+                       left.setAnnotationTypePattern(new AndAnnotationTypePattern(left.annotationPattern, annPatt));
                }
                if (right.annotationPattern == AnnotationTypePattern.ANY) {
-                       right.setAnnotationTypePattern(annPatt);                        
+                       right.setAnnotationTypePattern(annPatt);
                } else {
-                       right.setAnnotationTypePattern(
-                                       new AndAnnotationTypePattern(right.annotationPattern,annPatt));                 
+                       right.setAnnotationTypePattern(new AndAnnotationTypePattern(right.annotationPattern, annPatt));
                }
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.OR);
                left.write(s);
                right.write(s);
                writeLocation(s);
        }
-       
+
        public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                OrTypePattern ret = new OrTypePattern(TypePattern.read(s, context), TypePattern.read(s, context));
                ret.readLocation(context, s);
-               if (ret.left.isVarArgs && ret.right.isVarArgs) ret.isVarArgs = true;
+               if (ret.left.isVarArgs && ret.right.isVarArgs) {
+                       ret.isVarArgs = true;
+               }
                return ret;
        }
 
-       public TypePattern resolveBindings(
-               IScope scope,
-               Bindings bindings,
-               boolean allowBinding, boolean requireExactType)
-       {
-               if (requireExactType) return notExactType(scope);
+       public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
+               if (requireExactType) {
+                       return notExactType(scope);
+               }
                left = left.resolveBindings(scope, bindings, false, false);
                right = right.resolveBindings(scope, bindings, false, false);
                return this;
        }
-       
-       public TypePattern parameterizeWith(Map typeVariableMap,World w) {
-               TypePattern newLeft = left.parameterizeWith(typeVariableMap,w);
-               TypePattern newRight = right.parameterizeWith(typeVariableMap,w);
-               OrTypePattern ret = new OrTypePattern(newLeft,newRight);
+
+       public TypePattern parameterizeWith(Map typeVariableMap, World w) {
+               TypePattern newLeft = left.parameterizeWith(typeVariableMap, w);
+               TypePattern newRight = right.parameterizeWith(typeVariableMap, w);
+               OrTypePattern ret = new OrTypePattern(newLeft, newRight);
                ret.copyLocationFrom(this);
                return ret;
        }
-       
+
        public String toString() {
                StringBuffer buff = new StringBuffer();
                if (annotationPattern != AnnotationTypePattern.ANY) {
@@ -150,17 +152,23 @@ public class OrTypePattern extends TypePattern {
        public boolean isStarAnnotation() {
                return left.isStarAnnotation() || right.isStarAnnotation();
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see java.lang.Object#equals(java.lang.Object)
         */
        public boolean equals(Object obj) {
-               if (! (obj instanceof OrTypePattern)) return false;
+               if (!(obj instanceof OrTypePattern)) {
+                       return false;
+               }
                OrTypePattern other = (OrTypePattern) obj;
                return left.equals(other.left) && right.equals(other.right);
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see java.lang.Object#hashCode()
         */
        public int hashCode() {
@@ -170,12 +178,12 @@ public class OrTypePattern extends TypePattern {
                return ret;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-       
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
+               Object ret = accept(visitor, data);
                left.traverse(visitor, ret);
                right.traverse(visitor, ret);
                return ret;
index 8cf9f3ffb57565d5b0513b0794739e6674308209..8a7aae0978fd3509296b0076e71b119fb716ebf3 100644 (file)
@@ -10,7 +10,6 @@
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
 import java.io.DataInputStream;
@@ -18,6 +17,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.IHasSourceLocation;
 import org.aspectj.weaver.ISourceContext;
 
@@ -37,53 +37,52 @@ public abstract class PatternNode implements IHasSourceLocation {
        public int getEnd() {
                return end + (sourceContext != null ? sourceContext.getOffset() : 0);
        }
-       
+
        public ISourceContext getSourceContext() {
                return sourceContext;
        }
-       
+
        public String getFileName() {
                return "unknown";
        }
 
-    public void setLocation(ISourceContext sourceContext, int start, int end) {
-       this.sourceContext = sourceContext;
-       this.start = start;
-       this.end = end;
-    }
-    
-    public void copyLocationFrom(PatternNode other) {
-       this.start = other.start;
-       this.end = other.end;
-       this.sourceContext = other.sourceContext;
-    }
-    
-    public ISourceLocation getSourceLocation() {
-       //System.out.println("get context: " + this + " is " + sourceContext);
-       if (sourceContext == null) {
-               //System.err.println("no context: " + this);
-               return null;
-       }
-       return sourceContext.makeSourceLocation(this);
-    }
-
-       public abstract void write(DataOutputStream s) throws IOException;
+       public void setLocation(ISourceContext sourceContext, int start, int end) {
+               this.sourceContext = sourceContext;
+               this.start = start;
+               this.end = end;
+       }
+
+       public void copyLocationFrom(PatternNode other) {
+               this.start = other.start;
+               this.end = other.end;
+               this.sourceContext = other.sourceContext;
+       }
+
+       public ISourceLocation getSourceLocation() {
+               // System.out.println("get context: " + this + " is " + sourceContext);
+               if (sourceContext == null) {
+                       // System.err.println("no context: " + this);
+                       return null;
+               }
+               return sourceContext.makeSourceLocation(this);
+       }
 
+       public abstract void write(CompressingDataOutputStream s) throws IOException;
 
        public void writeLocation(DataOutputStream s) throws IOException {
                s.writeInt(start);
                s.writeInt(end);
        }
-       
+
        public void readLocation(ISourceContext context, DataInputStream s) throws IOException {
                start = s.readInt();
                end = s.readInt();
                this.sourceContext = context;
        }
 
-    public abstract Object accept(PatternNodeVisitor visitor, Object data);
-       
+       public abstract Object accept(PatternNodeVisitor visitor, Object data);
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               return accept(visitor,data);
+               return accept(visitor, data);
        }
 }
index 7cc0a242b0507be47b9c5fe3496dea7e3e859d93..1d58260a6cd11be06d70d2d4f542404198377f41 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
@@ -23,6 +22,7 @@ import java.util.Map;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AjcMemberMaker;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.CrosscuttingMembers;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.Member;
@@ -83,8 +83,9 @@ public class PerCflow extends PerClause {
        public PerClause concretize(ResolvedType inAspect) {
                PerCflow ret = new PerCflow(entry, isBelow);
                ret.inAspect = inAspect;
-               if (inAspect.isAbstract())
+               if (inAspect.isAbstract()) {
                        return ret;
+               }
 
                Member cflowStackField = new ResolvedMemberImpl(Member.FIELD, inAspect, Modifier.STATIC | Modifier.PUBLIC | Modifier.FINAL,
                                UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE), NameMangler.PERCFLOW_FIELD_NAME, UnresolvedType.NONE);
@@ -121,7 +122,7 @@ public class PerCflow extends PerClause {
                return ret;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                PERCFLOW.write(s);
                entry.write(s);
                s.writeBoolean(isBelow);
@@ -147,14 +148,16 @@ public class PerCflow extends PerClause {
        }
 
        public String toDeclarationString() {
-               if (isBelow)
+               if (isBelow) {
                        return "percflowbelow(" + entry + ")";
+               }
                return "percflow(" + entry + ")";
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof PerCflow))
+               if (!(other instanceof PerCflow)) {
                        return false;
+               }
                PerCflow pc = (PerCflow) other;
                return (pc.isBelow && isBelow) && ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect))
                                && ((pc.entry == null) ? (entry == null) : pc.entry.equals(entry));
index 13c81fe93dac7b5eb4ecd2e1c9b5dffade3f38da..d513d65f7ce633671a123cd817a72afb19fd51d6 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.Shadow;
@@ -29,15 +28,15 @@ import org.aspectj.weaver.ast.Test;
 
 public class PerFromSuper extends PerClause {
        private PerClause.Kind kind;
-       
+
        public PerFromSuper(PerClause.Kind kind) {
                this.kind = kind;
        }
 
        public Object accept(PatternNodeVisitor visitor, Object data) {
-               return visitor.visit(this,data);
+               return visitor.visit(this, data);
        }
-       
+
        public int couldMatchKinds() {
                return Shadow.ALL_SHADOW_KINDS_BITS;
        }
@@ -45,70 +44,67 @@ public class PerFromSuper extends PerClause {
        public FuzzyBoolean fastMatch(FastMatchInfo type) {
                throw new RuntimeException("unimplemented");
        }
-               
-    protected FuzzyBoolean matchInternal(Shadow shadow) {
-        throw new RuntimeException("unimplemented");
-    }
 
-    public void resolveBindings(IScope scope, Bindings bindings) {
-       // this method intentionally left blank
-    }
+       protected FuzzyBoolean matchInternal(Shadow shadow) {
+               throw new RuntimeException("unimplemented");
+       }
 
-    protected Test findResidueInternal(Shadow shadow, ExposedState state) {
-       throw new RuntimeException("unimplemented");
-    }
+       public void resolveBindings(IScope scope, Bindings bindings) {
+               // this method intentionally left blank
+       }
 
+       protected Test findResidueInternal(Shadow shadow, ExposedState state) {
+               throw new RuntimeException("unimplemented");
+       }
 
        public PerClause concretize(ResolvedType inAspect) {
                PerClause p = lookupConcretePerClause(inAspect.getSuperclass());
                if (p == null) {
                        inAspect.getWorld().getMessageHandler().handleMessage(
-                         MessageUtil.error(WeaverMessages.format(WeaverMessages.MISSING_PER_CLAUSE,inAspect.getSuperclass()), getSourceLocation())
-                       );
-            return new PerSingleton().concretize(inAspect);// AV: fallback on something else NPE in AJDT
+                                       MessageUtil.error(WeaverMessages.format(WeaverMessages.MISSING_PER_CLAUSE, inAspect.getSuperclass()),
+                                                       getSourceLocation()));
+                       return new PerSingleton().concretize(inAspect);// AV: fallback on something else NPE in AJDT
                } else {
-            if (p.getKind() != kind) {
-                inAspect.getWorld().getMessageHandler().handleMessage(
-                  MessageUtil.error(WeaverMessages.format(WeaverMessages.WRONG_PER_CLAUSE,kind,p.getKind()),
-                                    getSourceLocation())
-                );
-            }
-            return p.concretize(inAspect);
-        }
-       }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
+                       if (p.getKind() != kind) {
+                               inAspect.getWorld().getMessageHandler().handleMessage(
+                                               MessageUtil.error(WeaverMessages.format(WeaverMessages.WRONG_PER_CLAUSE, kind, p.getKind()),
+                                                               getSourceLocation()));
+                       }
+                       return p.concretize(inAspect);
+               }
+       }
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
                return this;
        }
-       
-       
-       
+
        public PerClause lookupConcretePerClause(ResolvedType lookupType) {
                PerClause ret = lookupType.getPerClause();
-               if (ret == null) return null;
+               if (ret == null) {
+                       return null;
+               }
                if (ret instanceof PerFromSuper) {
                        return lookupConcretePerClause(lookupType.getSuperclass());
                }
                return ret;
        }
-       
 
-    public void write(DataOutputStream s) throws IOException {
-       FROMSUPER.write(s);
-       kind.write(s);
-       writeLocation(s);
-    }
-    
+       public void write(CompressingDataOutputStream s) throws IOException {
+               FROMSUPER.write(s);
+               kind.write(s);
+               writeLocation(s);
+       }
+
        public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException {
                PerFromSuper ret = new PerFromSuper(Kind.read(s));
                ret.readLocation(context, s);
                return ret;
        }
-       
+
        public String toString() {
                return "perFromSuper(" + kind + ", " + inAspect + ")";
        }
-       
+
        public String toDeclarationString() {
                return "";
        }
@@ -117,19 +113,19 @@ public class PerFromSuper extends PerClause {
                return kind;
        }
 
-    public boolean equals(Object other) {
-       if (!(other instanceof PerFromSuper)) return false;
-       PerFromSuper pc = (PerFromSuper)other;   
-       return pc.kind.equals(kind) 
-                       && ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect));
-    }
-    
-    public int hashCode() {
-        int result = 17;
-        result = 37*result + kind.hashCode();
-        result = 37*result + ((inAspect == null) ? 0 : inAspect.hashCode());     
-        return result;
-    }
-    
-       
+       public boolean equals(Object other) {
+               if (!(other instanceof PerFromSuper)) {
+                       return false;
+               }
+               PerFromSuper pc = (PerFromSuper) other;
+               return pc.kind.equals(kind) && ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect));
+       }
+
+       public int hashCode() {
+               int result = 17;
+               result = 37 * result + kind.hashCode();
+               result = 37 * result + ((inAspect == null) ? 0 : inAspect.hashCode());
+               return result;
+       }
+
 }
index ab28c8fae8ea8778a10d06ee2b16c2038b6e3ece..3a799f78ecf5b4569130e80e4dc0d972a0831854 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AjcMemberMaker;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.PerObjectInterfaceTypeMunger;
 import org.aspectj.weaver.ResolvedType;
@@ -42,10 +42,12 @@ public class PerObject extends PerClause {
                int targFlags = Shadow.ALL_SHADOW_KINDS_BITS;
                for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) {
                        Shadow.Kind kind = Shadow.SHADOW_KINDS[i];
-                       if (kind.neverHasThis())
+                       if (kind.neverHasThis()) {
                                thisFlags -= kind.bit;
-                       if (kind.neverHasTarget())
+                       }
+                       if (kind.neverHasTarget()) {
                                targFlags -= kind.bit;
+                       }
                }
                thisKindSet = thisFlags;
                targetKindSet = targFlags;
@@ -73,10 +75,11 @@ public class PerObject extends PerClause {
                // System.err.println("matches " + this + " ? " + shadow + ", " +
                // shadow.hasTarget());
                // ??? could probably optimize this better by testing could match
-               if (isThis)
+               if (isThis) {
                        return FuzzyBoolean.fromBoolean(shadow.hasThis());
-               else
+               } else {
                        return FuzzyBoolean.fromBoolean(shadow.hasTarget());
+               }
        }
 
        public void resolveBindings(IScope scope, Bindings bindings) {
@@ -105,8 +108,9 @@ public class PerObject extends PerClause {
                PerObject ret = new PerObject(entry, isThis);
 
                ret.inAspect = inAspect;
-               if (inAspect.isAbstract())
+               if (inAspect.isAbstract()) {
                        return ret;
+               }
 
                World world = inAspect.getWorld();
 
@@ -136,7 +140,7 @@ public class PerObject extends PerClause {
                return ret;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                PEROBJECT.write(s);
                entry.write(s);
                s.writeBoolean(isThis);
@@ -170,8 +174,9 @@ public class PerObject extends PerClause {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof PerObject))
+               if (!(other instanceof PerObject)) {
                        return false;
+               }
                PerObject pc = (PerObject) other;
                return (pc.isThis && isThis) && ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect))
                                && ((pc.entry == null) ? (entry == null) : pc.entry.equals(entry));
index e91e9f45dfb5ae4174ca222562ffbada6a557d9f..798b1ba55402a90bf2dadc88e3a9b557eafd33b4 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AjcMemberMaker;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedType;
@@ -134,7 +134,7 @@ public class PerSingleton extends PerClause {
                return ret;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                SINGLETON.write(s);
                writeLocation(s);
        }
@@ -158,8 +158,9 @@ public class PerSingleton extends PerClause {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof PerSingleton))
+               if (!(other instanceof PerSingleton)) {
                        return false;
+               }
                PerSingleton pc = (PerSingleton) other;
                return ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect));
        }
index 9c1fd655bde7a3e7990425c13dcef06e95508e7f..0bcc858706c704fd638b5f846a9b6761ee40b85a 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
@@ -22,6 +21,7 @@ import org.aspectj.bridge.Message;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AjcMemberMaker;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.PerTypeWithinTargetTypeMunger;
@@ -86,8 +86,9 @@ public class PerTypeWithin extends PerClause {
                // in a pertypewithin aspect - the JPs only exist in the static
                // initializer and can't
                // call the localAspectOf() method.
-               if (enclosingType.isInterface())
+               if (enclosingType.isInterface()) {
                        return FuzzyBoolean.NO;
+               }
 
                typePattern.resolve(shadow.getIWorld());
                return isWithinType(enclosingType);
@@ -137,8 +138,9 @@ public class PerTypeWithin extends PerClause {
                PerTypeWithin ret = new PerTypeWithin(typePattern);
                ret.copyLocationFrom(this);
                ret.inAspect = inAspect;
-               if (inAspect.isAbstract())
+               if (inAspect.isAbstract()) {
                        return ret;
+               }
 
                World world = inAspect.getWorld();
 
@@ -178,7 +180,7 @@ public class PerTypeWithin extends PerClause {
 
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                PERTYPEWITHIN.write(s);
                typePattern.write(s);
                writeLocation(s);
@@ -213,8 +215,9 @@ public class PerTypeWithin extends PerClause {
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof PerTypeWithin))
+               if (!(other instanceof PerTypeWithin)) {
                        return false;
+               }
                PerTypeWithin pc = (PerTypeWithin) other;
                return ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect))
                                && ((pc.typePattern == null) ? (typePattern == null) : pc.typePattern.equals(typePattern));
index da8d98eee3cbee8821e8df68cac32ecbac51c2b9..b9dfc90483f311164dfd6d52b254fba72e051a4c 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
@@ -22,6 +21,7 @@ import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AdviceKind;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.Checker;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.PoliceExtensionUse;
@@ -396,7 +396,7 @@ public abstract class Pointcut extends PatternNode {
                }
 
                @Override
-               public void write(DataOutputStream s) throws IOException {
+               public void write(CompressingDataOutputStream s) throws IOException {
                        s.writeByte(NONE);
                }
 
index 0cc5b9e45fbe56f169b4c087b6a38c45236b8a55..b321382f47c48d1e10507d9dad48857608e9d01c 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
@@ -21,6 +20,7 @@ import java.util.Map;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedPointcutDefinition;
@@ -97,7 +97,7 @@ public class ReferencePointcut extends Pointcut {
                return buf.toString();
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                // XXX ignores onType
                s.writeByte(Pointcut.REFERENCE);
                if (onType != null) {
index 52115f7e4081c1c96665a5fc59792da3e7230e4b..ffd8e64be9e7c22e26ae8e18c51a4e79ff212ea4 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -27,6 +26,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.AjcMemberMaker;
 import org.aspectj.weaver.AnnotationTargetKind;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ConcreteTypeMunger;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.JoinPointSignature;
@@ -894,7 +894,7 @@ public class SignaturePattern extends PatternNode {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                kind.write(s);
                modifiers.write(s);
                returnType.write(s);
index 4cf1202e80618f6fc51fe4fd7378874191ba94bd..7656a08e065ebbfd525def840db603fe25b2bcdf 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -19,6 +18,7 @@ import java.util.Map;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -272,7 +272,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut {
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.ATTHIS_OR_TARGET);
                s.writeBoolean(isThis);
                annotationTypePattern.write(s);
index 974991bc48a4930a414d6f87e4fdaebadde89631..f2e77440bc5cb77d1df18f3e2f120a8fa04ccdb0 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -22,6 +21,7 @@ import java.util.Map;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -125,7 +125,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.THIS_OR_TARGET);
                s.writeBoolean(isThis);
                typePattern.write(s);
index 04dd0c264d06e7f3a9c4dfe225419b514f16c79f..d3e0afce25764acb4bddcff98833149ce01194fc 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 
-
 public class ThrowsPattern extends PatternNode {
        private TypePatternList required;
        private TypePatternList forbidden;
-       
-       public static final ThrowsPattern ANY =
-               new ThrowsPattern(TypePatternList.EMPTY, TypePatternList.EMPTY);
-       
+
+       public static final ThrowsPattern ANY = new ThrowsPattern(TypePatternList.EMPTY, TypePatternList.EMPTY);
+
        public ThrowsPattern(TypePatternList required, TypePatternList forbidden) {
                this.required = required;
                this.forbidden = forbidden;
        }
 
-    public TypePatternList getRequired() {
-        return required;
-    }
+       public TypePatternList getRequired() {
+               return required;
+       }
 
-    public TypePatternList getForbidden() {
-        return forbidden;
-    }
+       public TypePatternList getForbidden() {
+               return forbidden;
+       }
 
        public String toString() {
-               if (this == ANY) return "";
-               
-               
+               if (this == ANY) {
+                       return "";
+               }
+
                String ret = "throws " + required.toString();
                if (forbidden.size() > 0) {
                        ret = ret + " !(" + forbidden.toString() + ")";
                }
                return ret;
        }
-    
+
        public boolean equals(Object other) {
-               if (!(other instanceof ThrowsPattern)) return false;
-               ThrowsPattern o = (ThrowsPattern)other;
-               boolean ret = o.required.equals(this.required) &&
-                               o.forbidden.equals(this.forbidden);
+               if (!(other instanceof ThrowsPattern)) {
+                       return false;
+               }
+               ThrowsPattern o = (ThrowsPattern) other;
+               boolean ret = o.required.equals(this.required) && o.forbidden.equals(this.forbidden);
+               return ret;
+       }
+
+       public int hashCode() {
+               int result = 17;
+               result = 37 * result + required.hashCode();
+               result = 37 * result + forbidden.hashCode();
+               return result;
+       }
+
+       public ThrowsPattern resolveBindings(IScope scope, Bindings bindings) {
+               if (this == ANY) {
+                       return this;
+               }
+               required = required.resolveBindings(scope, bindings, false, false);
+               forbidden = forbidden.resolveBindings(scope, bindings, false, false);
+               return this;
+       }
+
+       public ThrowsPattern parameterizeWith(Map/* name -> resolved type */typeVariableMap, World w) {
+               ThrowsPattern ret = new ThrowsPattern(required.parameterizeWith(typeVariableMap, w), forbidden.parameterizeWith(
+                               typeVariableMap, w));
+               ret.copyLocationFrom(this);
                return ret;
        }
-    public int hashCode() {
-        int result = 17;
-        result = 37*result + required.hashCode();
-        result = 37*result + forbidden.hashCode();
-        return result;
-    }  
-    
-    public ThrowsPattern resolveBindings(IScope scope, Bindings bindings) {
-       if (this == ANY) return this;
-       required = required.resolveBindings(scope, bindings, false, false);
-       forbidden = forbidden.resolveBindings(scope, bindings, false, false);
-       return this;
-    }
-       
-    public ThrowsPattern parameterizeWith(Map/*name -> resolved type*/ typeVariableMap,World w) {
-       ThrowsPattern ret = new ThrowsPattern(
-                       required.parameterizeWith(typeVariableMap,w),
-                       forbidden.parameterizeWith(typeVariableMap,w));
-       ret.copyLocationFrom(this);
-       return ret;
-    }
-    
+
        public boolean matches(UnresolvedType[] tys, World world) {
-               if (this == ANY) return true;
-               
-               //System.out.println("matching: " + this + " with " + Arrays.asList(tys));
-               
+               if (this == ANY) {
+                       return true;
+               }
+
+               // System.out.println("matching: " + this + " with " + Arrays.asList(tys));
+
                ResolvedType[] types = world.resolve(tys);
                // int len = types.length;
-               for (int j=0, lenj = required.size(); j < lenj; j++) {
-                       if (! matchesAny(required.get(j), types)) {
+               for (int j = 0, lenj = required.size(); j < lenj; j++) {
+                       if (!matchesAny(required.get(j), types)) {
                                return false;
                        }
                }
-               for (int j=0, lenj = forbidden.size(); j < lenj; j++) {
+               for (int j = 0, lenj = forbidden.size(); j < lenj; j++) {
                        if (matchesAny(forbidden.get(j), types)) {
                                return false;
                        }
                }
                return true;
        }
-       
-       private boolean matchesAny(
-               TypePattern typePattern,
-               ResolvedType[] types) 
-       {
+
+       private boolean matchesAny(TypePattern typePattern, ResolvedType[] types) {
                for (int i = types.length - 1; i >= 0; i--) {
-                       if (typePattern.matchesStatically(types[i])) return true;       
+                       if (typePattern.matchesStatically(types[i])) {
+                               return true;
+                       }
                }
                return false;
        }
-       
+
        public static ThrowsPattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypePatternList required = TypePatternList.read(s, context);
                TypePatternList forbidden = TypePatternList.read(s, context);
-               if (required.size() == 0 && forbidden.size() == 0) return ANY;
+               if (required.size() == 0 && forbidden.size() == 0) {
+                       return ANY;
+               }
                ThrowsPattern ret = new ThrowsPattern(required, forbidden);
-               //XXXret.readLocation(context, s);
+               // XXXret.readLocation(context, s);
                return ret;
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                required.write(s);
                forbidden.write(s);
-               //XXXwriteLocation(s);
+               // XXXwriteLocation(s);
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-    
-    public Object traverse(PatternNodeVisitor visitor, Object data) {
-       Object ret = accept(visitor,data);
-       forbidden.traverse(visitor, data);
-       required.traverse(visitor, data);
-       return ret;
-    }
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
+
+       public Object traverse(PatternNodeVisitor visitor, Object data) {
+               Object ret = accept(visitor, data);
+               forbidden.traverse(visitor, data);
+               required.traverse(visitor, data);
+               return ret;
+       }
 }
index 06c51dbf26545426d3b5c98e17b10a577fa3117a..beffd131e5d5ab79e95fcc94b67fe3a70b545cbe 100644 (file)
@@ -9,11 +9,11 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -88,7 +88,7 @@ public class TypeCategoryTypePattern extends TypePattern {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.TYPE_CATEGORY);
                s.writeInt(VERSION);
                s.writeInt(category);
index f77352fcc67915497696ee2205ffbbb41bbf589d..bc3d6712f6999f3f62eccb60e617f921451207d6 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 import java.util.Iterator;
@@ -21,6 +20,7 @@ import java.util.Map;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -395,11 +395,8 @@ class EllipsisTypePattern extends TypePattern {
                return FuzzyBoolean.NO;
        }
 
-       /**
-        * @see org.aspectj.weaver.patterns.PatternNode#write(DataOutputStream)
-        */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(ELLIPSIS_KEY);
        }
 
@@ -487,11 +484,8 @@ class AnyTypePattern extends TypePattern {
                return FuzzyBoolean.YES;
        }
 
-       /**
-        * @see org.aspectj.weaver.patterns.PatternNode#write(DataOutputStream)
-        */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(ANY_KEY);
        }
 
@@ -605,7 +599,7 @@ class AnyWithAnnotationTypePattern extends TypePattern {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.ANY_WITH_ANNO);
                annotationPattern.write(s);
                writeLocation(s);
@@ -689,11 +683,8 @@ class NoTypePattern extends TypePattern {
                return FuzzyBoolean.NO;
        }
 
-       /**
-        * @see org.aspectj.weaver.patterns.PatternNode#write(DataOutputStream)
-        */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(NO_KEY);
        }
 
index 991a5128b63bf022c02b6201e84a788fb0b1ee1a..1db65b6888038e59c960a0543187a01b5799a371 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -20,6 +19,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvableTypeList;
@@ -263,7 +263,7 @@ public class TypePatternList extends PatternNode {
                        tLeft--;
                }
        }
-       
+
        public FuzzyBoolean matches(ResolvableTypeList types, TypePattern.MatchKind kind, ResolvedType[][] parameterAnnotations) {
                int nameLength = types.length;
                int patternLength = typePatterns.length;
@@ -497,7 +497,7 @@ public class TypePatternList extends PatternNode {
        }
 
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeShort(typePatterns.length);
                for (int i = 0; i < typePatterns.length; i++) {
                        typePatterns[i].write(s);
index 7016b23fd9c7fdc740d75cdccadfe8fdfd2d93ef..c2d4bd0ec0356021c98cf54bd0b1ec4d5b75de3c 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
 
 /**
- * @author colyer
- * Represents a type variable as declared as part of a type declaration, parameter declaration,
- * or type parameter specification.
- * <p>For example:</p>
- * <ul>
- * <li>&lt;T&gt; T genericMethod(T t) {...}</li>
- * <li>static &lt;T extends Foo&gt; T staticGenericMethod(T t) {...}</li>
- * <li>Foo&lt;T extends Bar &amp; IGoo&gt;
- * </ul>
+ * @author colyer Represents a type variable as declared as part of a type declaration, parameter declaration, or type parameter
+ *         specification.
+ *         <p>
+ *         For example:
+ *         </p>
+ *         <ul>
+ *         <li>&lt;T&gt; T genericMethod(T t) {...}</li>
+ *         <li>static &lt;T extends Foo&gt; T staticGenericMethod(T t) {...}</li>
+ *         <li>Foo&lt;T extends Bar &amp; IGoo&gt;
+ *         </ul>
  */
 public class TypeVariablePattern extends PatternNode {
 
        private static final String anything = "?";
-       
-       private String name;  // eg. "T"
+
+       private String name; // eg. "T"
        private TypePattern upperBound; // default is object unless of the form T extends Bar
        private TypePattern[] interfaceBounds; // additional upper bounds (must be interfaces) arising from
-                                                           // declarations of the form T extends Bar & IGoo, IDoo
+       // declarations of the form T extends Bar & IGoo, IDoo
        private TypePattern lowerBound; // only set if type variable is of the form T super Bar
-       
+
        /**
-        * Create a named type variable with upper bound Object and no lower bounds.
-        * Use this constructor for the simple "T" case
+        * Create a named type variable with upper bound Object and no lower bounds. Use this constructor for the simple "T" case
         */
        public TypeVariablePattern(String variableName) {
                this.name = variableName;
-               this.upperBound = new ExactTypePattern(UnresolvedType.OBJECT,false,false);
+               this.upperBound = new ExactTypePattern(UnresolvedType.OBJECT, false, false);
                this.lowerBound = null;
                this.interfaceBounds = null;
        }
-       
+
        /**
-        * Create a named type variable with the given upper bound and no lower bounds
-        * Use this constructor for the T extends Foo case
+        * Create a named type variable with the given upper bound and no lower bounds Use this constructor for the T extends Foo case
+        * 
         * @param variableName
         * @param upperBound
         */
@@ -62,45 +62,49 @@ public class TypeVariablePattern extends PatternNode {
                this.lowerBound = null;
                this.interfaceBounds = null;
        }
-       
+
        public TypeVariablePattern(String variableName, TypePattern upperLimit, TypePattern[] interfaceBounds, TypePattern lowerBound) {
                this.name = variableName;
                this.upperBound = upperLimit;
-               if (upperBound == null) upperBound = new ExactTypePattern(UnresolvedType.OBJECT,false,false);
+               if (upperBound == null) {
+                       upperBound = new ExactTypePattern(UnresolvedType.OBJECT, false, false);
+               }
                this.interfaceBounds = interfaceBounds;
                this.lowerBound = lowerBound;
        }
 
        public Object accept(PatternNodeVisitor visitor, Object data) {
-               return visitor.visit(this,data);
+               return visitor.visit(this, data);
        }
-       
+
        public String getName() {
                return name;
        }
-       
+
        public boolean isAnythingPattern() {
                return name.equals(anything);
        }
-       
+
        public TypePattern getRawTypePattern() {
                return upperBound;
        }
-       
+
        public TypePattern getUpperBound() {
                return upperBound;
        }
-       
-       public boolean hasLowerBound() { return (lowerBound != null); }
-       
+
+       public boolean hasLowerBound() {
+               return (lowerBound != null);
+       }
+
        public TypePattern getLowerBound() {
                return lowerBound;
        }
-       
+
        public boolean hasAdditionalInterfaceBounds() {
                return (interfaceBounds != null);
        }
-       
+
        public TypePattern[] getAdditionalInterfaceBounds() {
                if (interfaceBounds != null) {
                        return interfaceBounds;
@@ -108,42 +112,64 @@ public class TypeVariablePattern extends PatternNode {
                        return new TypePattern[0];
                }
        }
-       
+
        public boolean equals(Object obj) {
-               if (!(obj instanceof TypeVariablePattern)) return false;
+               if (!(obj instanceof TypeVariablePattern)) {
+                       return false;
+               }
                TypeVariablePattern other = (TypeVariablePattern) obj;
-               if (!name.equals(other.name)) return false;
-               if (!upperBound.equals(other.upperBound)) return false;
+               if (!name.equals(other.name)) {
+                       return false;
+               }
+               if (!upperBound.equals(other.upperBound)) {
+                       return false;
+               }
                if (lowerBound != null) {
-                       if (other.lowerBound == null) return false;
-                       if (!lowerBound.equals(other.lowerBound)) return false;
+                       if (other.lowerBound == null) {
+                               return false;
+                       }
+                       if (!lowerBound.equals(other.lowerBound)) {
+                               return false;
+                       }
                } else {
-                       if (other.lowerBound != null) return false;
+                       if (other.lowerBound != null) {
+                               return false;
+                       }
                }
                if (interfaceBounds != null) {
-                       if (other.interfaceBounds == null) return false;
-                       if (interfaceBounds.length != other.interfaceBounds.length) return false;
+                       if (other.interfaceBounds == null) {
+                               return false;
+                       }
+                       if (interfaceBounds.length != other.interfaceBounds.length) {
+                               return false;
+                       }
                        for (int i = 0; i < interfaceBounds.length; i++) {
-                               if (!interfaceBounds[i].equals(other.interfaceBounds[i])) return false;
+                               if (!interfaceBounds[i].equals(other.interfaceBounds[i])) {
+                                       return false;
+                               }
                        }
                } else {
-                       if (other.interfaceBounds != null) return false;
+                       if (other.interfaceBounds != null) {
+                               return false;
+                       }
                }
                return true;
        }
-       
+
        public int hashCode() {
                int hashCode = 17 + (37 * name.hashCode());
                hashCode = hashCode * 37 + upperBound.hashCode();
-               if (lowerBound != null) hashCode = hashCode * 37 + lowerBound.hashCode();
+               if (lowerBound != null) {
+                       hashCode = hashCode * 37 + lowerBound.hashCode();
+               }
                if (interfaceBounds != null) {
                        for (int i = 0; i < interfaceBounds.length; i++) {
-                               hashCode = 37*hashCode + interfaceBounds[i].hashCode();
+                               hashCode = 37 * hashCode + interfaceBounds[i].hashCode();
                        }
                }
                return hashCode;
        }
-       
+
        public String toString() {
                StringBuffer sb = new StringBuffer();
                sb.append(name);
@@ -152,7 +178,9 @@ public class TypeVariablePattern extends PatternNode {
                        sb.append(" & ");
                        for (int i = 0; i < interfaceBounds.length; i++) {
                                sb.append(interfaceBounds[i].toString());
-                               if (i < interfaceBounds.length) sb.append(",");
+                               if (i < interfaceBounds.length) {
+                                       sb.append(",");
+                               }
                        }
                }
                if (lowerBound != null) {
@@ -161,16 +189,18 @@ public class TypeVariablePattern extends PatternNode {
                }
                return sb.toString();
        }
-       
+
        private String getExtendsClause() {
                if (upperBound instanceof ExactTypePattern) {
                        ExactTypePattern bound = (ExactTypePattern) upperBound;
-                       if (bound.type == UnresolvedType.OBJECT) return "";
+                       if (bound.type == UnresolvedType.OBJECT) {
+                               return "";
+                       }
                }
                return " extends " + upperBound.toString();
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeUTF(name);
                upperBound.write(s);
                if (interfaceBounds == null) {
@@ -182,10 +212,12 @@ public class TypeVariablePattern extends PatternNode {
                        }
                }
                s.writeBoolean(hasLowerBound());
-               if (hasLowerBound()) lowerBound.write(s);
-               writeLocation(s);               
+               if (hasLowerBound()) {
+                       lowerBound.write(s);
+               }
+               writeLocation(s);
        }
-       
+
        public static TypeVariablePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                TypeVariablePattern tv = null;
                String name = s.readUTF();
@@ -200,10 +232,12 @@ public class TypeVariablePattern extends PatternNode {
                }
                boolean hasLowerBound = s.readBoolean();
                TypePattern lowerBound = null;
-               if (hasLowerBound) lowerBound = TypePattern.read(s,context);
-               tv = new TypeVariablePattern(name,upperBound,additionalInterfaceBounds,lowerBound);
+               if (hasLowerBound) {
+                       lowerBound = TypePattern.read(s, context);
+               }
+               tv = new TypeVariablePattern(name, upperBound, additionalInterfaceBounds, lowerBound);
                tv.readLocation(context, s);
                return tv;
        }
-       
+
 }
index 8ede2a0732e51f97c573a13ac19e5214717235a0..7bbe67872fca64a6d9360f2d438d29ccb18bbf22 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.VersionedDataInputStream;
 
 /**
- * @author colyer
- * A list of type variable specifications, eg. &lt;T,S&gt; 
+ * @author colyer A list of type variable specifications, eg. &lt;T,S&gt;
  */
 public class TypeVariablePatternList extends PatternNode {
 
        public static final TypeVariablePatternList EMPTY = new TypeVariablePatternList(new TypeVariablePattern[0]);
-       
+
        private TypeVariablePattern[] patterns;
-       
+
        public TypeVariablePatternList(TypeVariablePattern[] typeVars) {
                this.patterns = typeVars;
        }
-       
+
        public TypeVariablePattern[] getTypeVariablePatterns() {
                return this.patterns;
        }
-       
+
        public TypeVariablePattern lookupTypeVariable(String name) {
                for (int i = 0; i < patterns.length; i++) {
                        if (patterns[i].getName().equals(name)) {
@@ -43,12 +42,12 @@ public class TypeVariablePatternList extends PatternNode {
                }
                return null;
        }
-       
+
        public boolean isEmpty() {
                return ((patterns == null) || (patterns.length == 0));
        }
-       
-       public void write(DataOutputStream s) throws IOException {
+
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeInt(patterns.length);
                for (int i = 0; i < patterns.length; i++) {
                        patterns[i].write(s);
@@ -62,24 +61,24 @@ public class TypeVariablePatternList extends PatternNode {
                if (length > 0) {
                        TypeVariablePattern[] patterns = new TypeVariablePattern[length];
                        for (int i = 0; i < patterns.length; i++) {
-                               patterns[i] = TypeVariablePattern.read(s,context);
+                               patterns[i] = TypeVariablePattern.read(s, context);
                        }
                        ret = new TypeVariablePatternList(patterns);
                }
-               ret.readLocation(context, s);  // redundant but safe to read location for EMPTY
+               ret.readLocation(context, s); // redundant but safe to read location for EMPTY
                return ret;
        }
 
        public Object accept(PatternNodeVisitor visitor, Object data) {
-               return visitor.visit(this,data);
+               return visitor.visit(this, data);
        }
-       
+
        public Object traverse(PatternNodeVisitor visitor, Object data) {
-               Object ret = accept(visitor,data);
+               Object ret = accept(visitor, data);
                for (int i = 0; i < patterns.length; i++) {
-                       patterns[i].traverse(visitor,ret);
+                       patterns[i].traverse(visitor, ret);
                }
                return ret;
        }
-       
+
 }
index 5fc6e36b2e54593dc2571f7ff3ccd114a8c7857c..f988ed500513479861f6b199f4430e5e41c40f21 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -21,6 +20,7 @@ import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedType;
@@ -302,7 +302,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern {
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(AnnotationTypePattern.WILD);
                s.writeByte(VERSION);
                typePattern.write(s);
index 42845b55d9eee2eec9af3b80788929406ea6b77b..7cdfd0c23ee80c397c70d65c7bd187ffa51a7e56 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -28,6 +27,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.BoundedReferenceType;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.IHasPosition;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ReferenceType;
@@ -1295,11 +1295,8 @@ public class WildTypePattern extends TypePattern {
 
        private static final byte VERSION = 1; // rev on change
 
-       /**
-        * @see org.aspectj.weaver.patterns.PatternNode#write(DataOutputStream)
-        */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(TypePattern.WILD);
                s.writeByte(VERSION);
                s.writeShort(namePatterns.length);
index 1003a475b1eb084147535dd9e1e95f14b00a463c..87966f0172bd0cb8cfb4b54106d8c6a41a439cac 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -20,6 +19,7 @@ import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -193,7 +193,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut {
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
        @Override
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.ATWITHIN);
                annotationTypePattern.write(s);
                writeLocation(s);
index ed3e5f1451dd3625eb84130c4e3c7c6df59dd4dc..0b574c4d4f6f0e8166360c47882aacd217f30235 100644 (file)
@@ -9,7 +9,6 @@
  * ******************************************************************/
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -19,6 +18,7 @@ import java.util.Map;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.Member;
@@ -37,28 +37,29 @@ import org.aspectj.weaver.ast.Var;
 
 /**
  * @author colyer
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * 
+ *         TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
+ *         Templates
  */
 public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
 
        private ExactAnnotationTypePattern annotationTypePattern;
-    private String declarationText;
-    
-    private static final int matchedShadowKinds;
-    static {
-       int flags = Shadow.ALL_SHADOW_KINDS_BITS;
-       for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) {
-                       if (Shadow.SHADOW_KINDS[i].isEnclosingKind()) 
+       private String declarationText;
+
+       private static final int matchedShadowKinds;
+       static {
+               int flags = Shadow.ALL_SHADOW_KINDS_BITS;
+               for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) {
+                       if (Shadow.SHADOW_KINDS[i].isEnclosingKind()) {
                                flags -= Shadow.SHADOW_KINDS[i].bit;
+                       }
                }
-       matchedShadowKinds=flags;
-    }
-       
+               matchedShadowKinds = flags;
+       }
+
        public WithinCodeAnnotationPointcut(ExactAnnotationTypePattern type) {
                super();
-               this.annotationTypePattern =  type;
+               this.annotationTypePattern = type;
                this.pointcutKind = Pointcut.ATWITHINCODE;
                buildDeclarationText();
        }
@@ -68,37 +69,42 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
                this.pointcutKind = Pointcut.ATWITHINCODE;
        }
 
-    public ExactAnnotationTypePattern getAnnotationTypePattern() {
-        return annotationTypePattern;
-    }
+       public ExactAnnotationTypePattern getAnnotationTypePattern() {
+               return annotationTypePattern;
+       }
 
        public int couldMatchKinds() {
                return matchedShadowKinds;
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-               WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)this.annotationTypePattern.parameterizeWith(typeVariableMap,w));
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern) this.annotationTypePattern
+                               .parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#fastMatch(org.aspectj.weaver.patterns.FastMatchInfo)
         */
        public FuzzyBoolean fastMatch(FastMatchInfo info) {
                return FuzzyBoolean.MAYBE;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#match(org.aspectj.weaver.Shadow)
         */
        protected FuzzyBoolean matchInternal(Shadow shadow) {
-               Member member = shadow.getEnclosingCodeSignature();             
+               Member member = shadow.getEnclosingCodeSignature();
                ResolvedMember rMember = member.resolve(shadow.getIWorld());
 
                if (rMember == null) {
-                   if (member.getName().startsWith(NameMangler.PREFIX)) {
-                       return FuzzyBoolean.NO;
+                       if (member.getName().startsWith(NameMangler.PREFIX)) {
+                               return FuzzyBoolean.NO;
                        }
                        shadow.getIWorld().getLint().unresolvableMember.signal(member.toString(), getSourceLocation());
                        return FuzzyBoolean.NO;
@@ -107,10 +113,12 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
                annotationTypePattern.resolve(shadow.getIWorld());
                return annotationTypePattern.matches(rMember);
        }
-       
 
-       /* (non-Javadoc)
-        * @see org.aspectj.weaver.patterns.Pointcut#resolveBindings(org.aspectj.weaver.patterns.IScope, org.aspectj.weaver.patterns.Bindings)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.aspectj.weaver.patterns.Pointcut#resolveBindings(org.aspectj.weaver.patterns.IScope,
+        * org.aspectj.weaver.patterns.Bindings)
         */
        protected void resolveBindings(IScope scope, Bindings bindings) {
                if (!scope.getWorld().isInJava5Mode()) {
@@ -118,45 +126,53 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
                                        getSourceLocation()));
                        return;
                }
-               annotationTypePattern = (ExactAnnotationTypePattern) annotationTypePattern.resolveBindings(scope,bindings,true);
+               annotationTypePattern = (ExactAnnotationTypePattern) annotationTypePattern.resolveBindings(scope, bindings, true);
                // must be either a Var, or an annotation type pattern
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#concretize1(org.aspectj.weaver.ResolvedType, org.aspectj.weaver.IntMap)
         */
        protected Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
-               ExactAnnotationTypePattern newType = (ExactAnnotationTypePattern) annotationTypePattern.remapAdviceFormals(bindings);           
+               ExactAnnotationTypePattern newType = (ExactAnnotationTypePattern) annotationTypePattern.remapAdviceFormals(bindings);
                Pointcut ret = new WithinCodeAnnotationPointcut(newType, bindings.getEnclosingAdvice());
-        ret.copyLocationFrom(this);
-        return ret;
+               ret.copyLocationFrom(this);
+               return ret;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.Pointcut#findResidue(org.aspectj.weaver.Shadow, org.aspectj.weaver.patterns.ExposedState)
         */
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
-               
+
                if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
-                       BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)annotationTypePattern;
+                       BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern) annotationTypePattern;
                        UnresolvedType annotationType = btp.annotationType;
                        Var var = shadow.getWithinCodeAnnotationVar(annotationType);
-       
-                       // This should not happen, we shouldn't have gotten this far 
+
+                       // This should not happen, we shouldn't have gotten this far
                        // if we weren't going to find the annotation
-                       if (var == null) 
-                               throw new BCException("Impossible! annotation=["+annotationType+
-                        "]  shadow=["+shadow+" at "+shadow.getSourceLocation()+
-                                                  "]    pointcut is at ["+getSourceLocation()+"]");
-                               
-                       state.set(btp.getFormalIndex(),var);
-               } 
-               if (matchInternal(shadow).alwaysTrue()) return Literal.TRUE;
-               else                                                              return Literal.FALSE;
-       }
-
-       
-       /* (non-Javadoc)
+                       if (var == null) {
+                               throw new BCException("Impossible! annotation=[" + annotationType + "]  shadow=[" + shadow + " at "
+                                               + shadow.getSourceLocation() + "]    pointcut is at [" + getSourceLocation() + "]");
+                       }
+
+                       state.set(btp.getFormalIndex(), var);
+               }
+               if (matchInternal(shadow).alwaysTrue()) {
+                       return Literal.TRUE;
+               } else {
+                       return Literal.FALSE;
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns()
         */
        public List getBindingAnnotationTypePatterns() {
@@ -164,20 +180,26 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
                        List l = new ArrayList();
                        l.add(annotationTypePattern);
                        return l;
-               } else return Collections.EMPTY_LIST;
+               } else {
+                       return Collections.EMPTY_LIST;
+               }
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns()
         */
        public List getBindingTypePatterns() {
                return Collections.EMPTY_LIST;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream)
         */
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.ATWITHINCODE);
                annotationTypePattern.write(s);
                writeLocation(s);
@@ -185,35 +207,39 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
 
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                AnnotationTypePattern type = AnnotationTypePattern.read(s, context);
-               WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern)type);
+               WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern) type);
                ret.readLocation(context, s);
                return ret;
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof WithinCodeAnnotationPointcut)) return false;
-               WithinCodeAnnotationPointcut o = (WithinCodeAnnotationPointcut)other;
+               if (!(other instanceof WithinCodeAnnotationPointcut)) {
+                       return false;
+               }
+               WithinCodeAnnotationPointcut o = (WithinCodeAnnotationPointcut) other;
                return o.annotationTypePattern.equals(this.annotationTypePattern);
        }
-    
-    public int hashCode() {
-        int result = 17;
-        result = 23*result + annotationTypePattern.hashCode();
-        return result;
-    }
-       
+
+       public int hashCode() {
+               int result = 17;
+               result = 23 * result + annotationTypePattern.hashCode();
+               return result;
+       }
+
        private void buildDeclarationText() {
-           StringBuffer buf = new StringBuffer();
+               StringBuffer buf = new StringBuffer();
                buf.append("@withincode(");
                String annPatt = annotationTypePattern.toString();
                buf.append(annPatt.startsWith("@") ? annPatt.substring(1) : annPatt);
                buf.append(")");
                this.declarationText = buf.toString();
        }
-       
-       public String toString() { return this.declarationText; }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
+       public String toString() {
+               return this.declarationText;
+       }
+
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 }
index f7b2c00e751d5e7de6a63b3853c1fc19a2c5aa89..cc0f40add8be56f857aea51aaefde80d5c526c89 100644 (file)
 
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -79,7 +79,7 @@ public class WithinPointcut extends Pointcut {
                return isWithinType(enclosingType);
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.WITHIN);
                typePattern.write(s);
                writeLocation(s);
index 91beeb87c78034098afd8367ece2eb44bff7a736..bb4a1e72c7a4cb97195143b2a7f2c9abcab45557 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Map;
 
 import org.aspectj.bridge.MessageUtil;
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.ResolvedType;
@@ -31,55 +30,55 @@ import org.aspectj.weaver.ast.Test;
 
 public class WithincodePointcut extends Pointcut {
        private SignaturePattern signature;
-    private static final int matchedShadowKinds;
-    static {
-       int flags = Shadow.ALL_SHADOW_KINDS_BITS;
-       for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) {
-                       if (Shadow.SHADOW_KINDS[i].isEnclosingKind()) 
+       private static final int matchedShadowKinds;
+       static {
+               int flags = Shadow.ALL_SHADOW_KINDS_BITS;
+               for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) {
+                       if (Shadow.SHADOW_KINDS[i].isEnclosingKind()) {
                                flags -= Shadow.SHADOW_KINDS[i].bit;
+                       }
                }
-       // these next two are needed for inlining of field initializers
-       flags|=Shadow.ConstructorExecution.bit;
-       flags|=Shadow.Initialization.bit;
-       matchedShadowKinds = flags;
-    }
-       
+               // these next two are needed for inlining of field initializers
+               flags |= Shadow.ConstructorExecution.bit;
+               flags |= Shadow.Initialization.bit;
+               matchedShadowKinds = flags;
+       }
+
        public WithincodePointcut(SignaturePattern signature) {
                this.signature = signature;
                this.pointcutKind = WITHINCODE;
        }
 
-    public SignaturePattern getSignature() {
-        return signature;
-    }
+       public SignaturePattern getSignature() {
+               return signature;
+       }
 
        public int couldMatchKinds() {
                return matchedShadowKinds;
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
-               WithincodePointcut ret = new WithincodePointcut(signature.parameterizeWith(typeVariableMap,w));
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+               WithincodePointcut ret = new WithincodePointcut(signature.parameterizeWith(typeVariableMap, w));
                ret.copyLocationFrom(this);
                return ret;
        }
-       
+
        public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return FuzzyBoolean.MAYBE;
        }
-        
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
-               //This will not match code in local or anonymous classes as if
-               //they were withincode of the outer signature
-               return FuzzyBoolean.fromBoolean(
-                       signature.matches(shadow.getEnclosingCodeSignature(), shadow.getIWorld(), false));
+               // This will not match code in local or anonymous classes as if
+               // they were withincode of the outer signature
+               return FuzzyBoolean.fromBoolean(signature.matches(shadow.getEnclosingCodeSignature(), shadow.getIWorld(), false));
        }
 
-       public void write(DataOutputStream s) throws IOException {
+       public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Pointcut.WITHINCODE);
                signature.write(s);
                writeLocation(s);
        }
-       
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                WithincodePointcut ret = new WithincodePointcut(SignaturePattern.read(s, context));
                ret.readLocation(context, s);
@@ -88,38 +87,39 @@ public class WithincodePointcut extends Pointcut {
 
        public void resolveBindings(IScope scope, Bindings bindings) {
                signature = signature.resolveBindings(scope, bindings);
-               
+
                // look for inappropriate use of parameterized types and tell user...
-               HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor 
-                       visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor();
+               HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor();
                signature.getDeclaringType().traverse(visitor, null);
-               if (visitor.wellHasItThen/*?*/()) {
-                       scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.WITHINCODE_DOESNT_SUPPORT_PARAMETERIZED_DECLARING_TYPES),
-                                       getSourceLocation()));
-               }                                               
-               
+               if (visitor.wellHasItThen/* ? */()) {
+                       scope.message(MessageUtil.error(WeaverMessages
+                                       .format(WeaverMessages.WITHINCODE_DOESNT_SUPPORT_PARAMETERIZED_DECLARING_TYPES), getSourceLocation()));
+               }
+
                visitor = new HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor();
                signature.getThrowsPattern().traverse(visitor, null);
-               if (visitor.wellHasItThen/*?*/()) {
-                       scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.NO_GENERIC_THROWABLES),
-                                       getSourceLocation()));
-               }                                       
+               if (visitor.wellHasItThen/* ? */()) {
+                       scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.NO_GENERIC_THROWABLES), getSourceLocation()));
+               }
        }
-       
+
        public void postRead(ResolvedType enclosingType) {
                signature.postRead(enclosingType);
        }
 
        public boolean equals(Object other) {
-               if (!(other instanceof WithincodePointcut)) return false;
-               WithincodePointcut o = (WithincodePointcut)other;
+               if (!(other instanceof WithincodePointcut)) {
+                       return false;
+               }
+               WithincodePointcut o = (WithincodePointcut) other;
                return o.signature.equals(this.signature);
        }
-    public int hashCode() {
-        int result = 43;
-        result = 37*result + signature.hashCode();
-        return result;
-    }
+
+       public int hashCode() {
+               int result = 43;
+               result = 37 * result + signature.hashCode();
+               return result;
+       }
 
        public String toString() {
                return "withincode(" + signature + ")";
@@ -128,15 +128,14 @@ public class WithincodePointcut extends Pointcut {
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                return match(shadow).alwaysTrue() ? Literal.TRUE : Literal.FALSE;
        }
-       
-       
+
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                Pointcut ret = new WithincodePointcut(signature);
                ret.copyLocationFrom(this);
                return ret;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 }
index 70e192afeb8d0b4810a573d8121a7a670bc948e1..44d8d2b04efbae0c7d3d535a812fda8d368cdb1b 100644 (file)
@@ -14,16 +14,11 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.patterns.AndPointcut;
-import org.aspectj.weaver.patterns.NotPointcut;
-import org.aspectj.weaver.patterns.OrPointcut;
-import org.aspectj.weaver.patterns.PatternParser;
-import org.aspectj.weaver.patterns.Pointcut;
 import org.aspectj.weaver.reflect.ReflectionWorld;
 
 /**
@@ -86,7 +81,7 @@ public class AndOrNotTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                Pointcut p = makePointcut(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
 
index bece962518df5730514f10a9f1aa07eeb84c4248..444db0c752286d1430e24770794322be5e59c237 100644 (file)
@@ -14,11 +14,11 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 import junit.framework.TestCase;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.VersionedDataInputStream;
 
 public class DeclareErrorOrWarningTestCase extends TestCase {
@@ -50,7 +50,7 @@ public class DeclareErrorOrWarningTestCase extends TestCase {
 
        private void checkSerialization(Declare declare) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                declare.write(out);
                out.close();
 
index b680376d7b355c2cf58eabd602173dabe9353b22..a826263366fe3e39b4afbe01f42f25ef039d033e 100644 (file)
@@ -14,14 +14,12 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Modifier;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.patterns.ModifiersPattern;
-import org.aspectj.weaver.patterns.PatternParser;
 import org.aspectj.weaver.reflect.ReflectionWorld;
 
 public class ModifiersPatternTestCase extends PatternsTestCase {
@@ -93,7 +91,7 @@ public class ModifiersPatternTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                ModifiersPattern p = makeModifiersPattern(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
 
index 91858de8829daa0b3acba407171e2f4d2134bdc6..41685973ca97074aeab7081bbe92aa24d6dc6825 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
-import org.aspectj.weaver.VersionedDataInputStream;
-import org.aspectj.weaver.patterns.NamePattern;
-
 import junit.framework.TestCase;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
+import org.aspectj.weaver.VersionedDataInputStream;
+
 /**
  * @author hugunin
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
+ * 
+ *         To change this generated comment edit the template variable "typecomment": Window>Preferences>Java>Templates. To enable
+ *         and disable the creation of type comments go to Window>Preferences>Java>Code Generation.
  */
 public class NamePatternTestCase extends TestCase {
-       static String[] matchAll = new String[] {
-               "*****",
-               "*"
-       };
-
-       
-       static String[] match1 = new String[] {
-               "abcde", "abc*", "abcd*", "abcde*",
-               "*e", "*cde", "*abcde",
-               "a*e", "ab*e", "abc*de",
-               "*a*b*c*d*e*", "a*c*e", "a***bcde",
-               "*d*",
-               };
-       
-       static String[] match2 = new String[] {
-               "abababab",
-               "aba*", "abab*", "abababab*",
-               "*b", "*ab", "*ababab", "*abababab",
-               "a*b", "ab*b", "abab*abab",
-               "*a*b*a*b*a*b*a*b*", "a*****b", "a**b", "ab*b*b",
-               };
-               
+       static String[] matchAll = new String[] { "*****", "*" };
+
+       static String[] match1 = new String[] { "abcde", "abc*", "abcd*", "abcde*", "*e", "*cde", "*abcde", "a*e", "ab*e", "abc*de",
+                       "*a*b*c*d*e*", "a*c*e", "a***bcde", "*d*", };
+
+       static String[] match2 = new String[] { "abababab", "aba*", "abab*", "abababab*", "*b", "*ab", "*ababab", "*abababab", "a*b",
+                       "ab*b", "abab*abab", "*a*b*a*b*a*b*a*b*", "a*****b", "a**b", "ab*b*b", };
+
        /**
         * Constructor for PatternTestCase.
+        * 
         * @param name
         */
        public NamePatternTestCase(String name) {
                super(name);
        }
-       
+
        public void testMatch() {
                checkMatch("abcde", matchAll, true);
                checkMatch("abcde", match1, true);
                checkMatch("abcde", match2, false);
-               
+
                checkMatch("abababab", matchAll, true);
                checkMatch("abababab", match1, false);
                checkMatch("abababab", match2, true);
-               
+
        }
 
        /**
         * Method checkMatch.
+        * 
         * @param string
         * @param matchAll
         * @param b
         */
        private void checkMatch(String string, String[] patterns, boolean shouldMatch) {
-               for (int i=0, len=patterns.length; i < len; i++) {
+               for (int i = 0, len = patterns.length; i < len; i++) {
                        NamePattern p = new NamePattern(patterns[i]);
                        checkMatch(string, p, shouldMatch);
                }
@@ -90,33 +74,31 @@ public class NamePatternTestCase extends TestCase {
                String msg = "matching " + string + " to " + p;
                assertEquals(msg, shouldMatch, p.matches(string));
        }
-       
-       
+
        public void testSerialization() throws IOException {
                checkSerialization(matchAll);
                checkSerialization(match1);
                checkSerialization(match2);
        }
-       
+
        private void checkSerialization(String[] patterns) throws IOException {
-               for (int i=0, len=patterns.length; i < len; i++) {
+               for (int i = 0, len = patterns.length; i < len; i++) {
                        NamePattern p = new NamePattern(patterns[i]);
                        checkSerialization(p);
                }
        }
-       
-       
+
        private void checkSerialization(NamePattern p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
-               
+
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
                VersionedDataInputStream in = new VersionedDataInputStream(bi);
                NamePattern newP = NamePattern.read(in);
-               
-               assertEquals("write/read", p, newP);    
+
+               assertEquals("write/read", p, newP);
        }
 
 }
index 02058d8989ea573f09a5a57285c8af8e201b998c..67cf5be98a2928dc1d9ec0571c6b026c3b638203 100644 (file)
@@ -14,9 +14,9 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.TestUtils;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -152,7 +152,7 @@ public class SignaturePatternMatchSpeedTestCase extends PatternsTestCase {
 
        private void checkSerialization(SignaturePattern p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
 
index 110137cf9bb632ffbccc1462c774e76b858adf2d..629e26719fe091c7a4a723c12d66ec19be67ee43 100644 (file)
@@ -15,9 +15,9 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.TestUtils;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -61,53 +61,34 @@ public class SignaturePatternTestCase extends PatternsTestCase {
                checkMatch(makeMethodPat("* *(..) throws *..IOException, !*..Clone*"), NONE, BOTH);
                checkMatch(makeMethodPat("* *(..) throws !*..IOException"), NO_EXCEPTIONS, M);
        }
-/*
-       public void testInstanceMethodMatchSpeed() throws IOException {
-               // Member objectToString = TestUtils.methodFromString("java.lang.String java.lang.Object.toString()");
-               Member objectToString = TestUtils.methodFromString(
-                               "java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String)").resolve(world);
-               SignaturePattern signaturePattern = makeMethodPat("* *(..))");
-               signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new FormalBinding[0]), new Bindings(0));
-               for (int i = 0; i < 1000; i++) {
-                       boolean matches = signaturePattern.matches(objectToString, world, false);
-               }
-               long stime = System.currentTimeMillis();
-               for (int i = 0; i < 2000000; i++) {
-                       boolean matches = signaturePattern.matches(objectToString, world, false);
-               }
-               long etime = System.currentTimeMillis();
-               System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081
 
-               signaturePattern = makeMethodPat("* *())");
-               signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new FormalBinding[0]), new Bindings(0));
-               for (int i = 0; i < 1000; i++) {
-                       boolean matches = signaturePattern.matches(objectToString, world, false);
-               }
-               stime = System.currentTimeMillis();
-               for (int i = 0; i < 2000000; i++) {
-                       boolean matches = signaturePattern.matches(objectToString, world, false);
-               }
-               etime = System.currentTimeMillis();
-               System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081
-       }
-
-       public void testInstanceMethodMatchSpeed2() throws IOException {
-               // Member objectToString = TestUtils.methodFromString("java.lang.String java.lang.Object.toString()");
-               Member objectToString = TestUtils.methodFromString(
-                               "java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String)").resolve(world);
-               SignaturePattern signaturePattern = makeMethodPat("!void *(..))");
-               signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new FormalBinding[0]), new Bindings(0));
-               for (int i = 0; i < 1000; i++) {
-                       boolean matches = signaturePattern.matches(objectToString, world, false);
-               }
-               long stime = System.currentTimeMillis();
-               for (int i = 0; i < 2000000; i++) {
-                       boolean matches = signaturePattern.matches(objectToString, world, false);
-               }
-               long etime = System.currentTimeMillis();
-               System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081
-       }
-*/
+       /*
+        * public void testInstanceMethodMatchSpeed() throws IOException { // Member objectToString =
+        * TestUtils.methodFromString("java.lang.String java.lang.Object.toString()"); Member objectToString =
+        * TestUtils.methodFromString(
+        * "java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String)").resolve(world); SignaturePattern
+        * signaturePattern = makeMethodPat("* *(..))"); signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new
+        * FormalBinding[0]), new Bindings(0)); for (int i = 0; i < 1000; i++) { boolean matches =
+        * signaturePattern.matches(objectToString, world, false); } long stime = System.currentTimeMillis(); for (int i = 0; i <
+        * 2000000; i++) { boolean matches = signaturePattern.matches(objectToString, world, false); } long etime =
+        * System.currentTimeMillis(); System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081
+        * 
+        * signaturePattern = makeMethodPat("* *())"); signaturePattern = signaturePattern.resolveBindings(new TestScope(world, new
+        * FormalBinding[0]), new Bindings(0)); for (int i = 0; i < 1000; i++) { boolean matches =
+        * signaturePattern.matches(objectToString, world, false); } stime = System.currentTimeMillis(); for (int i = 0; i < 2000000;
+        * i++) { boolean matches = signaturePattern.matches(objectToString, world, false); } etime = System.currentTimeMillis();
+        * System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081 }
+        * 
+        * public void testInstanceMethodMatchSpeed2() throws IOException { // Member objectToString =
+        * TestUtils.methodFromString("java.lang.String java.lang.Object.toString()"); Member objectToString =
+        * TestUtils.methodFromString(
+        * "java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String)").resolve(world); SignaturePattern
+        * signaturePattern = makeMethodPat("!void *(..))"); signaturePattern = signaturePattern.resolveBindings(new TestScope(world,
+        * new FormalBinding[0]), new Bindings(0)); for (int i = 0; i < 1000; i++) { boolean matches =
+        * signaturePattern.matches(objectToString, world, false); } long stime = System.currentTimeMillis(); for (int i = 0; i <
+        * 2000000; i++) { boolean matches = signaturePattern.matches(objectToString, world, false); } long etime =
+        * System.currentTimeMillis(); System.out.println("Took " + (etime - stime) + "ms for 2,000,000");// 4081 }
+        */
        public void testInstanceMethodMatch() throws IOException {
                Member objectToString = TestUtils.methodFromString("java.lang.String java.lang.Object.toString()");
                Member integerToString = TestUtils.methodFromString("java.lang.String java.lang.Integer.toString()");
@@ -190,7 +171,7 @@ public class SignaturePatternTestCase extends PatternsTestCase {
 
        private void checkSerialization(SignaturePattern p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
 
index fd3e8f23e94f46b4118397a0e0638ec047fbafe0..15460d4cf76907522b3cedaac01761de02d0749b 100644 (file)
@@ -14,19 +14,14 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Arrays;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.patterns.Bindings;
-import org.aspectj.weaver.patterns.PatternParser;
-import org.aspectj.weaver.patterns.TestScope;
-import org.aspectj.weaver.patterns.TypePattern;
-import org.aspectj.weaver.patterns.TypePatternList;
 import org.aspectj.weaver.reflect.ReflectionWorld;
 
 /**
@@ -161,7 +156,7 @@ public class TypePatternListTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                TypePatternList p = makeArgumentsPattern(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
 
index e4f5a4dbf2b4ef82dfb6b1c04a02d5f3e8027bc8..416ccc11c93cf304d4b0b53024cd9b5a2affdc16 100644 (file)
@@ -14,10 +14,10 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
@@ -248,7 +248,7 @@ public class TypePatternTestCase extends PatternsTestCase {
        private void checkSerialization(String string) throws IOException {
                TypePattern p = makeTypePattern(string);
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
 
index ccc117b02ba3bdfb2c0bad9d18a8aa1d75fd0fd2..2665b6e968bdc1acafd51de837ffcb2857a4605e 100644 (file)
@@ -14,10 +14,10 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.aspectj.util.FuzzyBoolean;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.TestShadow;
@@ -25,11 +25,6 @@ import org.aspectj.weaver.TestUtils;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.patterns.Bindings;
-import org.aspectj.weaver.patterns.FormalBinding;
-import org.aspectj.weaver.patterns.IScope;
-import org.aspectj.weaver.patterns.Pointcut;
-import org.aspectj.weaver.patterns.SimpleScope;
 import org.aspectj.weaver.reflect.ReflectionWorld;
 
 public class WithinTestCase extends PatternsTestCase {
@@ -112,7 +107,7 @@ public class WithinTestCase extends PatternsTestCase {
 
        private void checkSerialization(Pointcut p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();