summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2004-03-04 16:09:34 +0000
committeraclement <aclement>2004-03-04 16:09:34 +0000
commit5d73494d7d222b92cdbb19f860f9215a07430681 (patch)
tree53fd3155b5fb0602d253bc9dd0d9f6038a9b5855
parent223951856673c27ebec5ffb61b929fadb4b6f567 (diff)
downloadaspectj-5d73494d7d222b92cdbb19f860f9215a07430681.tar.gz
aspectj-5d73494d7d222b92cdbb19f860f9215a07430681.zip
Fix for Bugzilla Bug 52394
inter-type declarations cause JRockit Crash
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java5
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java9
2 files changed, 11 insertions, 3 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
index 4c1ed2ff1..769f32e79 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectClinit.java
@@ -76,11 +76,14 @@ public class AspectClinit extends Clinit {
}
if (initFailureField != null) {
+ // Changes to this exception handling code may require changes to
+ // BcelClassWeaver.isInitFailureHandler()
handlerLabel.placeEnd();
Label endLabel = new Label(codeStream);
codeStream.goto_(endLabel);
-
handlerLabel.place();
+ codeStream.astore_0(); // Bug #52394
+ codeStream.aload_0();
codeStream.putstatic(initFailureField);
endLabel.place();
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
index 514e92262..7c6ddb9fd 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
@@ -998,8 +998,13 @@ class BcelClassWeaver implements IClassWeaver {
}
private boolean isInitFailureHandler(InstructionHandle ih) {
- if (ih.getInstruction() instanceof PUTSTATIC) {
- String name = ((PUTSTATIC)ih.getInstruction()).getFieldName(cpg);
+ // Skip the astore_0 and aload_0 at the start of the handler and
+ // then check if the instruction following these is
+ // 'putstatic ajc$initFailureCause'. If it is then we are
+ // in the handler we created in AspectClinit.generatePostSyntheticCode()
+ InstructionHandle twoInstructionsAway = ih.getNext().getNext();
+ if (twoInstructionsAway.getInstruction() instanceof PUTSTATIC) {
+ String name = ((PUTSTATIC)twoInstructionsAway.getInstruction()).getFieldName(cpg);
if (name.equals(NameMangler.INITFAILURECAUSE_FIELD_NAME)) return true;
}
return false;