code: public static Expression transformInlineConstants(final Expression exp) {
          if (exp instanceof PropertyExpression) {
              PropertyExpression pe = (PropertyExpression) exp;
              if (pe.getObjectExpression() instanceof ClassExpression) {
                  ClassExpression ce = (ClassExpression) pe.getObjectExpression();
                  ClassNode type = ce.getType();
                  FieldNode field = ClassNodeUtils.getField(type, pe.getPropertyAsString());
                  if (type.isEnum() && field != null && field.isEnum()) return exp;
                  Expression constant = findConstant(field);
                  if (constant != null) return constant;
              }
          } else if (exp instanceof BinaryExpression) {
              BinaryExpression be = (BinaryExpression) exp;
              be.setLeftExpression(transformInlineConstants(be.getLeftExpression()));
              be.setRightExpression(transformInlineConstants(be.getRightExpression()));
              return be;
          } else if (exp instanceof ListExpression) {
              ListExpression origList = (ListExpression) exp;
              ListExpression newList = new ListExpression();
              boolean changed = false;
              for (Expression e : origList.getExpressions()) {
                  Expression transformed = transformInlineConstants(e);
                  newList.addExpression(transformed);
                  if (transformed != e) changed = true;
              }
              if (changed) {
                  newList.setSourcePosition(origList);
                  return newList;
              }
              return origList;
          }
  
          return exp;
      }
docs: The attribute values of annotations must be primitive, String or Enum constants.
  In various places, such constants can be seen during type resolution but won't be
  readily accessible in later phases, e.g. they might be embedded into constructor code.
  This method transforms constants that would appear in annotations early so they aren't lost.
  Subsequent processing determines whether they are valid, this method simply retains
  the constant value as a constant expression.
  
  @param exp the original expression
  @return the converted expression