aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-08-10 11:08:56 +0000
committeracolyer <acolyer>2004-08-10 11:08:56 +0000
commit44a92e1a04f8f2f1a862f15f9d0b9ed761d05fd4 (patch)
treefbbd8c96791ea1ffe010580db25ad89d0eaff681 /weaver
parentc3d5f40edf027600d5ed5e7ec0cc391bf9b56859 (diff)
downloadaspectj-44a92e1a04f8f2f1a862f15f9d0b9ed761d05fd4.tar.gz
aspectj-44a92e1a04f8f2f1a862f15f9d0b9ed761d05fd4.zip
fix for Bugzilla Bug 59208
Weaver fails in BCEL for large classe
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/WeaverMessages.java1
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java18
-rw-r--r--weaver/src/org/aspectj/weaver/weaver-messages.properties1
3 files changed, 20 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/WeaverMessages.java b/weaver/src/org/aspectj/weaver/WeaverMessages.java
index d6062530c..bca503756 100644
--- a/weaver/src/org/aspectj/weaver/WeaverMessages.java
+++ b/weaver/src/org/aspectj/weaver/WeaverMessages.java
@@ -83,6 +83,7 @@ public class WeaverMessages {
public static final String AROUND_ON_INTERFACE_STATICINIT = "aroundOnInterfaceStaticInit";
public static final String PROBLEM_GENERATING_METHOD = "problemGeneratingMethod";
+ public static final String CLASS_TOO_BIG = "classTooBig";
public static final String ZIPFILE_ENTRY_MISSING = "zipfileEntryMissing";
public static final String ZIPFILE_ENTRY_INVALID = "zipfileEntryInvalid";
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
index 3185300fa..7f2faeb33 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
+++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
@@ -49,6 +49,7 @@ import org.apache.bcel.generic.RETURN;
import org.apache.bcel.generic.Type;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.SourceLocation;
import org.aspectj.util.CollectionUtil;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.BCException;
@@ -377,6 +378,23 @@ public final class LazyClassGen {
}
private void writeBack(BcelWorld world) {
+ if (getConstantPoolGen().getSize() > Short.MAX_VALUE) {
+ // PR 59208
+ // we've generated a class that is just toooooooooo big (you've been generating programs
+ // again haven't you? come on, admit it, no-one writes classes this big by hand).
+ // create an empty myGen so that we can give back a return value that doesn't upset the
+ // rest of the process.
+ myGen = new ClassGen(myGen.getClassName(), myGen.getSuperclassName(),
+ myGen.getFileName(), myGen.getAccessFlags(), myGen.getInterfaceNames());
+ // raise an error against this compilation unit.
+ getWorld().showMessage(
+ IMessage.ERROR,
+ WeaverMessages.format(WeaverMessages.CLASS_TOO_BIG,
+ this.getClassName()),
+ new SourceLocation(new File(myGen.getFileName()),0), null
+ );
+ return;
+ }
if (myType != null && myType.getWeaverState() != null) {
myGen.addAttribute(BcelAttributes.bcelAttribute(
new AjAttribute.WeaverState(myType.getWeaverState()),
diff --git a/weaver/src/org/aspectj/weaver/weaver-messages.properties b/weaver/src/org/aspectj/weaver/weaver-messages.properties
index da05f6ba1..3e6caeb53 100644
--- a/weaver/src/org/aspectj/weaver/weaver-messages.properties
+++ b/weaver/src/org/aspectj/weaver/weaver-messages.properties
@@ -87,6 +87,7 @@ aroundOnInterfaceStaticInit=around on staticinitialization of interface ''{0}''
# Bytecode generation nasties...
problemGeneratingMethod=problem generating method {0}.{1} : {2}
+classTooBig=The class {0} exceeds the maximum class size supported by the JVM (constant pool too big).
# Classpath messages
zipfileEntryMissing=zipfile classpath entry does not exist: {0}