diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/ImportContextImpl.java b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/ImportContextImpl.java index 378775282a..f94f30c769 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/ImportContextImpl.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/ImportContextImpl.java @@ -37,6 +37,7 @@ public class ImportContextImpl implements ImportContext { private String basePackage = ""; + private static String LINE_SEPARATOR = System.getProperty( "line.separator" ); private static final Map PRIMITIVES = new HashMap(); static { @@ -155,24 +156,24 @@ public class ImportContextImpl implements ImportContext { } public String generateImports() { - StringBuffer buf = new StringBuffer(); + StringBuilder builder = new StringBuilder(); for ( String next : imports ) { // don't add automatically "imported" stuff if ( !isAutoImported( next ) ) { if ( staticImports.contains( next ) ) { - buf.append( "import static " ).append( next ).append( ";\r\n" ); + builder.append( "import static " ).append( next ).append( ";" ).append( LINE_SEPARATOR ); } else { - buf.append( "import " ).append( next ).append( ";\r\n" ); + builder.append( "import " ).append( next ).append( ";" ).append( LINE_SEPARATOR ); } } } - if ( buf.indexOf( "$" ) >= 0 ) { - return buf.toString(); + if ( builder.indexOf( "$" ) >= 0 ) { + return builder.toString(); } - return buf.toString(); + return builder.toString(); } private boolean isAutoImported(String next) {