aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2010-07-08 20:49:37 +0000
committeraclement <aclement>2010-07-08 20:49:37 +0000
commit3bce86674f9afba44b389a44ad724b44d3fb5e47 (patch)
tree92b8b57d13a956d32aaa4ee9285c85af8096ad39
parent346c44fdbfe801bb481af0041bf3d00ba4a999e7 (diff)
downloadaspectj-3bce86674f9afba44b389a44ad724b44d3fb5e47.tar.gz
aspectj-3bce86674f9afba44b389a44ad724b44d3fb5e47.zip
319312: uncompress the weaverstateinfo (unless turned on via sysprop). Fix in deserialization of uncompressed 'aspects affecting this file' list
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/CompressingDataOutputStream.java3
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/WeaverStateInfo.java52
2 files changed, 40 insertions, 15 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CompressingDataOutputStream.java b/org.aspectj.matcher/src/org/aspectj/weaver/CompressingDataOutputStream.java
index 59b4fbcab..43a66ff4f 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/CompressingDataOutputStream.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/CompressingDataOutputStream.java
@@ -26,6 +26,7 @@ import java.io.IOException;
public class CompressingDataOutputStream extends DataOutputStream {
private ConstantPoolWriter constantPoolWriter;
+ public boolean compressionEnabled = true;
public CompressingDataOutputStream(ByteArrayOutputStream baos, ConstantPoolWriter constantPoolWriter) {
super(baos);
@@ -37,7 +38,7 @@ public class CompressingDataOutputStream extends DataOutputStream {
}
public boolean canCompress() {
- return constantPoolWriter != null;
+ return constantPoolWriter != null && compressionEnabled;
}
/**
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/WeaverStateInfo.java b/org.aspectj.matcher/src/org/aspectj/weaver/WeaverStateInfo.java
index 32f60bb2a..0ce6c5c46 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/WeaverStateInfo.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/WeaverStateInfo.java
@@ -63,6 +63,24 @@ public class WeaverStateInfo {
private static byte[] key = { -51, 34, 105, 56, -34, 65, 45, 78, -26, 125, 114, 97, 98, 1, -1, -42 };
private boolean unwovenClassFileIsADiff = false;
+ int compressionEnabled = 0; // 0=dont know, 1=no, 2=yes
+
+ private void checkCompressionEnabled() {
+ if (compressionEnabled == 0) {
+ // work it out!
+ compressionEnabled = 1;
+ try {
+ String value = System.getProperty("aspectj.compression.weaverstateinfo", "false");
+ if (value.equalsIgnoreCase("true")) {
+ System.out.println("ASPECTJ: aspectj.compression.weaverstateinfo=true: compressing weaverstateinfo");
+ compressionEnabled = 2;
+ }
+ } catch (Throwable t) {
+ // nop
+ }
+ }
+ }
+
private WeaverStateInfo() {
// this(new ArrayList(), false,reweavableDefault,reweavableCompressedModeDefault,reweavableDiffModeDefault);
}
@@ -173,6 +191,7 @@ public class WeaverStateInfo {
* read logic you'll see it expecting the kind as the first byte.
*/
public void write(CompressingDataOutputStream s) throws IOException {
+ checkCompressionEnabled();
if (oldStyle || reweavableCompressedMode) {
throw new RuntimeException("shouldn't be writing this");
}
@@ -190,19 +209,24 @@ public class WeaverStateInfo {
s.writeByte(weaverStateInfoKind);
// Tag whether the remainder of the data is subject to cp compression
- s.writeBoolean(s.canCompress());
-
- int n = typeMungers.size();
- s.writeShort(n);
- for (Entry e : typeMungers) {
- if (s.canCompress()) {
- s.writeCompressedSignature(e.aspectType.getSignature());
- } else {
- e.aspectType.write(s);
+ try {
+ s.compressionEnabled = compressionEnabled == 2;
+ s.writeBoolean(s.canCompress());
+
+ int n = typeMungers.size();
+ s.writeShort(n);
+ for (Entry e : typeMungers) {
+ if (s.canCompress()) {
+ s.writeCompressedSignature(e.aspectType.getSignature());
+ } else {
+ e.aspectType.write(s);
+ }
+ e.typeMunger.write(s);
}
- e.typeMunger.write(s);
+ writeAnyReweavableData(this, s, s.canCompress());
+ } finally {
+ s.compressionEnabled = true;
}
- writeAnyReweavableData(this, s, s.canCompress());
}
public void addConcreteMunger(ConcreteTypeMunger munger) {
@@ -276,9 +300,9 @@ public class WeaverStateInfo {
str = s.readSignature();
} else {
str = s.readUTF();
- StringBuilder sb = new StringBuilder();
- sb.append("L").append(str.replace('.', '/')).append(";");
- str = sb.toString();
+ // StringBuilder sb = new StringBuilder();
+ // sb.append("L").append(str.replace('.', '/')).append(";");
+ // str = sb.toString();
}
wsi.addAspectAffectingType(str);
}