Class World

java.lang.Object
org.aspectj.weaver.World
All Implemented Interfaces:
Dump.INode
Direct Known Subclasses:
BcelWorld, ReflectionWorld

public abstract class World extends Object implements Dump.INode
A World is a collection of known types and crosscutting members.
Author:
PARC, Adrian Colyer, Andy Clement, Abraham Nevado, Joseph MacFarlane
  • Field Details

    • typeMap

      protected World.TypeMap typeMap
      The heart of the world, a map from type signatures to resolved types
    • createInjarHierarchy

      public static boolean createInjarHierarchy
      Should we create the hierarchy for binary classes and aspects
    • RUNTIME_LEVEL_DEFAULT

      public static final RuntimeVersion RUNTIME_LEVEL_DEFAULT
      The level of the aspectjrt.jar the code we generate needs to run on
    • bcelRepositoryCaching

      protected boolean bcelRepositoryCaching
    • forDEBUG_structuralChangesCode

      public boolean forDEBUG_structuralChangesCode
    • forDEBUG_bridgingCode

      public boolean forDEBUG_bridgingCode
    • optimizedMatching

      public boolean optimizedMatching
    • generateNewLvts

      public boolean generateNewLvts
    • timersPerJoinpoint

      protected long timersPerJoinpoint
    • timersPerType

      protected long timersPerType
    • infoMessagesEnabled

      public int infoMessagesEnabled
    • BYTE

      public final org.aspectj.weaver.ResolvedType.Primitive BYTE
    • CHAR

      public final org.aspectj.weaver.ResolvedType.Primitive CHAR
    • DOUBLE

      public final org.aspectj.weaver.ResolvedType.Primitive DOUBLE
    • FLOAT

      public final org.aspectj.weaver.ResolvedType.Primitive FLOAT
    • INT

      public final org.aspectj.weaver.ResolvedType.Primitive INT
    • LONG

      public final org.aspectj.weaver.ResolvedType.Primitive LONG
    • SHORT

      public final org.aspectj.weaver.ResolvedType.Primitive SHORT
    • BOOLEAN

      public final org.aspectj.weaver.ResolvedType.Primitive BOOLEAN
    • VOID

      public final org.aspectj.weaver.ResolvedType.Primitive VOID
    • xsetAVOID_FINAL

      public static final String xsetAVOID_FINAL
      See Also:
      Constant Field Values
    • xsetWEAVE_JAVA_PACKAGES

      public static final String xsetWEAVE_JAVA_PACKAGES
      See Also:
      Constant Field Values
    • xsetWEAVE_JAVAX_PACKAGES

      public static final String xsetWEAVE_JAVAX_PACKAGES
      See Also:
      Constant Field Values
    • xsetCAPTURE_ALL_CONTEXT

      public static final String xsetCAPTURE_ALL_CONTEXT
      See Also:
      Constant Field Values
    • xsetRUN_MINIMAL_MEMORY

      public static final String xsetRUN_MINIMAL_MEMORY
      See Also:
      Constant Field Values
    • xsetDEBUG_STRUCTURAL_CHANGES_CODE

      public static final String xsetDEBUG_STRUCTURAL_CHANGES_CODE
      See Also:
      Constant Field Values
    • xsetDEBUG_BRIDGING

      public static final String xsetDEBUG_BRIDGING
      See Also:
      Constant Field Values
    • xsetTRANSIENT_TJP_FIELDS

      public static final String xsetTRANSIENT_TJP_FIELDS
      See Also:
      Constant Field Values
    • xsetBCEL_REPOSITORY_CACHING

      public static final String xsetBCEL_REPOSITORY_CACHING
      See Also:
      Constant Field Values
    • xsetPIPELINE_COMPILATION

      public static final String xsetPIPELINE_COMPILATION
      See Also:
      Constant Field Values
    • xsetGENERATE_STACKMAPS

      public static final String xsetGENERATE_STACKMAPS
      See Also:
      Constant Field Values
    • xsetPIPELINE_COMPILATION_DEFAULT

      public static final String xsetPIPELINE_COMPILATION_DEFAULT
      See Also:
      Constant Field Values
    • xsetCOMPLETE_BINARY_TYPES

      public static final String xsetCOMPLETE_BINARY_TYPES
      See Also:
      Constant Field Values
    • xsetCOMPLETE_BINARY_TYPES_DEFAULT

      public static final String xsetCOMPLETE_BINARY_TYPES_DEFAULT
      See Also:
      Constant Field Values
    • xsetTYPE_DEMOTION

      public static final String xsetTYPE_DEMOTION
      See Also:
      Constant Field Values
    • xsetTYPE_DEMOTION_DEBUG

      public static final String xsetTYPE_DEMOTION_DEBUG
      See Also:
      Constant Field Values
    • xsetTYPE_REFS

      public static final String xsetTYPE_REFS
      See Also:
      Constant Field Values
    • xsetBCEL_REPOSITORY_CACHING_DEFAULT

      public static final String xsetBCEL_REPOSITORY_CACHING_DEFAULT
      See Also:
      Constant Field Values
    • xsetFAST_PACK_METHODS

      public static final String xsetFAST_PACK_METHODS
      See Also:
      Constant Field Values
    • xsetOVERWEAVING

      public static final String xsetOVERWEAVING
      See Also:
      Constant Field Values
    • xsetOPTIMIZED_MATCHING

      public static final String xsetOPTIMIZED_MATCHING
      See Also:
      Constant Field Values
    • xsetTIMERS_PER_JOINPOINT

      public static final String xsetTIMERS_PER_JOINPOINT
      See Also:
      Constant Field Values
    • xsetTIMERS_PER_FASTMATCH_CALL

      public static final String xsetTIMERS_PER_FASTMATCH_CALL
      See Also:
      Constant Field Values
    • xsetITD_VERSION

      public static final String xsetITD_VERSION
      See Also:
      Constant Field Values
    • xsetITD_VERSION_ORIGINAL

      public static final String xsetITD_VERSION_ORIGINAL
      See Also:
      Constant Field Values
    • xsetITD_VERSION_2NDGEN

      public static final String xsetITD_VERSION_2NDGEN
      See Also:
      Constant Field Values
    • xsetITD_VERSION_DEFAULT

      public static final String xsetITD_VERSION_DEFAULT
      See Also:
      Constant Field Values
    • xsetMINIMAL_MODEL

      public static final String xsetMINIMAL_MODEL
      See Also:
      Constant Field Values
    • xsetTARGETING_RUNTIME_1610

      public static final String xsetTARGETING_RUNTIME_1610
      See Also:
      Constant Field Values
    • xsetGENERATE_NEW_LVTS

      public static final String xsetGENERATE_NEW_LVTS
      See Also:
      Constant Field Values
  • Constructor Details

    • World

      protected World()
      Insert the primitives
  • Method Details

    • accept

      public void accept(Dump.IVisitor visitor)
      Dump processing when a fatal error occurs
      Specified by:
      accept in interface Dump.INode
    • resolve

      public ResolvedType resolve(UnresolvedType ty)
      Resolve a type that we require to be present in the world
    • resolve

      public ResolvedType resolve(UnresolvedType ty, ISourceLocation isl)
      Attempt to resolve a type - the source location gives you some context in which resolution is taking place. In the case of an error where we can't find the type - we can then at least report why (source location) we were trying to resolve it.
    • resolve

      public ResolvedType[] resolve(UnresolvedType[] types)
      Convenience method for resolving an array of unresolved types in one hit. Useful for e.g. resolving type parameters in signatures.
    • resolve

      public ResolvedType resolve(UnresolvedType ty, boolean allowMissing)
      Resolve a type. This the hub of type resolution. The resolved type is added to the type map by signature.
    • completeBinaryType

      protected void completeBinaryType(ResolvedType ret)
      Called when a type is resolved - enables its type hierarchy to be finished off before we proceed
    • isLocallyDefined

      public boolean isLocallyDefined(String classname)
      Return true if the classloader relating to this world is definetly the one that will define the specified class. Return false otherwise or we don't know for certain.
    • resolve

      public ResolvedType resolve(ResolvedType ty)
      Some TypeFactory operations create resolved types directly, but these won't be in the typeMap - this resolution process puts them there. Resolved types are also told their world which is needed for the special autoboxing resolved types.
    • resolve

      public ResolvedType resolve(String name)
      Convenience method for finding a type by name and resolving it in one step.
    • resolveToReferenceType

      public ReferenceType resolveToReferenceType(String name)
    • resolve

      public ResolvedType resolve(String name, boolean allowMissing)
    • resolveGenericTypeFor

      public ResolvedType resolveGenericTypeFor(UnresolvedType anUnresolvedType, boolean allowMissing)
      Attempt to resolve a type that should be a generic type.
    • resolveDelegate

      protected abstract ReferenceTypeDelegate resolveDelegate(ReferenceType ty)
      Find the ReferenceTypeDelegate behind this reference type so that it can fulfill its contract.
    • getCoreType

      public ResolvedType getCoreType(UnresolvedType tx)
      Special resolution for "core" types like OBJECT. These are resolved just like any other type, but if they are not found it is more serious and we issue an error message immediately.
    • lookupOrCreateName

      public ReferenceType lookupOrCreateName(UnresolvedType ty)
      Lookup a type by signature, if not found then build one and put it in the map.
    • lookupBySignature

      public ReferenceType lookupBySignature(String signature)
      Lookup a reference type in the world by its signature. Returns null if not found.
    • resolve

      public ResolvedMember resolve(Member member)
      Member resolution is achieved by resolving the declaring type and then looking up the member in the resolved declaring type.
    • setAllLintIgnored

      public void setAllLintIgnored()
    • areAllLintIgnored

      public boolean areAllLintIgnored()
    • getWeavingSupport

      public abstract IWeavingSupport getWeavingSupport()
    • createAdviceMunger

      public final Advice createAdviceMunger(AdviceKind kind, Pointcut p, Member signature, int extraParameterFlags, IHasSourceLocation loc, ResolvedType declaringAspect)
      Create an advice shadow munger for the given advice kind
    • compareByPrecedence

      public int compareByPrecedence(ResolvedType aspect1, ResolvedType aspect2)
      Same signature as org.aspectj.util.PartialOrder.PartialComparable.compareTo
    • getPrecedenceIfAny

      public Integer getPrecedenceIfAny(ResolvedType aspect1, ResolvedType aspect2)
    • compareByPrecedenceAndHierarchy

      public int compareByPrecedenceAndHierarchy(ResolvedType aspect1, ResolvedType aspect2)
      compares by precedence with the additional rule that a super-aspect is sorted before its sub-aspects
    • getMessageHandler

      public IMessageHandler getMessageHandler()
      Nobody should hold onto a copy of this message handler, or setMessageHandler won't work right.
    • setMessageHandler

      public void setMessageHandler(IMessageHandler messageHandler)
    • showMessage

      public void showMessage(IMessage.Kind kind, String message, ISourceLocation loc1, ISourceLocation loc2)
      convenenience method for creating and issuing messages via the message handler - if you supply two locations you will get two messages.
    • setCrossReferenceHandler

      public void setCrossReferenceHandler(ICrossReferenceHandler xrefHandler)
    • getCrossReferenceHandler

      public ICrossReferenceHandler getCrossReferenceHandler()
      Get the cross-reference handler for the world, may be null.
    • setTypeVariableLookupScope

      public void setTypeVariableLookupScope(TypeVariableDeclaringElement scope)
    • getTypeVariableLookupScope

      public TypeVariableDeclaringElement getTypeVariableLookupScope()
    • getDeclareParents

      public List<DeclareParents> getDeclareParents()
    • getDeclareAnnotationOnTypes

      public List<DeclareAnnotation> getDeclareAnnotationOnTypes()
    • getDeclareAnnotationOnFields

      public List<DeclareAnnotation> getDeclareAnnotationOnFields()
    • getDeclareAnnotationOnMethods

      public List<DeclareAnnotation> getDeclareAnnotationOnMethods()
    • getDeclareTypeEows

      public List<DeclareTypeErrorOrWarning> getDeclareTypeEows()
    • getDeclareSoft

      public List<DeclareSoft> getDeclareSoft()
    • getCrosscuttingMembersSet

      public CrosscuttingMembersSet getCrosscuttingMembersSet()
    • getModel

      public IStructureModel getModel()
    • setModel

      public void setModel(IStructureModel model)
    • getLint

      public Lint getLint()
    • setLint

      public void setLint(Lint lint)
    • isXnoInline

      public boolean isXnoInline()
    • setXnoInline

      public void setXnoInline(boolean xnoInline)
    • isXlazyTjp

      public boolean isXlazyTjp()
    • setXlazyTjp

      public void setXlazyTjp(boolean b)
    • isHasMemberSupportEnabled

      public boolean isHasMemberSupportEnabled()
    • setXHasMemberSupportEnabled

      public void setXHasMemberSupportEnabled(boolean b)
    • isInPinpointMode

      public boolean isInPinpointMode()
    • setPinpointMode

      public void setPinpointMode(boolean b)
    • useFinal

      public boolean useFinal()
    • isMinimalModel

      public boolean isMinimalModel()
    • isTargettingRuntime1_6_10

      public boolean isTargettingRuntime1_6_10()
    • setBehaveInJava5Way

      public void setBehaveInJava5Way(boolean b)
    • setTiming

      public void setTiming(boolean timersOn, boolean reportPeriodically)
      Set the timing option (whether to collect timing info), this will also need INFO messages turned on for the message handler being used. The reportPeriodically flag should be set to false under AJDT so numbers just come out at the end.
    • setErrorAndWarningThreshold

      public void setErrorAndWarningThreshold(boolean errorThreshold, boolean warningThreshold)
      Set the error and warning threashold which can be taken from CompilerOptions (see bug 129282)
      Parameters:
      errorThreshold -
      warningThreshold -
    • isIgnoringUnusedDeclaredThrownException

      public boolean isIgnoringUnusedDeclaredThrownException()
      Returns:
      true if ignoring the UnusedDeclaredThrownException and false if this compiler option is set to error or warning
    • performExtraConfiguration

      public void performExtraConfiguration(String config)
    • areInfoMessagesEnabled

      public boolean areInfoMessagesEnabled()
    • getExtraConfiguration

      public Properties getExtraConfiguration()
      may return null
    • isInJava5Mode

      public boolean isInJava5Mode()
    • isTimingEnabled

      public boolean isTimingEnabled()
    • setTargetAspectjRuntimeLevel

      public void setTargetAspectjRuntimeLevel(String s)
    • setOptionalJoinpoints

      public void setOptionalJoinpoints(String jps)
    • isJoinpointArrayConstructionEnabled

      public boolean isJoinpointArrayConstructionEnabled()
    • isJoinpointSynchronizationEnabled

      public boolean isJoinpointSynchronizationEnabled()
    • getTargetAspectjRuntimeLevel

      public RuntimeVersion getTargetAspectjRuntimeLevel()
    • isTargettingAspectJRuntime12

      public boolean isTargettingAspectJRuntime12()
    • validateType

      public void validateType(UnresolvedType type)
    • isDemotionActive

      public boolean isDemotionActive()
    • getTypeVariablesCurrentlyBeingProcessed

      public TypeVariable[] getTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass)
    • recordTypeVariablesCurrentlyBeingProcessed

      public void recordTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass, TypeVariable[] typeVariables)
    • forgetTypeVariablesCurrentlyBeingProcessed

      public void forgetTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass)
    • setAddSerialVerUID

      public void setAddSerialVerUID(boolean b)
    • isAddSerialVerUID

      public boolean isAddSerialVerUID()
    • flush

      public void flush()
      be careful calling this - pr152257
    • ensureAdvancedConfigurationProcessed

      public void ensureAdvancedConfigurationProcessed()
    • isRunMinimalMemory

      public boolean isRunMinimalMemory()
    • isTransientTjpFields

      public boolean isTransientTjpFields()
    • isRunMinimalMemorySet

      public boolean isRunMinimalMemorySet()
    • shouldFastPackMethods

      public boolean shouldFastPackMethods()
    • shouldPipelineCompilation

      public boolean shouldPipelineCompilation()
    • shouldGenerateStackMaps

      public boolean shouldGenerateStackMaps()
    • setIncrementalCompileCouldFollow

      public void setIncrementalCompileCouldFollow(boolean b)
    • couldIncrementalCompileFollow

      public boolean couldIncrementalCompileFollow()
    • setSynchronizationPointcutsInUse

      public void setSynchronizationPointcutsInUse()
    • areSynchronizationPointcutsInUse

      public boolean areSynchronizationPointcutsInUse()
    • registerPointcutHandler

      public void registerPointcutHandler(PointcutDesignatorHandler designatorHandler)
      Register a new pointcut designator handler with the world - this can be used by any pointcut parsers attached to the world.
      Parameters:
      designatorHandler - handler for the new pointcut
    • getRegisteredPointcutHandlers

      public Set<PointcutDesignatorHandler> getRegisteredPointcutHandlers()
    • reportMatch

      public void reportMatch(ShadowMunger munger, Shadow shadow)
    • isOverWeaving

      public boolean isOverWeaving()
    • reportCheckerMatch

      public void reportCheckerMatch(Checker checker, Shadow shadow)
    • isXmlConfigured

      public boolean isXmlConfigured()
      Returns:
      true if this world has the activation and scope of application of the aspects controlled via aop.xml files
    • isAspectIncluded

      public boolean isAspectIncluded(ResolvedType aspectType)
    • hasUnsatisfiedDependency

      public boolean hasUnsatisfiedDependency(ResolvedType aspectType)
      Determine if the named aspect requires a particular type around in order to be useful. The type is named in the aop.xml file against the aspect.
      Returns:
      true if there is a type missing that this aspect really needed around
    • getAspectScope

      public TypePattern getAspectScope(ResolvedType declaringType)
    • getFixed

      public Map<String,​ResolvedType> getFixed()
    • getExpendable

      public Map<String,​Reference<ResolvedType>> getExpendable()
    • demote

      public void demote()
      Ask the type map to demote any types it can - we don't want them anchored forever.
    • isExpendable

      protected boolean isExpendable(ResolvedType type)
      Reference types we don't intend to weave may be ejected from the cache if we need the space.
    • getExclusionMap

      public Map<ResolvedType,​Set<ResolvedType>> getExclusionMap()
    • record

      public void record(Pointcut pointcut, long timetaken)
      Record the time spent matching a pointcut - this will accumulate over the lifetime of this world/weaver and be reported every 25000 join points.
    • recordFastMatch

      public void recordFastMatch(Pointcut pointcut, long timetaken)
      Record the time spent fastmatching a pointcut - this will accumulate over the lifetime of this world/weaver and be reported every 250 types.
    • reportTimers

      public void reportTimers()
    • getTypeMap

      public World.TypeMap getTypeMap()
    • reset

      public static void reset()
    • getItdVersion

      public int getItdVersion()
      Returns the version of ITD that this world wants to create. The default is the new style (2) but in some cases where there might be a clash, the old style can be used. It is set through the option -Xset:itdVersion=1
      Returns:
      the ITD version this world wants to create - 1=oldstyle 2=new, transparent style
    • isLoadtimeWeaving

      public abstract boolean isLoadtimeWeaving()
    • classWriteEvent

      public void classWriteEvent(char[][] compoundName)