private void invokeImpl(@NotNull PsiClass targetClass) {
    PsiNameValuePair nameValuePair = getNameValuePair();
    if (nameValuePair == null || isValidElement(nameValuePair)) return;

    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(nameValuePair.getProject());

    final String methodName = ObjectUtils.notNull(nameValuePair.getName(), PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME);
    LOG.assertTrue(methodName != null);

    PsiMethod method = factory.createMethod(methodName, PsiTypes.voidType());

    method = (PsiMethod)targetClass.add(method);

    PsiCodeBlock body = method.getBody();
    assert body != null;
    body.delete();
    
    final PsiElement context = PsiTreeUtil.getParentOfType(nameValuePair, PsiClass.class, PsiMethod.class);

    final PsiType type = getAnnotationValueType(nameValuePair.getValue());
    LOG.assertTrue(type != null);
    final ExpectedTypeInfo[] expectedTypes =
      new ExpectedTypeInfo[]{ExpectedTypesProvider.createInfo(type, ExpectedTypeInfo.TYPE_OR_SUBTYPE, type, TailTypes.noneType())};
    CreateMethodFromUsageFix.doCreate(targetClass, method, true, Collections.emptyList(), 
                                      getTargetSubstitutor(nameValuePair), expectedTypes, context);
  }
private void invokeImpl(@NotNull PsiClass targetClass)