From f8ab145f9ba1edea907db7a78a7c3ff25cd28e4d Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 4 Feb 2009 20:21:31 +0000 Subject: [PATCH] 263487: test and fix --- asm/src/org/aspectj/asm/AsmManager.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/asm/src/org/aspectj/asm/AsmManager.java b/asm/src/org/aspectj/asm/AsmManager.java index b67cfb4f4..1ddfd6c5e 100644 --- a/asm/src/org/aspectj/asm/AsmManager.java +++ b/asm/src/org/aspectj/asm/AsmManager.java @@ -831,7 +831,7 @@ public class AsmManager implements IStructureModel { throw new RuntimeException("target can't be null!"); if (type == null) throw new RuntimeException("type can't be null!"); - if (target.getKind().isSourceFile()) { + if (target.getKind().isSourceFile() || target.getKind().isFile()) { // isFile() covers pr263487 // @AJ aspect with broken relationship endpoint - we couldn't find // the real // endpoint (the declare parents or ITD or similar) so defaulted to @@ -854,10 +854,16 @@ public class AsmManager implements IStructureModel { return false; return (target.getSourceLocation().getSourceFile().equals(type.getSourceLocation().getSourceFile())); } - while (!containingType.getKind().isType()) { - // System.err.println("Checked: "+containingType.getKind()+" "+ - // containingType); - containingType = containingType.getParent(); + try { + while (!containingType.getKind().isType()) { + containingType = containingType.getParent(); + } + } catch (Throwable t) { + // Example: + // java.lang.RuntimeException: Exception whilst walking up from target X.class kind=(file) + // hid=(=importProb/binaries