From 203575865cac1756c80658878ea52f785875eb10 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 23 Jan 2018 18:55:57 +0100 Subject: [PATCH] HHH-12245 Don't use the toString() of primitive type to detect the type Better use getKind(). --- .../hibernate/jpamodelgen/util/TypeUtils.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java index 4bf67f54f7..32c04a4218 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/util/TypeUtils.java @@ -40,20 +40,20 @@ import org.hibernate.jpamodelgen.MetaModelGenerationException; public final class TypeUtils { public static final String DEFAULT_ANNOTATION_PARAMETER_NAME = "value"; - private static final Map PRIMITIVES = new HashMap(); + private static final Map PRIMITIVES = new HashMap(); static { - PRIMITIVES.put( "char", "Character" ); + PRIMITIVES.put( TypeKind.CHAR, "Character" ); - PRIMITIVES.put( "byte", "Byte" ); - PRIMITIVES.put( "short", "Short" ); - PRIMITIVES.put( "int", "Integer" ); - PRIMITIVES.put( "long", "Long" ); + PRIMITIVES.put( TypeKind.BYTE, "Byte" ); + PRIMITIVES.put( TypeKind.SHORT, "Short" ); + PRIMITIVES.put( TypeKind.INT, "Integer" ); + PRIMITIVES.put( TypeKind.LONG, "Long" ); - PRIMITIVES.put( "boolean", "Boolean" ); + PRIMITIVES.put( TypeKind.BOOLEAN, "Boolean" ); - PRIMITIVES.put( "float", "Float" ); - PRIMITIVES.put( "double", "Double" ); + PRIMITIVES.put( TypeKind.FLOAT, "Float" ); + PRIMITIVES.put( TypeKind.DOUBLE, "Double" ); } private TypeUtils() { @@ -61,7 +61,7 @@ public final class TypeUtils { public static String toTypeString(TypeMirror type) { if ( type.getKind().isPrimitive() ) { - return PRIMITIVES.get( type.toString() ); + return PRIMITIVES.get( type.getKind() ); } return type.toString(); }