aspect InvPCD{ public Pointcut ArgsInvPointcutExpr.pointcut(){ java.util.List arg_patterns = new ArrayList(); for(int i = 0; i < getNumPattern(); i++){ ArgPattern ap = getPattern(i).argPattern(); if(ap instanceof ArgVar){ ap = new abc.ja.jpi.weaving.ArgVarInv(((ArgVar) ap).getVar(), ap.getPosition()); } if(ap instanceof ArgType){ ap = new abc.ja.jpi.weaving.ArgTypeInv(((ArgType) ap).getType(), ap.getPosition()); } arg_patterns.add(ap); } return new abc.ja.jpi.weaving.ArgsInv(arg_patterns, pos()); } public Pointcut TargetInvPointcutExpr.pointcut(){ Pointcut pc = getPattern().targetPointcut(); return (pc instanceof TargetVar) ? new abc.ja.jpi.weaving.TargetVarInv(((TargetVar) pc).getVar(),pc.getPosition()) : new abc.ja.jpi.weaving.TargetTypeInv(((TargetType) pc).getType(),pc.getPosition()); } public Pointcut ThisInvPointcutExpr.pointcut(){ Pointcut pc = getPattern().thisPointcut(); return (pc instanceof ThisVar) ? new abc.ja.jpi.weaving.ThisVarInv(((ThisVar) pc).getVar(),pc.getPosition()) : new abc.ja.jpi.weaving.ThisTypeInv(((ThisType) pc).getType(),pc.getPosition()); } syn lazy boolean PointcutExpr.isInvPCD() = true; eq BinaryPointcutExpr.isInvPCD(){ return getLhs().isInvPCD() && getRhs().isInvPCD(); } eq ArgsPointcutExpr.isInvPCD() = false; eq TargetPointcutExpr.isInvPCD() = false; eq ThisPointcutExpr.isInvPCD() = false; eq ArgsInvPointcutExpr.isInvPCD() = true; eq TargetInvPointcutExpr.isInvPCD() = true; eq ThisInvPointcutExpr.isInvPCD() = true; public void PointcutExpr.checkInterfaceTypeInvPCD(){} public void BinaryPointcutExpr.checkInterfaceTypeInvPCD(){ getLhs().checkInterfaceTypeInvPCD(); getRhs().checkInterfaceTypeInvPCD(); } public void ArgsInvPointcutExpr.checkInterfaceTypeInvPCD(){ java.util.List arg_patterns = new ArrayList(); for(int i = 0; i < getNumPattern(); i++){ ArgPattern ap = getPattern(i).argPattern(); if(ap instanceof ArgVar){ if (getPattern(i) instanceof NameBindingPattern){ if( ((NameBindingPattern)getPattern(i)).getPattern() instanceof ExplicitTypeNamePattern){ if(((ExplicitTypeNamePattern)((NameBindingPattern)getPattern(i)).getPattern()).type().isInterfaceDecl()){ warning("argsinv pointcut will be treated as an args pointcut due to the interface type."); } } } } if(ap instanceof ArgType){ if (getPattern(i) instanceof NameBindingPattern){ if( ((NameBindingPattern)getPattern(i)).getPattern() instanceof ExplicitTypeNamePattern){ if(((ExplicitTypeNamePattern)((NameBindingPattern)getPattern(i)).getPattern()).getAccess().type().isInterfaceDecl()){ warning("argsinv pointcut will be treated as an args pointcut due to the interface type."); } } } } } } public void ThisInvPointcutExpr.checkInterfaceTypeInvPCD(){ Pointcut pc = getPattern().thisPointcut(); if (pc instanceof ThisVar){ if (getPattern() instanceof NameBindingPattern){ if( ((NameBindingPattern)getPattern()).getPattern() instanceof ExplicitTypeNamePattern){ if(((ExplicitTypeNamePattern)((NameBindingPattern)getPattern()).getPattern()).type().isInterfaceDecl()){ warning("thisinv pointcut will be treated as an this pointcut due to the interface type."); } } } } else{ if (getPattern() instanceof NameBindingPattern){ if( ((NameBindingPattern)getPattern()).getPattern() instanceof ExplicitTypeNamePattern){ if(((ExplicitTypeNamePattern)((NameBindingPattern)getPattern()).getPattern()).getAccess().type().isInterfaceDecl()){ warning("thisinv pointcut will be treated as an this pointcut due to the interface type."); } } } } } public void TargetInvPointcutExpr.checkInterfaceTypeInvPCD(){ Pointcut pc = getPattern().targetPointcut(); if (pc instanceof TargetVar){ if (getPattern() instanceof NameBindingPattern){ if( ((NameBindingPattern)getPattern()).getPattern() instanceof ExplicitTypeNamePattern){ if(((ExplicitTypeNamePattern)((NameBindingPattern)getPattern()).getPattern()).type().isInterfaceDecl()){ warning("targetinv pointcut will be treated as an target pointcut due to the interface type."); } } } } else{ if (getPattern() instanceof NameBindingPattern){ if( ((NameBindingPattern)getPattern()).getPattern() instanceof ExplicitTypeNamePattern){ if(((ExplicitTypeNamePattern)((NameBindingPattern)getPattern()).getPattern()).getAccess().type().isInterfaceDecl()){ warning("targetinv pointcut will be treated as an target pointcut due to the interface type."); } } } } } }