From 7e211730f897a31022b4162d7ae5ba2cec342ed8 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 7 Jun 2010 23:49:08 +0000 Subject: [PATCH] itd inner classes --- .../compiler/ast/AspectDeclaration.java | 10 + .../compiler/lookup/EclipseTypeMunger.java | 52 ++++- .../lookup/InterTypeMemberClassBinding.java | 70 +++++++ .../lookup/IntertypeMemberTypeFinder.java | 50 +++++ .../compiler/parser/DeclarationFactory.java | 189 +++++------------- 5 files changed, 228 insertions(+), 143 deletions(-) create mode 100644 org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberClassBinding.java create mode 100644 org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java index 31666f59f..d7fb9335d 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java @@ -1048,6 +1048,16 @@ public class AspectDeclaration extends TypeDeclaration { } } } + if (memberTypes != null) { + for (int i = 0; i < memberTypes.length; i++) { + if (memberTypes[i] instanceof IntertypeMemberClassDeclaration) { + EclipseTypeMunger m = ((IntertypeMemberClassDeclaration) memberTypes[i]).build(classScope); + if (m != null) { + concreteName.typeMungers.add(m); + } + } + } + } concreteName.getDeclaredPointcuts(); } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java index 010b52e7c..55ca6be2a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseTypeMunger.java @@ -9,22 +9,25 @@ * Contributors: * PARC initial implementation * ******************************************************************/ - package org.aspectj.ajdt.internal.compiler.lookup; import java.lang.reflect.Modifier; import java.util.Map; +import org.aspectj.asm.internal.CharOperation; import org.aspectj.bridge.ISourceLocation; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TagBits; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.NewConstructorTypeMunger; import org.aspectj.weaver.NewFieldTypeMunger; +import org.aspectj.weaver.NewMemberClassTypeMunger; import org.aspectj.weaver.NewMethodTypeMunger; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedType; @@ -43,14 +46,22 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { super(munger, aspectType); this.world = world; this.sourceMethod = sourceMethod; + // A null sourceMethod can be because of binary weaving if (sourceMethod != null) { this.sourceLocation = new EclipseSourceLocation(sourceMethod.compilationResult, sourceMethod.sourceStart, sourceMethod.sourceEnd); // Piece of magic that tells type mungers where they came from. // Won't be persisted unless ResolvedTypeMunger.persistSourceLocation is true. munger.setSourceLocation(sourceLocation); + + // use a different ctor for type level inter type decls I think + // } else { + // this.sourceLocation = aspectType.getSourceLocation(); + // munger.setSourceLocation(sourceLocation); } - targetTypeX = munger.getSignature().getDeclaringType().resolve(world.getWorld()); + // was + targetTypeX = munger.getDeclaringType().resolve(world.getWorld()); + // targetTypeX = munger.getSignature().getDeclaringType().resolve(world.getWorld()); // AMC, needed until generic and raw have distinct sigs... if (targetTypeX.isParameterizedType() || targetTypeX.isRawType()) { targetTypeX = targetTypeX.getGenericType(); @@ -59,7 +70,8 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { } public static boolean supportsKind(ResolvedTypeMunger.Kind kind) { - return kind == ResolvedTypeMunger.Field || kind == ResolvedTypeMunger.Method || kind == ResolvedTypeMunger.Constructor; + return kind == ResolvedTypeMunger.Field || kind == ResolvedTypeMunger.Method || kind == ResolvedTypeMunger.Constructor + || kind == ResolvedTypeMunger.InnerClass; } public String toString() { @@ -106,6 +118,8 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { return mungeNewMethod(sourceType, onType, (NewMethodTypeMunger) munger, isExactTargetType); } else if (munger.getKind() == ResolvedTypeMunger.Constructor) { mungeNewConstructor(sourceType, (NewConstructorTypeMunger) munger); + } else if (munger.getKind() == ResolvedTypeMunger.InnerClass) { + mungeNewInnerClass(sourceType, onType, (NewMemberClassTypeMunger) munger, isExactTargetType); } else { throw new RuntimeException("unimplemented: " + munger.getKind()); } @@ -149,6 +163,27 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { return true; } + private boolean mungeNewInnerClass(SourceTypeBinding sourceType, ResolvedType onType, NewMemberClassTypeMunger munger, + boolean isExactTargetType) { + ReferenceBinding binding = new InterTypeMemberClassBinding(world, munger, aspectType, onType, munger.getMemberTypeName(), + sourceType); + + SourceTypeBinding stb = (SourceTypeBinding) world.makeTypeBinding(aspectType); + ReferenceBinding found = null; + for (int i = 0; i < stb.memberTypes.length; i++) { + ReferenceBinding rb = stb.memberTypes[i]; + char[] sn = rb.sourceName; + if (CharOperation.equals(munger.getMemberTypeName().toCharArray(), sn)) { + binding = rb; + } + } + // TODO adjust modifier? + // TODO deal with itd of it onto an interface + + findOrCreateInterTypeMemberClassFinder(sourceType).addInterTypeMemberType(binding); + return true; + } + private void mungeNewConstructor(SourceTypeBinding sourceType, NewConstructorTypeMunger munger) { if (shouldTreatAsPublic()) { MethodBinding binding = world.makeMethodBinding(munger.getSignature(), munger.getTypeVariableAliases()); @@ -211,6 +246,17 @@ public class EclipseTypeMunger extends ConcreteTypeMunger { return finder; } + private IntertypeMemberTypeFinder findOrCreateInterTypeMemberClassFinder(SourceTypeBinding sourceType) { + IntertypeMemberTypeFinder finder = (IntertypeMemberTypeFinder) sourceType.typeFinder; + if (finder == null) { + finder = new IntertypeMemberTypeFinder(); + sourceType.typeFinder = finder; + finder.targetTypeBinding = sourceType; + sourceType.tagBits &= ~TagBits.HasNoMemberTypes; // ensure it thinks it has one + } + return finder; + } + public ISourceLocation getSourceLocation() { return sourceLocation; } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberClassBinding.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberClassBinding.java new file mode 100644 index 000000000..92dda50f9 --- /dev/null +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberClassBinding.java @@ -0,0 +1,70 @@ +/* ******************************************************************* + * Copyright (c) 2010 Contributors + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - SpringSource + * ******************************************************************/ +package org.aspectj.ajdt.internal.compiler.lookup; + +import org.aspectj.asm.internal.CharOperation; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MemberTypeBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.aspectj.weaver.NewMemberClassTypeMunger; +import org.aspectj.weaver.ResolvedType; + +/** + * A special kind of MemberTypeBinding that is targeting some other type. + * + * @author Andy Clement + */ +public class InterTypeMemberClassBinding extends MemberTypeBinding { + + public InterTypeMemberClassBinding(EclipseFactory world, NewMemberClassTypeMunger munger, ResolvedType aspectType, + ResolvedType onType, String name, SourceTypeBinding sourceTypeOnType) { + super(toCompoundName(onType, name), sourceTypeOnType.scope, sourceTypeOnType); + SourceTypeBinding stb = (SourceTypeBinding) world.makeTypeBinding(aspectType); + ReferenceBinding found = null; + for (int i = 0; i < stb.memberTypes.length; i++) { + ReferenceBinding rb = stb.memberTypes[i]; + char[] sn = rb.sourceName; + if (CharOperation.equals(name.toCharArray(), sn)) { + found = rb; + } + } + + if (found == null) { + throw new IllegalStateException(); + } + FieldBinding[] fbs = found.fields(); + this.fields = new FieldBinding[fbs.length]; + int fCounter = 0; + for (FieldBinding fb : fbs) { + this.fields[fCounter++] = new FieldBinding(fb, this); + } + // world.makeTypeBinding(onType)); + // helper interface binding is perhaps a good example of a 'new binding' + // this.fPackage = enclosingType.fPackage; + // //this.fileName = scope.referenceCompilationUnit().getFileName(); + // this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccInterface | ClassFileConstants.AccAbstract; + // this.sourceName = enclosingType.scope.referenceContext.name; + // this.enclosingType = enclosingType; + // this.typeX = typeX; + this.typeVariables = Binding.NO_TYPE_VARIABLES; + this.memberTypes = Binding.NO_MEMBER_TYPES; + // this.scope =enclosingType.scope; + // this.superInterfaces = new ReferenceBinding[0]; + } + + private static char[][] toCompoundName(ResolvedType onType, String name) { + String memberName = onType.getName() + "$" + name; + return CharOperation.splitOn('.', memberName.toCharArray()); + } +} diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java new file mode 100644 index 000000000..d415f6956 --- /dev/null +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/IntertypeMemberTypeFinder.java @@ -0,0 +1,50 @@ +/* ******************************************************************* + * Copyright (c) 2010 Contributors + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - SpringSource + * ******************************************************************/ +package org.aspectj.ajdt.internal.compiler.lookup; + +import java.util.ArrayList; +import java.util.List; + +import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ITypeFinder; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; + +/** + * The member finder looks after intertype declared inner classes on a type, there is one member finder per type that was hit by an + * new inner type declaration. + * + * @author Andy Clement + * @since 1.6.9 + */ +public class IntertypeMemberTypeFinder implements ITypeFinder { + + // Target that has these new types + public SourceTypeBinding targetTypeBinding; + + // The new types declared onto the target + private List intertypeMemberTypes = new ArrayList(); + + public void addInterTypeMemberType(ReferenceBinding binding) { + intertypeMemberTypes.add(binding); + } + + public ReferenceBinding getMemberType(char[] memberTypeName) { + for (ReferenceBinding intertypeMemberType : intertypeMemberTypes) { + if (CharOperation.equals(intertypeMemberType.sourceName, memberTypeName)) { + return intertypeMemberType; + } + } + return null; + } + +} diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/DeclarationFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/DeclarationFactory.java index 20d4e0aad..85999476d 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/DeclarationFactory.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/DeclarationFactory.java @@ -23,15 +23,13 @@ import org.aspectj.ajdt.internal.compiler.ast.InterTypeConstructorDeclaration; import org.aspectj.ajdt.internal.compiler.ast.InterTypeDeclaration; import org.aspectj.ajdt.internal.compiler.ast.InterTypeFieldDeclaration; import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration; +import org.aspectj.ajdt.internal.compiler.ast.IntertypeMemberClassDeclaration; import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration; import org.aspectj.ajdt.internal.compiler.ast.PointcutDesignator; import org.aspectj.ajdt.internal.compiler.ast.Proceed; import org.aspectj.ajdt.internal.compiler.ast.PseudoToken; import org.aspectj.ajdt.internal.compiler.ast.PseudoTokens; import org.aspectj.ajdt.internal.core.builder.EclipseSourceContext; -import org.aspectj.weaver.AdviceKind; -import org.aspectj.weaver.patterns.Declare; -import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation; @@ -44,253 +42,164 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser; import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory; +import org.aspectj.weaver.AdviceKind; +import org.aspectj.weaver.patterns.Declare; +import org.aspectj.weaver.patterns.DeclareAnnotation; /** - * @author colyer - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments + * @author Adrian Colyer + * @author Andy Clement */ public class DeclarationFactory implements IDeclarationFactory { - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createMethodDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public MethodDeclaration createMethodDeclaration(CompilationResult result) { return new AjMethodDeclaration(result); } - - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createConstructorDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ + public ConstructorDeclaration createConstructorDeclaration(CompilationResult result) { return new AjConstructorDeclaration(result); } - - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createProceed(org.eclipse.jdt.internal.compiler.ast.MessageSend) - */ + public MessageSend createProceed(MessageSend m) { return new Proceed(m); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createAspect(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public TypeDeclaration createAspect(CompilationResult result) { return new AspectDeclaration(result); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setPrivileged(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration, boolean) - */ public void setPrivileged(TypeDeclaration aspectDecl, boolean isPrivileged) { - ((AspectDeclaration)aspectDecl).isPrivileged = isPrivileged; + ((AspectDeclaration) aspectDecl).isPrivileged = isPrivileged; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setPerClauseFrom(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration, org.eclipse.jdt.internal.compiler.ast.ASTNode) - */ public void setPerClauseFrom(TypeDeclaration aspectDecl, ASTNode pseudoTokens, Parser parser) { AspectDeclaration aspect = (AspectDeclaration) aspectDecl; PseudoTokens tok = (PseudoTokens) pseudoTokens; aspect.perClause = tok.parsePerClause(parser); // For the ast support: currently the below line is not finished! The start is set incorrectly - ((AspectDeclaration)aspectDecl).perClause.setLocation(null,1,parser.getCurrentTokenStart()+1); + ((AspectDeclaration) aspectDecl).perClause.setLocation(null, 1, parser.getCurrentTokenStart() + 1); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setDominatesPatternFrom(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration, org.eclipse.jdt.internal.compiler.ast.ASTNode) - */ public void setDominatesPatternFrom(TypeDeclaration aspectDecl, ASTNode pseudoTokens, Parser parser) { AspectDeclaration aspect = (AspectDeclaration) aspectDecl; PseudoTokens tok = (PseudoTokens) pseudoTokens; aspect.dominatesPattern = tok.maybeParseDominatesPattern(parser); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createPseudoTokensFrom(org.eclipse.jdt.internal.compiler.ast.ASTNode[], org.eclipse.jdt.internal.compiler.CompilationResult) - */ public ASTNode createPseudoTokensFrom(ASTNode[] tokens, CompilationResult result) { PseudoToken[] psts = new PseudoToken[tokens.length]; for (int i = 0; i < psts.length; i++) { - psts[i] = (PseudoToken)tokens[i]; + psts[i] = (PseudoToken) tokens[i]; } - return new PseudoTokens(psts,new EclipseSourceContext(result)); + return new PseudoTokens(psts, new EclipseSourceContext(result)); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createPointcutDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public MethodDeclaration createPointcutDeclaration(CompilationResult result) { return new PointcutDeclaration(result); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createAroundAdviceDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public MethodDeclaration createAroundAdviceDeclaration(CompilationResult result) { - return new AdviceDeclaration(result,AdviceKind.Around); + return new AdviceDeclaration(result, AdviceKind.Around); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createAfterAdviceDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public MethodDeclaration createAfterAdviceDeclaration(CompilationResult result) { - return new AdviceDeclaration(result,AdviceKind.After); + return new AdviceDeclaration(result, AdviceKind.After); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createBeforeAdviceDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public MethodDeclaration createBeforeAdviceDeclaration(CompilationResult result) { - return new AdviceDeclaration(result,AdviceKind.Before); + return new AdviceDeclaration(result, AdviceKind.Before); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createPointcutDesignator(org.eclipse.jdt.internal.compiler.parser.Parser, org.eclipse.jdt.internal.compiler.ast.ASTNode) - */ public ASTNode createPointcutDesignator(Parser parser, ASTNode pseudoTokens) { - return new PointcutDesignator(parser,(PseudoTokens)pseudoTokens); + return new PointcutDesignator(parser, (PseudoTokens) pseudoTokens); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setPointcutDesignator(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration, org.eclipse.jdt.internal.compiler.ast.ASTNode) - */ public void setPointcutDesignatorOnAdvice(MethodDeclaration adviceDecl, ASTNode des) { - ((AdviceDeclaration)adviceDecl).pointcutDesignator = (PointcutDesignator)des; + ((AdviceDeclaration) adviceDecl).pointcutDesignator = (PointcutDesignator) des; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setPointcutDesignator(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration, org.eclipse.jdt.internal.compiler.ast.ASTNode) - */ public void setPointcutDesignatorOnPointcut(MethodDeclaration pcutDecl, ASTNode des) { - ((PointcutDeclaration)pcutDecl).pointcutDesignator = (PointcutDesignator)des; + ((PointcutDeclaration) pcutDecl).pointcutDesignator = (PointcutDesignator) des; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setExtraArgument(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration, org.eclipse.jdt.internal.compiler.ast.Argument) - */ public void setExtraArgument(MethodDeclaration adviceDeclaration, Argument arg) { - ((AdviceDeclaration)adviceDeclaration).extraArgument = arg; + ((AdviceDeclaration) adviceDeclaration).extraArgument = arg; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#isAfterAdvice(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration) - */ - public boolean isAfterAdvice(MethodDeclaration adviceDecl) { - return ((AdviceDeclaration)adviceDecl).kind != AdviceKind.After; + public boolean isAfterAdvice(MethodDeclaration adviceDecl) { + return ((AdviceDeclaration) adviceDecl).kind != AdviceKind.After; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setAfterThrowingAdviceKind(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration) - */ public void setAfterThrowingAdviceKind(MethodDeclaration adviceDecl) { - ((AdviceDeclaration)adviceDecl).kind = AdviceKind.AfterThrowing; + ((AdviceDeclaration) adviceDecl).kind = AdviceKind.AfterThrowing; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setAfterReturningAdviceKind(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration) - */ public void setAfterReturningAdviceKind(MethodDeclaration adviceDecl) { - ((AdviceDeclaration)adviceDecl).kind = AdviceKind.AfterReturning; + ((AdviceDeclaration) adviceDecl).kind = AdviceKind.AfterReturning; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createDeclareDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult, org.eclipse.jdt.internal.compiler.ast.ASTNode) - */ public MethodDeclaration createDeclareDeclaration(CompilationResult result, ASTNode pseudoTokens, Parser parser) { - Declare declare = ((PseudoTokens)pseudoTokens).parseDeclare(parser); - return new DeclareDeclaration(result,declare); + Declare declare = ((PseudoTokens) pseudoTokens).parseDeclare(parser); + return new DeclareDeclaration(result, declare); } - /* (non-Javadoc) - * @see org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createDeclareAnnotationDeclaration(org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult, org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode, org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation, org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser) - */ - public MethodDeclaration createDeclareAnnotationDeclaration( - CompilationResult result, ASTNode pseudoTokens, + public MethodDeclaration createDeclareAnnotationDeclaration(CompilationResult result, ASTNode pseudoTokens, Annotation annotation, Parser parser) { - DeclareAnnotation declare = (DeclareAnnotation) ((PseudoTokens)pseudoTokens).parseAnnotationDeclare(parser); - DeclareAnnotationDeclaration decl = new DeclareAnnotationDeclaration(result,declare,annotation); + DeclareAnnotation declare = (DeclareAnnotation) ((PseudoTokens) pseudoTokens).parseAnnotationDeclare(parser); + DeclareAnnotationDeclaration decl = new DeclareAnnotationDeclaration(result, declare, annotation); return decl; } - - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createInterTypeFieldDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult, org.eclipse.jdt.internal.compiler.ast.TypeReference) - */ + public MethodDeclaration createInterTypeFieldDeclaration(CompilationResult result, TypeReference onType) { - return new InterTypeFieldDeclaration(result,onType); + return new InterTypeFieldDeclaration(result, onType); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createInterTypeMethodDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public MethodDeclaration createInterTypeMethodDeclaration(CompilationResult result) { - return new InterTypeMethodDeclaration(result,null); + return new InterTypeMethodDeclaration(result, null); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createInterTypeConstructorDeclaration(org.eclipse.jdt.internal.compiler.CompilationResult) - */ public MethodDeclaration createInterTypeConstructorDeclaration(CompilationResult result) { - return new InterTypeConstructorDeclaration(result,null); + return new InterTypeConstructorDeclaration(result, null); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setSelector(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration, char[]) - */ public void setSelector(MethodDeclaration interTypeDecl, char[] selector) { - ((InterTypeDeclaration)interTypeDecl).setSelector(selector); + ((InterTypeDeclaration) interTypeDecl).setSelector(selector); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setDeclaredModifiers(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration, int) - */ public void setDeclaredModifiers(MethodDeclaration interTypeDecl, int modifiers) { - ((InterTypeDeclaration)interTypeDecl).setDeclaredModifiers(modifiers); } + ((InterTypeDeclaration) interTypeDecl).setDeclaredModifiers(modifiers); + } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setInitialization(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration, org.eclipse.jdt.internal.compiler.ast.Expression) - */ public void setInitialization(MethodDeclaration itdFieldDecl, Expression initialization) { - ((InterTypeFieldDeclaration)itdFieldDecl).setInitialization(initialization); + ((InterTypeFieldDeclaration) itdFieldDecl).setInitialization(initialization); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setOnType(org.eclipse.jdt.internal.compiler.ast.MethodDeclaration, org.eclipse.jdt.internal.compiler.ast.TypeReference) - */ public void setOnType(MethodDeclaration interTypeDecl, TypeReference onType) { - ((InterTypeDeclaration)interTypeDecl).setOnType(onType); + ((InterTypeDeclaration) interTypeDecl).setOnType(onType); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createPseudoToken(org.eclipse.jdt.internal.compiler.parser.Parser, java.lang.String, boolean) - */ + public ASTNode createPseudoToken(Parser parser, String value, boolean isIdentifier) { - return new PseudoToken(parser,value,isIdentifier); + return new PseudoToken(parser, value, isIdentifier); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#createIfPseudoToken(org.eclipse.jdt.internal.compiler.parser.Parser, org.eclipse.jdt.internal.compiler.ast.Expression) - */ public ASTNode createIfPseudoToken(Parser parser, Expression expr) { - return new IfPseudoToken(parser,expr); + return new IfPseudoToken(parser, expr); } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#setLiteralKind(org.eclipse.jdt.internal.compiler.ast.ASTNode, java.lang.String) - */ public void setLiteralKind(ASTNode pseudoToken, String string) { - ((PseudoToken)pseudoToken).literalKind = string; + ((PseudoToken) pseudoToken).literalKind = string; } - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.compiler.parser.Parser.IDeclarationFactory#shouldTryToRecover(org.eclipse.jdt.internal.compiler.ast.ASTNode) - */ public boolean shouldTryToRecover(ASTNode node) { - return !(node instanceof AspectDeclaration || - node instanceof PointcutDeclaration || - node instanceof AdviceDeclaration) ; + return !(node instanceof AspectDeclaration || node instanceof PointcutDeclaration || node instanceof AdviceDeclaration); } + public TypeDeclaration createIntertypeMemberClassDeclaration(CompilationResult compilationResult) { + return new IntertypeMemberClassDeclaration(compilationResult); + } + + public void setOnType(TypeDeclaration interTypeDecl, TypeReference onType) { + ((IntertypeMemberClassDeclaration) interTypeDecl).setOnType(onType); + } } -- 2.39.5