Class LTWWorld
java.lang.Object
org.aspectj.weaver.World
org.aspectj.weaver.bcel.BcelWorld
org.aspectj.weaver.ltw.LTWWorld
- All Implemented Interfaces:
Repository, Dump.INode, IReflectionWorld
- Author:
- adrian, Ron Bodkin For use in LT weaving Backed by both a BcelWorld and a ReflectionWorld Needs a callback when a woven class is defined This is the trigger for us to ditch the class from Bcel and cache it in the reflective world instead. Create by passing in a classloader, message handler
-
Nested Class Summary
Nested classes/interfaces inherited from class World
World.TypeMap -
Field Summary
FieldsFields inherited from class World
bcelRepositoryCaching, BOOLEAN, BYTE, CHAR, createInjarHierarchy, DOUBLE, FLOAT, forDEBUG_bridgingCode, forDEBUG_structuralChangesCode, generateNewLvts, infoMessagesEnabled, INT, LONG, optimizedMatching, RUNTIME_LEVEL_DEFAULT, SHORT, timersPerJoinpoint, timersPerType, typeMap, VOID, xsetAVOID_FINAL, xsetBCEL_REPOSITORY_CACHING, xsetBCEL_REPOSITORY_CACHING_DEFAULT, xsetCAPTURE_ALL_CONTEXT, xsetCOMPLETE_BINARY_TYPES, xsetCOMPLETE_BINARY_TYPES_DEFAULT, xsetDEBUG_BRIDGING, xsetDEBUG_STRUCTURAL_CHANGES_CODE, xsetFAST_PACK_METHODS, xsetGENERATE_NEW_LVTS, xsetGENERATE_STACKMAPS, xsetITD_VERSION, xsetITD_VERSION_2NDGEN, xsetITD_VERSION_DEFAULT, xsetITD_VERSION_ORIGINAL, xsetMINIMAL_MODEL, xsetOPTIMIZED_MATCHING, xsetOVERWEAVING, xsetPIPELINE_COMPILATION, xsetPIPELINE_COMPILATION_DEFAULT, xsetRUN_MINIMAL_MEMORY, xsetTARGETING_RUNTIME_1610, xsetTIMERS_PER_FASTMATCH_CALL, xsetTIMERS_PER_JOINPOINT, xsetTRANSIENT_TJP_FIELDS, xsetTYPE_DEMOTION, xsetTYPE_DEMOTION_DEBUG, xsetTYPE_REFS, xsetWEAVE_JAVA_PACKAGES, xsetWEAVE_JAVAX_PACKAGESModifier and TypeFieldDescriptionprotected booleanfinal org.aspectj.weaver.ResolvedType.Primitivefinal org.aspectj.weaver.ResolvedType.Primitivefinal org.aspectj.weaver.ResolvedType.Primitivestatic booleanShould we create the hierarchy for binary classes and aspectsfinal org.aspectj.weaver.ResolvedType.Primitivefinal org.aspectj.weaver.ResolvedType.Primitivebooleanbooleanbooleanintfinal org.aspectj.weaver.ResolvedType.Primitivefinal org.aspectj.weaver.ResolvedType.Primitivebooleanstatic final RuntimeVersionThe level of the aspectjrt.jar the code we generate needs to run onfinal org.aspectj.weaver.ResolvedType.Primitiveprotected longprotected longprotected World.TypeMapThe heart of the world, a map from type signatures to resolved typesfinal org.aspectj.weaver.ResolvedType.Primitivestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionLTWWorld(ClassLoader loader, IWeavingContext weavingContext, IMessageHandler handler, ICrossReferenceHandler xrefHandler) Build a World from a ClassLoader, for LTW support -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(Dump.IVisitor visitor) Dump processing when a fatal error occursprotected voidCalled when a type is resolved - enables its type hierarchy to be finished off before we proceedprotected ResolvedTypebooleanbooleanisLocallyDefined(String classname) Return true if the classloader relating to this world is definetly the one that will define the specified class.booleanvoidloadedClass(Class clazz) Remove this class from the typeMap.protected booleanprotected ReferenceTypeDelegateOverrideprotected ReferenceTypeDelegatevoidstoreClass(JavaClass clazz) Store the provided class under "clazz.getClassName()"Methods inherited from class BcelWorld
addAspectRequires, addPath, addScopedAspect, addSourceObjectType, addSourceObjectType, addSourceObjectType, addTypeDelegateResolver, buildBcelDelegate, classWriteEvent, clear, demote, determineRelKind, ensureRepositorySetup, findClass, fromBcel, getAspectScope, getBcelObjectType, getClassLoaderRepositoryFor, getModelAsAsmManager, getTypeMap, getWeavingSupport, getXmlConfiguration, hasUnsatisfiedDependency, isAspectIncluded, isXmlConfigured, loadClass, loadClass, makeBcelType, makeBcelType, makeBcelTypes, makeFieldJoinPointSignature, makeJoinPointSignatureForArrayConstruction, makeJoinPointSignatureForMethodInvocation, makeJoinPointSignatureForMonitorEnter, makeJoinPointSignatureForMonitorExit, makeJoinPointSignatureFromMethod, removeClass, reportCheckerMatch, reportMatch, resolve, setXmlConfigured, setXmlFiles, tidyUp, toString, validateType, weaveInterTypeDeclarationsModifier and TypeMethodDescriptionvoidaddAspectRequires(String aspectClassName, String requiredType) voidvoidaddScopedAspect(String name, String scope) Add a scoped aspects where the scoping was defined in an aop.xml file and this world is being used in a LTW configurationaddSourceObjectType(String classname, byte[] bytes, boolean artificial) addSourceObjectType(String classname, JavaClass jc, boolean artificial) addSourceObjectType(JavaClass jc, boolean artificial) voidaddTypeDelegateResolver(TypeDelegateResolver typeDelegateResolver) buildBcelDelegate(ReferenceType type, JavaClass jc, boolean artificial, boolean exposedToWeaver) voidclassWriteEvent(char[][] compoundName) voidclear()Clear all entries from cache.voiddemote(ResolvedType type) Force demote a type.determineRelKind(ShadowMunger munger) voidFind the class with the name provided, if the class isn't there, return NULL.static UnresolvedTypegetAspectScope(ResolvedType declaringType) static BcelObjectTypegetBcelObjectType(ResolvedType concreteAspect) Retrieve a bcel delegate for an aspect - this will return NULL if the delegate is an EclipseSourceType and not a BcelObjectType - this happens quite often when incrementally compiling.org.aspectj.weaver.bcel.BcelWorld.WeavingXmlConfigbooleanhasUnsatisfiedDependency(ResolvedType aspectType) Determine if the named aspect requires a particular type around in order to be useful.booleanisAspectIncluded(ResolvedType aspectType) booleanFind the JavaClass instance for the given run-time class objectFind the class with the name provided, if the class isn't there, make an attempt to load it.static TypemakeBcelType(String type) static TypemakeBcelType(UnresolvedType type) static Type[]makeBcelTypes(String[] types) static MembervoidremoveClass(JavaClass clazz) Remove class from repositoryvoidreportCheckerMatch(Checker checker, Shadow shadow) voidreportMatch(ShadowMunger munger, Shadow shadow) voidsetXmlConfigured(boolean b) voidsetXmlFiles(List<File> xmlFiles) These are aop.xml files that can be used to alter the aspects that actually apply from those passed in - and also their scope of application to other files in the system.voidtidyUp()toString()voidvalidateType(UnresolvedType type) The aim of this method is to make sure a particular type is 'ok'.protected voidMethods inherited from class World
areAllLintIgnored, areInfoMessagesEnabled, areSynchronizationPointcutsInUse, compareByPrecedence, compareByPrecedenceAndHierarchy, couldIncrementalCompileFollow, createAdviceMunger, demote, ensureAdvancedConfigurationProcessed, flush, forgetTypeVariablesCurrentlyBeingProcessed, getCoreType, getCrosscuttingMembersSet, getCrossReferenceHandler, getDeclareAnnotationOnFields, getDeclareAnnotationOnMethods, getDeclareAnnotationOnTypes, getDeclareParents, getDeclareSoft, getDeclareTypeEows, getExclusionMap, getExpendable, getExtraConfiguration, getFixed, getItdVersion, getLint, getMessageHandler, getModel, getPrecedenceIfAny, getRegisteredPointcutHandlers, getTargetAspectjRuntimeLevel, getTypeVariableLookupScope, getTypeVariablesCurrentlyBeingProcessed, isAddSerialVerUID, isDemotionActive, isExpendable, isHasMemberSupportEnabled, isIgnoringUnusedDeclaredThrownException, isInJava5Mode, isInPinpointMode, isJoinpointArrayConstructionEnabled, isJoinpointSynchronizationEnabled, isMinimalModel, isOverWeaving, isRunMinimalMemorySet, isTargettingAspectJRuntime12, isTargettingRuntime1_6_10, isTimingEnabled, isTransientTjpFields, isXlazyTjp, isXnoInline, lookupBySignature, lookupOrCreateName, performExtraConfiguration, record, recordFastMatch, recordTypeVariablesCurrentlyBeingProcessed, registerPointcutHandler, reportTimers, reset, resolve, resolve, resolve, resolve, resolve, resolve, resolve, resolve, resolveGenericTypeFor, resolveToReferenceType, setAddSerialVerUID, setAllLintIgnored, setBehaveInJava5Way, setCrossReferenceHandler, setErrorAndWarningThreshold, setIncrementalCompileCouldFollow, setLint, setMessageHandler, setModel, setOptionalJoinpoints, setPinpointMode, setSynchronizationPointcutsInUse, setTargetAspectjRuntimeLevel, setTiming, setTypeVariableLookupScope, setXHasMemberSupportEnabled, setXlazyTjp, setXnoInline, shouldFastPackMethods, shouldGenerateStackMaps, shouldPipelineCompilation, showMessage, useFinalModifier and TypeMethodDescriptionbooleanbooleanbooleanintcompareByPrecedence(ResolvedType aspect1, ResolvedType aspect2) Same signature as org.aspectj.util.PartialOrder.PartialComparable.compareTointcompareByPrecedenceAndHierarchy(ResolvedType aspect1, ResolvedType aspect2) compares by precedence with the additional rule that a super-aspect is sorted before its sub-aspectsbooleanfinal AdvicecreateAdviceMunger(AdviceKind kind, Pointcut p, Member signature, int extraParameterFlags, IHasSourceLocation loc, ResolvedType declaringAspect) Create an advice shadow munger for the given advice kindvoiddemote()Ask the type map to demote any types it can - we don't want them anchored forever.voidvoidflush()be careful calling this - pr152257voidforgetTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass) Special resolution for "core" types like OBJECT.Get the cross-reference handler for the world, may be null.may return nullgetFixed()intReturns the version of ITD that this world wants to create.getLint()Nobody should hold onto a copy of this message handler, or setMessageHandler won't work right.getModel()getPrecedenceIfAny(ResolvedType aspect1, ResolvedType aspect2) getTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass) booleanbooleanprotected booleanisExpendable(ResolvedType type) Reference types we don't intend to weave may be ejected from the cache if we need the space.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanlookupBySignature(String signature) Lookup a reference type in the world by its signature.Lookup a type by signature, if not found then build one and put it in the map.voidperformExtraConfiguration(String config) voidRecord the time spent matching a pointcut - this will accumulate over the lifetime of this world/weaver and be reported every 25000 join points.voidrecordFastMatch(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.voidrecordTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass, TypeVariable[] typeVariables) voidregisterPointcutHandler(PointcutDesignatorHandler designatorHandler) Register a new pointcut designator handler with the world - this can be used by any pointcut parsers attached to the world.voidstatic voidreset()Convenience method for finding a type by name and resolving it in one step.Member resolution is achieved by resolving the declaring type and then looking up the member in the resolved declaring type.resolve(ResolvedType ty) Some TypeFactory operations create resolved types directly, but these won't be in the typeMap - this resolution process puts them there.Resolve a type that we require to be present in the worldresolve(UnresolvedType[] types) Convenience method for resolving an array of unresolved types in one hit.resolve(UnresolvedType ty, boolean allowMissing) Resolve a type.resolve(UnresolvedType ty, ISourceLocation isl) Attempt to resolve a type - the source location gives you some context in which resolution is taking place.resolveGenericTypeFor(UnresolvedType anUnresolvedType, boolean allowMissing) Attempt to resolve a type that should be a generic type.resolveToReferenceType(String name) voidsetAddSerialVerUID(boolean b) voidvoidsetBehaveInJava5Way(boolean b) voidsetCrossReferenceHandler(ICrossReferenceHandler xrefHandler) voidsetErrorAndWarningThreshold(boolean errorThreshold, boolean warningThreshold) Set the error and warning threashold which can be taken from CompilerOptions (see bug 129282)voidsetIncrementalCompileCouldFollow(boolean b) voidvoidsetMessageHandler(IMessageHandler messageHandler) voidsetModel(IStructureModel model) voidvoidsetPinpointMode(boolean b) voidvoidvoidsetTiming(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.voidvoidsetXHasMemberSupportEnabled(boolean b) voidsetXlazyTjp(boolean b) voidsetXnoInline(boolean xnoInline) booleanbooleanbooleanvoidshowMessage(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.booleanuseFinal()
-
Field Details
-
concurrentMapClass
-
bootstrapTypes
-
-
Constructor Details
-
LTWWorld
public LTWWorld(ClassLoader loader, IWeavingContext weavingContext, IMessageHandler handler, ICrossReferenceHandler xrefHandler) Build a World from a ClassLoader, for LTW support
-
-
Method Details
-
getClassLoader
-
resolveDelegate
Override- Overrides:
resolveDelegatein classBcelWorld
-
resolveIfBootstrapDelegate
-
loadedClass
Remove this class from the typeMap. Call back to be made from a publishing class loader The class loader should, ideally, make this call on each not yet working- Parameters:
clazz-
-
getAnnotationFinder
- Specified by:
getAnnotationFinderin interfaceIReflectionWorld
-
resolve
- Specified by:
resolvein interfaceIReflectionWorld
-
isRunMinimalMemory
public boolean isRunMinimalMemory()- Overrides:
isRunMinimalMemoryin classWorld
-
completeBinaryType
Description copied from class:WorldCalled when a type is resolved - enables its type hierarchy to be finished off before we proceed- Overrides:
completeBinaryTypein classWorld
-
needsCompletion
protected boolean needsCompletion() -
isLocallyDefined
Description copied from class:WorldReturn 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.- Overrides:
isLocallyDefinedin classWorld
-
completeNonLocalType
-
storeClass
Description copied from interface:RepositoryStore the provided class under "clazz.getClassName()"- Specified by:
storeClassin interfaceRepository- Overrides:
storeClassin classBcelWorld
-
accept
Description copied from class:WorldDump processing when a fatal error occurs- Specified by:
acceptin interfaceDump.INode- Overrides:
acceptin classWorld
-
isLoadtimeWeaving
public boolean isLoadtimeWeaving()- Overrides:
isLoadtimeWeavingin classBcelWorld
-