From 127e468b74f1c1a99ae1917f64b5f251c45c4520 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 27 Mar 2009 17:35:00 +0000 Subject: [PATCH] 269286: handles for anno style elements: less than optimal fix but need something quick --- asm/src/org/aspectj/asm/IProgramElement.java | 3 +++ .../asm/internal/HandleProviderDelimiter.java | 18 +++++++++++++++--- .../aspectj/asm/internal/ProgramElement.java | 13 +++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/asm/src/org/aspectj/asm/IProgramElement.java b/asm/src/org/aspectj/asm/IProgramElement.java index f13759b12..9e077cf56 100644 --- a/asm/src/org/aspectj/asm/IProgramElement.java +++ b/asm/src/org/aspectj/asm/IProgramElement.java @@ -395,4 +395,7 @@ public interface IProgramElement extends Serializable { return this == PACKAGE_DECLARATION; } } + + public void setAnnotationStyleDeclaration(boolean b); + public boolean isAnnotationStyleDeclaration(); } \ No newline at end of file diff --git a/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java b/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java index 33152f4b8..a187e2f0c 100644 --- a/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java +++ b/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java @@ -88,7 +88,11 @@ public class HandleProviderDelimiter { || kind.equals(IProgramElement.Kind.ENUM) || kind.equals(IProgramElement.Kind.ANNOTATION)) { return TYPE.getDelimiter(); } else if (kind.equals(IProgramElement.Kind.ASPECT)) { - return ASPECT_TYPE.getDelimiter(); + if (ipe.isAnnotationStyleDeclaration()) { + return TYPE.getDelimiter(); + } else { + return ASPECT_TYPE.getDelimiter(); + } } else if (kind.equals(IProgramElement.Kind.INITIALIZER)) { return INITIALIZER.getDelimiter(); } else if (kind.equals(IProgramElement.Kind.INTER_TYPE_FIELD) || kind.equals(IProgramElement.Kind.INTER_TYPE_METHOD) @@ -99,9 +103,17 @@ public class HandleProviderDelimiter { } else if (kind.equals(IProgramElement.Kind.FIELD) || kind.equals(IProgramElement.Kind.ENUM_VALUE)) { return FIELD.getDelimiter(); } else if (kind.equals(IProgramElement.Kind.POINTCUT)) { - return POINTCUT.getDelimiter(); + if (ipe.isAnnotationStyleDeclaration()) { + return METHOD.getDelimiter(); + } else { + return POINTCUT.getDelimiter(); + } } else if (kind.equals(IProgramElement.Kind.ADVICE)) { - return ADVICE.getDelimiter(); + if (ipe.isAnnotationStyleDeclaration()) { + return METHOD.getDelimiter(); + } else { + return ADVICE.getDelimiter(); + } } else if (kind.equals(IProgramElement.Kind.DECLARE_PARENTS) || kind.equals(IProgramElement.Kind.DECLARE_WARNING) || kind.equals(IProgramElement.Kind.DECLARE_ERROR) || kind.equals(IProgramElement.Kind.DECLARE_SOFT) || kind.equals(IProgramElement.Kind.DECLARE_PRECEDENCE) diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java index 4c6bcd37b..537b8254c 100644 --- a/asm/src/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java @@ -646,4 +646,17 @@ public class ProgramElement implements IProgramElement { public ExtraInformation getExtraInfo() { return (ExtraInformation) kvpairs.get("ExtraInformation"); } + + public boolean isAnnotationStyleDeclaration() { + return kvpairs.get("annotationStyleDeclaration")!=null; + } + + public void setAnnotationStyleDeclaration(boolean b) { + if (b) { + if (kvpairs == Collections.EMPTY_MAP) { + kvpairs = new HashMap(); + } + kvpairs.put("annotationStyleDeclaration", "true"); + } + } } -- 2.39.5