]> source.dussan.org Git - aspectj.git/commitdiff
passing the correct compressors around (for small class file sizes enhancement)
authoraclement <aclement>
Tue, 18 May 2010 19:46:38 +0000 (19:46 +0000)
committeraclement <aclement>
Tue, 18 May 2010 19:46:38 +0000 (19:46 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelField.java
weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
weaver/src/org/aspectj/weaver/bcel/Utility.java

index be53852f9ca9f9e7fdf70c91b1c330798d554415..08df1f193f4b04062ef59fe31d71af04578d57f5 100644 (file)
@@ -76,7 +76,8 @@ final class BcelField extends ResolvedMemberImpl {
                if (attrs != null && attrs.length > 0) {
                        ISourceContext sourceContext = getSourceContext(world);
                        List<AjAttribute> as = Utility.readAjAttributes(getDeclaringType().getClassName(), attrs, sourceContext, world,
-                                       (bcelObjectType != null ? bcelObjectType.getWeaverVersionAttribute() : WeaverVersionInfo.CURRENT));
+                                       (bcelObjectType != null ? bcelObjectType.getWeaverVersionAttribute() : WeaverVersionInfo.CURRENT),
+                                       new BcelConstantPoolReader(field.getConstantPool()));
                        as.addAll(AtAjAttributes.readAj5FieldAttributes(field, this, world.resolve(getDeclaringType()), sourceContext, world
                                        .getMessageHandler()));
 
index 07400d54663721d272269bca0dacc622584e26bf..fd2d6a46530112ec94b21ae7ac53cf6028aec823 100644 (file)
@@ -182,7 +182,8 @@ class BcelMethod extends ResolvedMemberImpl {
                associatedShadowMunger = null;
                ResolvedType resolvedDeclaringType = getDeclaringType().resolve(world);
                List<AjAttribute> as = Utility.readAjAttributes(resolvedDeclaringType.getClassName(), method.getAttributes(),
-                               resolvedDeclaringType.getSourceContext(), world, bcelObjectType.getWeaverVersionAttribute());
+                               resolvedDeclaringType.getSourceContext(), world, bcelObjectType.getWeaverVersionAttribute(),
+                               new BcelConstantPoolReader(method.getConstantPool()));
                processAttributes(world, as);
                as = AtAjAttributes.readAj5MethodAttributes(method, this, resolvedDeclaringType, preResolvedPointcut, resolvedDeclaringType
                                .getSourceContext(), world.getMessageHandler());
index da6cd7ec1f521e2dd21dbd021cb5400a7dff3fa4..75f0f0c2d38d650cf45292059bb0a8331d4b1472 100644 (file)
@@ -376,7 +376,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                List<AjAttribute> l = null;
                try {
                        l = Utility.readAjAttributes(className, javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),
-                                       getResolvedTypeX().getWorld(), AjAttribute.WeaverVersionInfo.UNKNOWN);
+                                       getResolvedTypeX().getWorld(), AjAttribute.WeaverVersionInfo.UNKNOWN, new BcelConstantPoolReader(
+                                                       javaClass.getConstantPool()));
                } catch (RuntimeException re) {
                        throw new RuntimeException("Problem processing attributes in " + javaClass.getFileName(), re);
                }
index 3eab53d7bdf1a92e8f1a6a7d34966fd72e96d90a..e98aad131c8805bfb750019c651949cf60b8b971 100644 (file)
@@ -539,7 +539,8 @@ public final class LazyMethodGen implements Traceable {
                if (enclosingClass != null && enclosingClass.getType() != null) {
                        context = enclosingClass.getType().getSourceContext();
                }
-               List as = Utility.readAjAttributes(getClassName(), attributes.toArray(new Attribute[] {}), context, null, weaverVersion);
+               List as = Utility.readAjAttributes(getClassName(), attributes.toArray(new Attribute[] {}), context, null, weaverVersion,
+                               new BcelConstantPoolReader(this.enclosingClass.getConstantPool()));
                if (!as.isEmpty()) {
                        out.println("    " + as.get(0)); // XXX assuming exactly one
                        // attribute, munger...
index e09f5ae913eb6487c329afc58dd57770d0387c29..953638ea9518e4bf99626a284eb7d3478116a9fb 100644 (file)
@@ -53,6 +53,7 @@ import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.AnnotationAJ;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.ConstantPoolReader;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.Lint;
 import org.aspectj.weaver.Member;
@@ -65,7 +66,7 @@ import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 public class Utility {
 
        public static List<AjAttribute> readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w,
-                       AjAttribute.WeaverVersionInfo version) {
+                       AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) {
                List<AjAttribute> l = new ArrayList<AjAttribute>();
 
                // first pass, look for version
@@ -78,7 +79,8 @@ public class Utility {
                                if (name.charAt(0) == 'o') { // 'o'rg.aspectj
                                        if (name.startsWith(AjAttribute.AttributePrefix)) {
                                                if (name.endsWith(WeaverVersionInfo.AttributeName)) {
-                                                       version = (AjAttribute.WeaverVersionInfo) AjAttribute.read(version, name, u.getBytes(), context, w);
+                                                       version = (AjAttribute.WeaverVersionInfo) AjAttribute.read(version, name, u.getBytes(), context, w,
+                                                                       dataDecompressor);
                                                        if (version.getMajorVersion() > WeaverVersionInfo.getCurrentWeaverMajorVersion()) {
                                                                throw new BCException(
                                                                                "Unable to continue, this version of AspectJ supports classes built with weaver version "
@@ -96,7 +98,7 @@ public class Utility {
                for (int i = forSecondPass.size() - 1; i >= 0; i--) {
                        Unknown a = forSecondPass.get(i);
                        String name = a.getName();
-                       AjAttribute attr = AjAttribute.read(version, name, a.getBytes(), context, w);
+                       AjAttribute attr = AjAttribute.read(version, name, a.getBytes(), context, w, dataDecompressor);
                        if (attr != null) {
                                l.add(attr);
                        }
@@ -699,7 +701,7 @@ public class Utility {
 
        public static Attribute bcelAttribute(AjAttribute a, ConstantPool pool) {
                int nameIndex = pool.addUtf8(a.getNameString());
-               byte[] bytes = a.getBytes();
+               byte[] bytes = a.getBytes(new BcelConstantPoolWriter(pool));
                int length = bytes.length;
 
                return new Unknown(nameIndex, length, bytes, pool);