/** Get the appropriate default value per JLS 4.5.4 */ public static Primitive getDefaultValue( Class type ) { if ( type == null || !type.isPrimitive() ) return Primitive.NULL; if ( type == Boolean.TYPE ) return new Primitive( false ); // non boolean primitive, get appropriate flavor of zero try { return new Primitive((int)0).castToType( type, Types.CAST ); } catch ( UtilEvalError e ) { throw new InterpreterError( "bad cast" ); } }
if( Types.Suffix.isIntegral(ch) ) jjtn000.value = parseIntegral(literal.substring(0, last)) .castToType(Types.Suffix.getIntegralType(ch), 0); else jjtn000.value = Primitive.shrinkWrap(parseIntegral(literal).getValue()); if( Types.Suffix.isFloatingPoint(ch) ) jjtn000.value = new Primitive(new java.math.BigDecimal(literal.substring(0, last))) .castToType(Types.Suffix.getFloatingPointType(ch), 0); else jjtn000.value = Primitive.shrinkWrap( new java.math.BigDecimal( literal ) );