@Override public void visit(Instanceof i) { ReflectionVar v = (ReflectionVar) i.getVar(); Object varUnderTest = v.getBindingAtJoinPoint(this.thisObj, this.targetObj, this.argsObjs); if (varUnderTest == this.thisObj || varUnderTest == this.targetObj) { this.testsSubtypeSensitiveVars = true; } }
@Override public void visit(Instanceof i) { int varType = getVarType((ReflectionVar) i.getVar()); if (varType != this.matchVarType) { return;
@Override public void visit(Instanceof i) { ReflectionVar v = (ReflectionVar) i.getVar(); Object varUnderTest = v.getBindingAtJoinPoint(this.thisObj, this.targetObj, this.argsObjs); if (varUnderTest == this.thisObj || varUnderTest == this.targetObj) { this.testsSubtypeSensitiveVars = true; } }
@Override public void visit(Instanceof i) { ReflectionVar v = (ReflectionVar) i.getVar(); Object varUnderTest = v.getBindingAtJoinPoint(this.thisObj, this.targetObj, this.argsObjs); if (varUnderTest == this.thisObj || varUnderTest == this.targetObj) { this.testsSubtypeSensitiveVars = true; } }
@Override public void visit(Instanceof i) { int varType = getVarType((ReflectionVar) i.getVar()); if (varType != this.matchVarType) { return;
@Override public void visit(Instanceof i) { int varType = getVarType((ReflectionVar) i.getVar()); if (varType != this.matchVarType) { return;
public void visit(Instanceof instanceofTest) { ReflectionVar v = (ReflectionVar) instanceofTest.getVar(); Object value = v.getBindingAtJoinPoint(thisObject, targetObject, args); World world = v.getType().getWorld(); ResolvedType desiredType = instanceofTest.getType().resolve(world); if (value == null) { matches = false; } else { ResolvedType actualType = world.resolve(value.getClass().getName()); matches = desiredType.isAssignableFrom(actualType); } }
public void visit(Instanceof i) { ReflectionVar v = (ReflectionVar) i.getVar(); Object value = v.getBindingAtJoinPoint(thisObject, targetObject, args); World world = v.getType().getWorld(); ResolvedType desiredType = i.getType().resolve(world); ResolvedType actualType = world.resolve(value.getClass().getName()); matches = desiredType.isAssignableFrom(actualType); }
public void visit(HasAnnotation hasAnnotation) { // in Java: // foo.class.isAnnotationPresent(annotationClass); // in bytecode: // ifnull? skip to the end if it is as getClass() will fail (see pr 257833) // load var onto the stack (done for us later) // invokevirtual java/lang/Object.getClass:()Ljava/lang/Class // ldc_w annotationClass // invokevirtual java/lang/Class.isAnnotationPresent:(Ljava/lang/Class;)Z InstructionList il = new InstructionList(); // If it is null jump past the advice call il.append(InstructionFactory.createBranchInstruction(Constants.IFNULL, fk)); // Load up the var again il.append(((BcelVar) hasAnnotation.getVar()).createLoad(fact)); Member getClass = MemberImpl.method(UnresolvedType.OBJECT, 0, UnresolvedType.JL_CLASS, "getClass", UnresolvedType.NONE); il.append(Utility.createInvoke(fact, world, getClass)); // aload annotationClass il.append(fact.createConstant(new ObjectType(hasAnnotation.getAnnotationType().getName()))); // int annClassIndex = fact.getConstantPool().addClass(hasAnnotation.getAnnotationType().getSignature()); // il.append(new LDC_W(annClassIndex)); Member isAnnotationPresent = MemberImpl.method(UnresolvedType.JL_CLASS, 0, UnresolvedType.BOOLEAN, "isAnnotationPresent", new UnresolvedType[] { UnresolvedType.JL_CLASS }); il.append(Utility.createInvoke(fact, world, isAnnotationPresent)); il.append(createJumpBasedOnBooleanOnStack()); instructions.insert(il); hasAnnotation.getVar().accept(this); }