mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
Use primitive types in NativeTypes (#3501)
This commit is contained in:
parent
6830258f77
commit
90a3ce0b46
@ -270,11 +270,11 @@ public class NativeTypes {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void parse(String val, int radix) {
|
void parse(String val, int radix) {
|
||||||
Double d = Double.parseDouble( radix == 16 ? "0x" + val : val );
|
double d = Double.parseDouble( radix == 16 ? "0x" + val : val );
|
||||||
if ( doubleHasBecomeZero( d ) ) {
|
if ( doubleHasBecomeZero( d ) ) {
|
||||||
throw new NumberFormatException( "floating point number too small" );
|
throw new NumberFormatException( "floating point number too small" );
|
||||||
}
|
}
|
||||||
if ( d.isInfinite() ) {
|
if ( Double.isInfinite( d ) ) {
|
||||||
throw new NumberFormatException( "infinitive is not allowed" );
|
throw new NumberFormatException( "infinitive is not allowed" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,11 +297,11 @@ public class NativeTypes {
|
|||||||
NumberRepresentation br = new NumberRepresentation( s, false, false, true ) {
|
NumberRepresentation br = new NumberRepresentation( s, false, false, true ) {
|
||||||
@Override
|
@Override
|
||||||
void parse(String val, int radix) {
|
void parse(String val, int radix) {
|
||||||
Float f = Float.parseFloat( radix == 16 ? "0x" + val : val );
|
float f = Float.parseFloat( radix == 16 ? "0x" + val : val );
|
||||||
if ( doubleHasBecomeZero( f ) ) {
|
if ( doubleHasBecomeZero( f ) ) {
|
||||||
throw new NumberFormatException( "floating point number too small" );
|
throw new NumberFormatException( "floating point number too small" );
|
||||||
}
|
}
|
||||||
if ( f.isInfinite() ) {
|
if ( Float.isInfinite( f ) ) {
|
||||||
throw new NumberFormatException( "infinitive is not allowed" );
|
throw new NumberFormatException( "infinitive is not allowed" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user