11/*
2- * Copyright (c) 2003, 2019 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2003, 2022 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -229,22 +229,22 @@ public class Basic$Type$ extends Basic {
229229#end[dec]
230230#if[Byte]
231231 private static $type$ negate($type$ v) {
232- return new $type$(( byte) -v.byteValue() );
232+ return ( byte) -v.byteValue();
233233 }
234234#end[Byte]
235235#if[Short]
236236 private static $type$ negate($type$ v) {
237- return new $type$(( short) -v.shortValue() );
237+ return ( short) -v.shortValue();
238238 }
239239#end[Short]
240240#if[Integer]
241241 private static $type$ negate($type$ v) {
242- return new $type$( -v.intValue() );
242+ return -v.intValue();
243243 }
244244#end[Integer]
245245#if[Long]
246246 private static $type$ negate($type$ v) {
247- return new $type$( -v.longValue() );
247+ return -v.longValue();
248248 }
249249#end[Long]
250250
@@ -284,19 +284,19 @@ public class Basic$Type$ extends Basic {
284284#end[float]
285285#if[Float]
286286 private static $type$ create(double v) {
287- return new $type$(v) ;
287+ return (float) v ;
288288 }
289289
290290 private static $type$ negate($type$ v) {
291- return new $type$( -v.floatValue() );
291+ return -v.floatValue();
292292 }
293293
294294 private static $type$ mult($type$ v, double mul) {
295- return new $type$( v.floatValue() * (float) mul) ;
295+ return v.floatValue() * (float) mul;
296296 }
297297
298298 private static $type$ recip($type$ v) {
299- return new $type$( 1.0f / v.floatValue() );
299+ return 1.0f / v.floatValue();
300300 }
301301#end[Float]
302302#if[double]
@@ -319,19 +319,19 @@ public class Basic$Type$ extends Basic {
319319#end[double]
320320#if[Double]
321321 private static $type$ create(double v) {
322- return new $type$(v) ;
322+ return v ;
323323 }
324324
325325 private static $type$ negate($type$ v) {
326- return new $type$( -v.doubleValue() );
326+ return -v.doubleValue();
327327 }
328328
329329 private static $type$ mult($type$ v, double mul) {
330- return new $type$( v.doubleValue() * mul) ;
330+ return v.doubleValue() * mul;
331331 }
332332
333333 private static $type$ recip($type$ v) {
334- return new $type$( 1.0 / v.doubleValue() );
334+ return 1.0 / v.doubleValue();
335335 }
336336#end[Double]
337337
@@ -435,7 +435,7 @@ public class Basic$Type$ extends Basic {
435435 test("%-4c", "i ", 'i');
436436 test("%4C", " I", 'i');
437437 test("%-4C", "I ", 'i');
438- test("%c", "i", new Character('i'));
438+ test("%c", "i", Character.valueOf ('i'));
439439 test("%c", "H", (byte) 72);
440440 test("%c", "i", (short) 105);
441441 test("%c", "!", (int) 33);
@@ -493,7 +493,7 @@ public class Basic$Type$ extends Basic {
493493 tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0);
494494 tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
495495 tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
496- tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
496+ tryCatch("%#s", FormatFlagsConversionMismatchException.class, (Object) null);
497497
498498 //---------------------------------------------------------------------
499499 // %h
@@ -521,11 +521,21 @@ public class Basic$Type$ extends Basic {
521521 tryCatch("%#g", FormatFlagsConversionMismatchException.class);
522522
523523#if[dec]
524-
525524#if[prim]
526525 $type$ minByte = Byte.MIN_VALUE; // -128
527526#else[prim]
528- $type$ minByte = new $type$(Byte.MIN_VALUE);
527+ #if[Short]
528+ $type$ minByte = (short) Byte.MIN_VALUE;
529+ #end[Short]
530+ #if[Byte]
531+ $type$ minByte = Byte.MIN_VALUE;
532+ #end[Byte]
533+ #if[Integer]
534+ $type$ minByte = (int) Byte.MIN_VALUE;
535+ #end[Integer]
536+ #if[Long]
537+ $type$ minByte = (long) Byte.MIN_VALUE;
538+ #end[Long]
529539#end[prim]
530540
531541 //---------------------------------------------------------------------
@@ -886,9 +896,9 @@ public class Basic$Type$ extends Basic {
886896 //---------------------------------------------------------------------
887897 // %s - Float
888898 //---------------------------------------------------------------------
889- $type$ one = new $type$( 1.0f) ;
890- $type$ ten = new $type$( 10.0f) ;
891- $type$ pi = new $type$( Math.PI) ;
899+ $type$ one = 1.0f;
900+ $type$ ten = 10.0f;
901+ $type$ pi = (float) Math.PI;
892902
893903 test("%s", "3.1415927", pi);
894904#end[Float]
@@ -906,9 +916,9 @@ public class Basic$Type$ extends Basic {
906916 //---------------------------------------------------------------------
907917 // %s - Double
908918 //---------------------------------------------------------------------
909- $type$ one = new $type$(1.0) ;
910- $type$ ten = new $type$( 10.0) ;
911- $type$ pi = new $type$( Math.PI) ;
919+ $type$ one = 1.0d ;
920+ $type$ ten = 10.0d ;
921+ $type$ pi = (double) Math.PI;
912922
913923 test("%s", "3.141592653589793", pi);
914924#end[Double]
0 commit comments