Package org.aspectj.weaver.bcel
Class Utility
java.lang.Object
org.aspectj.weaver.bcel.Utility
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
For testing purposes: bit clunky but does work -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendConversion(InstructionList il, InstructionFactory fact, ResolvedType fromType, ResolvedType toType)
static Attribute
bcelAttribute(AjAttribute a, ConstantPool pool)
static String
static Instruction
Fix for Bugzilla #39479, #40109 patch contributed by Andy Clement Need to manually copy Select instructions - if we rely on the the 'fresh' object created by copy(), the InstructionHandle array 'targets' inside the Select object will not have been deep copied, so modifying targets in fresh will modify the original Select - not what we want !static Instruction
createConstant(InstructionFactory fact, int value)
static InstructionList
createConversion(InstructionFactory factory, Type fromType, Type toType)
static InstructionList
createConversion(InstructionFactory fact, Type fromType, Type toType, boolean allowAutoboxing)
static Instruction
createGet(InstructionFactory fact, Member signature)
static Instruction
createInstanceof(InstructionFactory fact, ReferenceType t)
static Instruction
createInvoke(InstructionFactory fact, short kind, Member member)
Create an invoke instructionstatic Instruction
createInvoke(InstructionFactory fact, BcelWorld world, Member signature)
static Instruction
createInvoke(InstructionFactory fact, LazyMethodGen m)
static Instruction
createSet(InstructionFactory fact, Member signature)
static Instruction
createSuperInvoke(InstructionFactory fact, BcelWorld world, Member signature)
static void
deleteInstruction(InstructionHandle ih, InstructionHandle retargetTo, LazyMethodGen enclosingMethod)
delete an instruction handle and retarget all targeters of the deleted instruction to the provided target.static void
deleteInstruction(InstructionHandle ih, LazyMethodGen enclosingMethod)
delete an instruction handle and retarget all targeters of the deleted instruction to the next instruction.static int
returns -1 if no source line attributegetSuppressedWarnings(AnnotationAJ[] anns, Lint lint)
static boolean
static boolean
isSuppressing(Member member, String lintkey)
Checks for suppression specified on the member or on the declaring type of that memberstatic String[]
makeArgNames(int n)
static JavaClass
makeJavaClass(String filename, byte[] bytes)
static int
makePublic(int i)
static BcelVar[]
pushAndReturnArrayOfVars(ResolvedType[] proceedParamTypes, InstructionList il, InstructionFactory fact, LazyMethodGen enclosingMethod)
static List<AjAttribute>
readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w, AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor)
static void
replaceInstruction(InstructionHandle ih, InstructionList replacementInstructions, LazyMethodGen enclosingMethod)
replace an instruction handle with another instruction, in this case, a branch instruction.static void
setSourceLine(InstructionHandle ih, int lineNumber)
-
Field Details
-
testingParseCounter
public static int testingParseCounterFor testing purposes: bit clunky but does work
-
-
Constructor Details
-
Utility
public Utility()
-
-
Method Details
-
readAjAttributes
public static List<AjAttribute> readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w, AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) -
beautifyLocation
-
createSuperInvoke
public static Instruction createSuperInvoke(InstructionFactory fact, BcelWorld world, Member signature) -
createInvoke
-
createGet
-
createSet
-
createInstanceof
-
createInvoke
-
createInvoke
Create an invoke instruction- Parameters:
fact
-kind
- INVOKEINTERFACE, INVOKEVIRTUAL..member
-- Returns:
-
makeArgNames
-
appendConversion
public static void appendConversion(InstructionList il, InstructionFactory fact, ResolvedType fromType, ResolvedType toType) -
createConversion
public static InstructionList createConversion(InstructionFactory factory, Type fromType, Type toType) -
createConversion
public static InstructionList createConversion(InstructionFactory fact, Type fromType, Type toType, boolean allowAutoboxing) -
createConstant
-
makeJavaClass
-
replaceInstruction
public static void replaceInstruction(InstructionHandle ih, InstructionList replacementInstructions, LazyMethodGen enclosingMethod)replace an instruction handle with another instruction, in this case, a branch instruction.- Parameters:
ih
- the instruction handle to replace.replacementInstructions
- the branch instruction to replace ih withenclosingMethod
- where to find ih's instruction list.
-
deleteInstruction
delete an instruction handle and retarget all targeters of the deleted instruction to the next instruction. Obviously, this should not be used to delete a control transfer instruction unless you know what you're doing.- Parameters:
ih
- the instruction handle to delete.enclosingMethod
- where to find ih's instruction list.
-
deleteInstruction
public static void deleteInstruction(InstructionHandle ih, InstructionHandle retargetTo, LazyMethodGen enclosingMethod)delete an instruction handle and retarget all targeters of the deleted instruction to the provided target.- Parameters:
ih
- the instruction handle to deleteretargetTo
- the instruction handle to retarget targeters of ih to.enclosingMethod
- where to find ih's instruction list.
-
copyInstruction
Fix for Bugzilla #39479, #40109 patch contributed by Andy Clement Need to manually copy Select instructions - if we rely on the the 'fresh' object created by copy(), the InstructionHandle array 'targets' inside the Select object will not have been deep copied, so modifying targets in fresh will modify the original Select - not what we want ! (It is a bug in BCEL to do with cloning Select objects).declare error: call(* Instruction.copy()) && within(org.aspectj.weaver) && !withincode(* Utility.copyInstruction(Instruction)): "use Utility.copyInstruction to work-around bug in Select.copy()";
-
getSourceLine
returns -1 if no source line attribute -
setSourceLine
-
makePublic
public static int makePublic(int i) -
pushAndReturnArrayOfVars
public static BcelVar[] pushAndReturnArrayOfVars(ResolvedType[] proceedParamTypes, InstructionList il, InstructionFactory fact, LazyMethodGen enclosingMethod) -
isConstantPushInstruction
-
isSuppressing
Checks for suppression specified on the member or on the declaring type of that member -
getSuppressedWarnings
-
bcelAttribute
-