private static Object convertConstant(Number source, ClassNode target) {
   if (ClassHelper.Byte_TYPE.equals(target)) {
     return source.byteValue();
   }
   if (ClassHelper.Short_TYPE.equals(target)) {
     return source.shortValue();
   }
   if (ClassHelper.Integer_TYPE.equals(target)) {
     return source.intValue();
   }
   if (ClassHelper.Long_TYPE.equals(target)) {
     return source.longValue();
   }
   if (ClassHelper.Float_TYPE.equals(target)) {
     return source.floatValue();
   }
   if (ClassHelper.Double_TYPE.equals(target)) {
     return source.doubleValue();
   }
   if (ClassHelper.BigInteger_TYPE.equals(target)) {
     return DefaultGroovyMethods.asType(source, BigInteger.class);
   }
   if (ClassHelper.BigDecimal_TYPE.equals(target)) {
     return DefaultGroovyMethods.asType(source, BigDecimal.class);
   }
   throw new IllegalArgumentException("Unsupported conversion");
 }
  private void printField(PrintWriter out, FieldNode fieldNode, boolean isInterface) {
    if ((fieldNode.getModifiers() & Opcodes.ACC_PRIVATE) != 0) return;
    printAnnotations(out, fieldNode);
    if (!isInterface) {
      printModifiers(out, fieldNode.getModifiers());
    }

    ClassNode type = fieldNode.getType();
    printType(out, type);

    out.print(" ");
    out.print(fieldNode.getName());
    if (isInterface || (fieldNode.getModifiers() & Opcodes.ACC_FINAL) != 0) {
      out.print(" = ");
      Expression valueExpr = fieldNode.getInitialValueExpression();
      if (valueExpr instanceof ConstantExpression) {
        valueExpr = Verifier.transformToPrimitiveConstantIfPossible((ConstantExpression) valueExpr);
      }
      if (valueExpr instanceof ConstantExpression
          && fieldNode.isStatic()
          && fieldNode.isFinal()
          && ClassHelper.isStaticConstantInitializerType(valueExpr.getType())
          && valueExpr.getType().equals(fieldNode.getType())) {
        // GROOVY-5150 : Initialize value with a dummy constant so that Java cross compiles
        // correctly
        if (ClassHelper.STRING_TYPE.equals(valueExpr.getType())) {
          out.print("\"" + escapeSpecialChars(valueExpr.getText()) + "\"");
        } else if (ClassHelper.char_TYPE.equals(valueExpr.getType())) {
          out.print("'" + valueExpr.getText() + "'");
        } else {
          ClassNode constantType = valueExpr.getType();
          out.print('(');
          printType(out, type);
          out.print(") ");
          out.print(valueExpr.getText());
          if (ClassHelper.Long_TYPE.equals(ClassHelper.getWrapper(constantType))) out.print('L');
        }
      } else if (ClassHelper.isPrimitiveType(type)) {
        String val = type == ClassHelper.boolean_TYPE ? "false" : "0";
        out.print("new " + ClassHelper.getWrapper(type) + "((" + type + ")" + val + ")");
      } else {
        out.print("null");
      }
    }
    out.println(";");
  }