From: aclement Date: Tue, 18 May 2010 19:46:38 +0000 (+0000) Subject: passing the correct compressors around (for small class file sizes enhancement) X-Git-Tag: PRE_PUSHIN~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8b51469050c426ab87cbca1e5f938d4faa8bae76;p=aspectj.git passing the correct compressors around (for small class file sizes enhancement) --- diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/org/aspectj/weaver/bcel/BcelField.java index be53852f9..08df1f193 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelField.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelField.java @@ -76,7 +76,8 @@ final class BcelField extends ResolvedMemberImpl { if (attrs != null && attrs.length > 0) { ISourceContext sourceContext = getSourceContext(world); List 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())); diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java index 07400d546..fd2d6a465 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java @@ -182,7 +182,8 @@ class BcelMethod extends ResolvedMemberImpl { associatedShadowMunger = null; ResolvedType resolvedDeclaringType = getDeclaringType().resolve(world); List 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()); diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index da6cd7ec1..75f0f0c2d 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -376,7 +376,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { List 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); } diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 3eab53d7b..e98aad131 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -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... diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java index e09f5ae91..953638ea9 100644 --- a/weaver/src/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java @@ -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 readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w, - AjAttribute.WeaverVersionInfo version) { + AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) { List l = new ArrayList(); // 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);