diff options
author | jhugunin <jhugunin> | 2002-12-24 00:34:36 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2002-12-24 00:34:36 +0000 |
commit | 045686fb7995a6eb490cc3d81b30a4b1834b6568 (patch) | |
tree | cee22fcd30b6f60e1fc9f6d63c7767396977f419 /org.aspectj.ajdt.core | |
parent | d3156f737f3bb24e3ad695205da5977bef519275 (diff) | |
download | aspectj-045686fb7995a6eb490cc3d81b30a4b1834b6568.tar.gz aspectj-045686fb7995a6eb490cc3d81b30a4b1834b6568.zip |
correctly handling exceptions thrown from intro methods
Diffstat (limited to 'org.aspectj.ajdt.core')
6 files changed, 40 insertions, 17 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java index d32e2c009..31ce89eef 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java @@ -204,7 +204,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration { ResolvedMember signature = new ResolvedMember(Member.CONSTRUCTOR, declaringTypeX, declaredModifiers, ResolvedTypeX.VOID, "<init>", bindingAsMember.getParameterTypes()); - + signature.setCheckedExceptions(world.fromEclipse(binding.thrownExceptions)); ResolvedMember syntheticInterMember = AjcMemberMaker.interConstructor(declaringTypeX, signature, aspectType); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java index fba705bc6..b2c735a90 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java @@ -136,4 +136,6 @@ public abstract class InterTypeDeclaration extends MethodDeclaration { } protected abstract Shadow.Kind getShadowKindForBody(); + + public ResolvedMember getSignature() { return munger.getSignature(); } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java index 899d5ec6b..e3fea33e7 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java @@ -79,6 +79,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { ResolvedMember sig = new ResolvedMember(Member.METHOD, EclipseWorld.fromBinding(onTypeBinding), declaredModifiers, EclipseWorld.fromBinding(binding.returnType), new String(declaredSelector), EclipseWorld.fromBindings(binding.parameters)); + sig.setCheckedExceptions(world.fromEclipse(binding.thrownExceptions)); NewMethodTypeMunger myMunger = new NewMethodTypeMunger(sig, null); setMunger(myMunger); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java index 5f362ccc3..3fbf2203d 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java @@ -13,6 +13,7 @@ package org.aspectj.ajdt.internal.compiler.lookup; +import org.aspectj.ajdt.internal.compiler.ast.*; import org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration; import org.aspectj.bridge.SourceLocation; import org.aspectj.weaver.*; @@ -114,6 +115,14 @@ public class EclipseShadow extends Shadow { Shadow.Kind kind; if (e instanceof AdviceDeclaration) { kind = Shadow.AdviceExecution; + } else if (e instanceof InterTypeMethodDeclaration) { + return new EclipseShadow(world, Shadow.MethodExecution, + ((InterTypeDeclaration)e).getSignature(), astNode, context); + } else if (e instanceof InterTypeConstructorDeclaration) { + return new EclipseShadow(world, Shadow.ConstructorExecution, + ((InterTypeDeclaration)e).getSignature(), astNode, context); + } else if (e instanceof InterTypeFieldDeclaration) { + return null; } else if (e instanceof MethodDeclaration) { kind = Shadow.MethodExecution; } else if (e instanceof ConstructorDeclaration) { diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java index 7ada86e4f..272127064 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java @@ -140,14 +140,15 @@ public class EclipseWorld extends World { } public static ResolvedMember makeResolvedMember(MethodBinding binding) { - return new ResolvedMember( + ResolvedMember ret = new ResolvedMember( binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD, fromBinding(binding.declaringClass), binding.modifiers, fromBinding(binding.returnType), new String(binding.selector), fromBindings(binding.parameters)); - //XXX need to add checked exceptions + ret.setCheckedExceptions(fromBindings(binding.thrownExceptions)); + return ret; } public static ResolvedMember makeResolvedMember(FieldBinding binding) { @@ -202,6 +203,17 @@ public class EclipseWorld extends World { } return ret; } + + + private ReferenceBinding[] makeReferenceBindings(TypeX[] types) { + int len = types.length; + ReferenceBinding[] ret = new ReferenceBinding[len]; + + for (int i = 0; i < len; i++) { + ret[i] = (ReferenceBinding)makeTypeBinding(types[i]); + } + return ret; + } public FieldBinding makeFieldBinding(ResolvedMember member) { @@ -214,16 +226,15 @@ public class EclipseWorld extends World { public MethodBinding makeMethodBinding(ResolvedMember member) { - if (member.getExceptions() != null && member.getExceptions().length > 0) { - throw new RuntimeException("unimplemented"); - } return new MethodBinding(member.getModifiers(), member.getName().toCharArray(), makeTypeBinding(member.getReturnType()), makeTypeBindings(member.getParameterTypes()), - new ReferenceBinding[0], + makeReferenceBindings(member.getExceptions()), (ReferenceBinding)makeTypeBinding(member.getDeclaringType())); } + + public MethodBinding makeMethodBindingForCall(Member member) { return new MethodBinding(member.getCallsiteModifiers(), diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java index b70be133f..f2273f1b3 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java @@ -21,8 +21,8 @@ import org.aspectj.testing.util.TestUtil; public class WorkingTestMain { public static void main(String[] args1) throws IOException { - //testExamples(); - testOne(); + testExamples(); + //testOne(); } public static void testOne() throws IOException { @@ -67,7 +67,7 @@ public class WorkingTestMain { //TestUtil.runMain("out;../lib/test/testing-client.jar", "AroundInnerCalls"); } - private static String examplesDir = "c:/aspectj/examples/"; + private static String examplesDir = "../docs/dist/doc/examples/"; private static void example(String[] argfiles, String[] classes) { List args = new ArrayList(); args.add("-verbose"); @@ -90,11 +90,11 @@ public class WorkingTestMain { public static void testExamples() throws IOException { -// example(new String[] {"observer/files.lst"}, -// new String[] {"observer.Demo"}); + example(new String[] {"observer/files.lst"}, + new String[] {}); // don't run the gui -// example(new String[] {"tjp/files.lst"}, -// new String[] {"tjp.Demo"}); + example(new String[] {"tjp/files.lst"}, + new String[] {"tjp.Demo"}); example(new String[] {"telecom/timing.lst"}, new String[] {"telecom.TimingSimulation"}); @@ -122,12 +122,12 @@ public class WorkingTestMain { new String[] {"bean.Demo"}); example(new String[] {"spacewar/demo.lst"}, - new String[] {}); + new String[] {}); // don't run the gui example(new String[] {"spacewar/debug.lst"}, - new String[] {}); - + new String[] {}); // don't run the gui + System.out.println("done!!!!!!!!!!!!!!!!!!!!"); } } |