From: mkersten Date: Tue, 27 Jul 2004 04:25:39 +0000 (+0000) Subject: Made AsmHiearchyBuilder extensible in order to support tools that require more X-Git-Tag: for_ajdt1_1_12~104 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1e5567686b5b71a2233820e1b87e7498dfcd2653;p=aspectj.git Made AsmHiearchyBuilder extensible in order to support tools that require more static structure than is currently offered by the ASM, e.g. UML views. --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java index c5ce71bb6..0e795772a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java @@ -8,25 +8,51 @@ * * Contributors: * PARC initial implementation + * Mik Kersten 2004-07-26 extended to allow overloading of + * hierarchy builder * ******************************************************************/ package org.aspectj.ajdt.internal.compiler.lookup; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; -import org.aspectj.ajdt.internal.compiler.ast.*; -import org.aspectj.ajdt.internal.core.builder.*; +import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration; +import org.aspectj.ajdt.internal.compiler.ast.AstUtil; +import org.aspectj.ajdt.internal.core.builder.AjBuildManager; +import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.IMessage.Kind; -import org.aspectj.weaver.*; +import org.aspectj.weaver.ConcreteTypeMunger; +import org.aspectj.weaver.IHasPosition; +import org.aspectj.weaver.Member; +import org.aspectj.weaver.ResolvedMember; +import org.aspectj.weaver.ResolvedTypeX; +import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.TypeX; +import org.aspectj.weaver.World; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.ast.*; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.EmptyStatement; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; +import org.eclipse.jdt.internal.compiler.lookup.BaseTypes; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; /** - * * @author Jim Hugunin */ public class EclipseFactory { @@ -36,6 +62,7 @@ public class EclipseFactory { private LookupEnvironment lookupEnvironment; private boolean xSerializableAspects; private World world; + private AsmHierarchyBuilder asmHierarchyBuilder; private Map/*TypeX, TypeBinding*/ typexToBinding = new HashMap(); //XXX currently unused @@ -317,11 +344,10 @@ public class EclipseFactory { public void finishedCompilationUnit(CompilationUnitDeclaration unit) { if ((buildManager != null) && buildManager.doGenerateModel()) { - AsmHierarchyBuilder.build(unit, buildManager.getStructureModel(), buildManager.buildConfig); + AjBuildManager.getAsmHierarchyBuilder().buildStructureForCompilationUnit(unit, buildManager.getStructureModel(), buildManager.buildConfig); } } - public void addTypeBinding(TypeBinding binding) { typexToBinding.put(fromBinding(binding), binding); } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 32c39a839..50fe61f9a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -56,6 +56,13 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc return f.getName().endsWith(".class"); }}; + /** + * This builder is static so that it can be subclassed and reset. However, note + * that there is only one builder present, so if two extendsion reset it, only + * the latter will get used. + */ + private static AsmHierarchyBuilder asmHierarchyBuilder = new AsmHierarchyBuilder(); + private IProgressListener progressListener = null; private int compiledCount; @@ -900,6 +907,16 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc public Map getBinarySourcesForThisWeave() { return binarySourcesForTheNextCompile; } - + + public static AsmHierarchyBuilder getAsmHierarchyBuilder() { + return asmHierarchyBuilder; + } + + /** + * Override the the default hierarchy builder. + */ + public static void setAsmHierarchyBuilder(AsmHierarchyBuilder newBuilder) { + asmHierarchyBuilder = newBuilder; + } } // class AjBuildManager