@Override
 public void visit(Tree.MethodDeclaration d) {
   if (isAnnotationConstructor(d) && d.getSpecifierExpression() != null) {
     annotationConstructor = d;
     instantiation = new AnnotationInvocation();
     instantiation.setConstructorDeclaration(d.getDeclarationModel());
     d.getDeclarationModel().setAnnotationConstructor(instantiation);
   }
   super.visit(d);
   if (isAnnotationConstructor(d) && d.getSpecifierExpression() != null) {
     instantiation = null;
     annotationConstructor = null;
   }
 }
  public void defaultedParameter(Tree.SpecifierOrInitializerExpression d) {
    if (annotationConstructor != null) {
      AnnotationConstructorParameter annotationConstructorParameter =
          instantiation
              .getConstructorParameters()
              .get(instantiation.getConstructorParameters().size() - 1);

      Declaration t = d.getUnit().getTrueValueDeclaration();
      Declaration f = d.getUnit().getFalseValueDeclaration();
      Term term = d.getExpression().getTerm();
      if (term instanceof Tree.InvocationExpression) {
        Tree.Primary primary = ((Tree.InvocationExpression) term).getPrimary();
        if (primary instanceof Tree.BaseMemberOrTypeExpression
            && (isAnnotationConstructor(
                    ((Tree.BaseMemberOrTypeExpression) primary).getDeclaration())
                || isAnnotationClass(
                    ((Tree.BaseMemberOrTypeExpression) primary).getDeclaration()))) {
          final AnnotationInvocation prevInstantiation = this.instantiation;
          this.instantiation = new AnnotationInvocation();
          if (isAnnotationConstructor(
              ((Tree.BaseMemberOrTypeExpression) primary).getDeclaration())) {
            Method constructor =
                (Method) ((Tree.BaseMemberOrTypeExpression) primary).getDeclaration();
            instantiation.setConstructorDeclaration(constructor);
            instantiation
                .getConstructorParameters()
                .addAll(
                    ((AnnotationInvocation) constructor.getAnnotationConstructor())
                        .getConstructorParameters());
          }
          checkingDefaults = true;

          super.visit(d);

          annotationConstructorParameter.setDefaultArgument(this.term);
          this.term = null;
          checkingDefaults = false;
          this.instantiation = prevInstantiation;
        } else {
          errorDefaultedParameter(d);
        }
      } else if (term instanceof Tree.Literal
          || (term instanceof Tree.BaseMemberExpression
              && (((Tree.BaseMemberExpression) term).getDeclaration().equals(t)
                  || ((Tree.BaseMemberExpression) term).getDeclaration().equals(f)
                  || ((Tree.BaseMemberExpression) term).getDeclaration().isParameter()
                  || Decl.isAnonCaseOfEnumeratedType((Tree.BaseMemberExpression) term)))) {
        checkingDefaults = true;

        super.visit(d);

        annotationConstructorParameter.setDefaultArgument(this.term);
        this.term = null;
        checkingDefaults = false;
      } else if (term instanceof Tree.Tuple || term instanceof Tree.SequenceEnumeration) {
        // TODO Tuples and SequenceEnumerations of the above cases should also be allowed
        checkingDefaults = true;

        super.visit(d);

        annotationConstructorParameter.setDefaultArgument(this.term);
        this.term = null;
        checkingDefaults = false;
      } else {
        errorDefaultedParameter(d);
      }
    }
  }