public static ConstructorMirrorMember make(MirrorWorld world, ConstructorMirror cons) {
    UnresolvedType declaringType = world.resolve(cons.getDeclaringClass());
    UnresolvedType returnType = declaringType;

    UnresolvedType[] parameterTypes = new UnresolvedType[cons.getParameterTypeNames().size()];
    for (int i = 0; i < parameterTypes.length; i++) {
      parameterTypes[i] = UnresolvedType.forName(cons.getParameterTypeNames().get(i));
    }

    return new ConstructorMirrorMember(
        cons, declaringType, cons.getModifiers(), returnType, "<init>", parameterTypes);
  }
 private void forAllWovenClasses(final Callback<ClassMirror> callback) {
   // TODO: reuse ShadowMunger.match() by faking a shadow
   final TypePattern scoped = world.getAspectScope(advice.getDeclaringType());
   world
       .vm
       .dispatch()
       .forAllClasses(
           new Callback<ClassMirror>() {
             public ClassMirror handle(ClassMirror klass) {
               if (scoped == null
                   || scoped.matches(world.resolve(klass), TypePattern.STATIC).alwaysTrue()) {
                 return callback.handle(klass);
               } else {
                 return klass;
               }
             }
           });
 }
  private void install(MirrorEventRequest request, Shadow.Kind kind, RequestContext context) {
    world.showMessage(IMessage.DEBUG, request.toString(), null, null);

    request.putProperty("for advice", advice);
    request.putProperty(SHADOW_KIND_PROPERTY_KEY, kind);
    world.vm.dispatch().addCallback(request, callback);

    if (OPTIMIZE_CFLOW && context.cflowCounterGuard != null) {
      // If guarded by a !cflow(...) pointcut, register this request so that the
      // cflowEntry advice will enable and disable it as the cflow pointcut is entered and left.
      List<MirrorEventRequest> guardedRequests =
          cflowGuardedRequests.get(context.cflowCounterGuard);
      if (guardedRequests == null) {
        guardedRequests = new ArrayList<MirrorEventRequest>();
        cflowGuardedRequests.put(context.cflowCounterGuard, guardedRequests);
      }

      guardedRequests.add(request);
    } else {
      // Otherwise enable it unconditionally
      request.enable();
    }
  }
 private void installRequest(RequestContext context) {
   AdviceKind adviceKind = advice.getKind();
   for (final Shadow.Kind kind : Shadow.toSet(context.kinds)) {
     switch (kind.bit) {
       case (Shadow.MethodExecutionBit):
       case (Shadow.MethodCallBit):
         // If there are no filters at all, it's much more efficient to create single request
         if (context.thisFilters.isEmpty()) {
           if (adviceKind == AdviceKind.Before || adviceKind.isCflow()) {
             addFiltersAndInstall(
                 manager.createMethodMirrorHandlerRequest(), context.thisFilters, kind, context);
           }
           if (adviceKind.isAfter()) {
             addFiltersAndInstall(
                 manager.createMethodMirrorHandlerRequest(), context.thisFilters, kind, context);
           }
           if (adviceKind == AdviceKind.Around) {
             addFiltersAndInstall(
                 manager.createMethodMirrorHandlerRequest(), context.thisFilters, kind, context);
           }
         } else {
           installMethodRequests(kind, context);
         }
         break;
       case (Shadow.ConstructorExecutionBit):
       case (Shadow.ConstructorCallBit):
         if (adviceKind == AdviceKind.Before || adviceKind.isCflow()) {
           addFiltersAndInstall(
               manager.createConstructorMirrorHandlerRequest(),
               context.thisFilters,
               kind,
               context);
         }
         if (adviceKind.isAfter()) {
           addFiltersAndInstall(
               manager.createConstructorMirrorHandlerRequest(),
               context.thisFilters,
               kind,
               context);
         }
         if (adviceKind == AdviceKind.Around) {
           addFiltersAndInstall(
               manager.createConstructorMirrorHandlerRequest(),
               context.thisFilters,
               kind,
               context);
         }
         break;
       case (Shadow.FieldSetBit):
       case (Shadow.FieldGetBit):
         installFieldRequests(kind, context);
         break;
       case Shadow.SynchronizationLockBit:
       case Shadow.SynchronizationUnlockBit:
         installSynchronizationRequests(kind, context);
         break;
       case Shadow.AdviceExecutionBit:
       case Shadow.InitializationBit:
       case Shadow.PreInitializationBit:
       case Shadow.ExceptionHandlerBit:
         world.showMessage(IMessage.WARNING, "Unsupported pointcut kind: " + kind, null, null);
         break;
     }
   }
 }
 public PointcutMirrorRequestExtractor(final MirrorWorld world, Advice advice) {
   this.advice = advice;
   this.world = world;
   this.callback = world.eventCallback();
   this.manager = world.vm.eventRequestManager();
 }