Revision: 8605
Author: [email protected]
Date: Fri Aug 20 12:46:57 2010
Log: Always use unix-style line endings in Generators.

This makes for consistent output across operating systems. In particular, it makes Windows output unix-style.

http://gwt-code-reviews.appspot.com/776803/show
Review by: bobv,rjrjr

http://code.google.com/p/google-web-toolkit/source/detail?r=8605

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/javac/StandardGeneratorContext.java
 /trunk/user/src/com/google/gwt/uibinder/rebind/IndentedWriter.java
 /trunk/user/src/com/google/gwt/user/rebind/StringSourceWriter.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/javac/StandardGeneratorContext.java Wed Aug 11 09:22:23 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/StandardGeneratorContext.java Fri Aug 20 12:46:57 2010
@@ -494,7 +494,17 @@
     // it is pending so another attempt to create the same type will fail.
     Generated gcup;
     StringWriter sw = new StringWriter();
-    PrintWriter pw = new PrintWriter(sw, true);
+    PrintWriter pw = new PrintWriter(sw, true) {
+      /**
+ * Overridden to force unix-style line endings for consistent behavior
+       * across platforms.
+       */
+      @Override
+      public void println() {
+        super.print('\n');
+        super.flush();
+      }
+    };
     if (this.genDir == null) {
       gcup = new GeneratedUnitImpl(sw, typeName);
     } else {
=======================================
--- /trunk/user/src/com/google/gwt/uibinder/rebind/IndentedWriter.java Wed Oct 28 09:10:53 2009 +++ /trunk/user/src/com/google/gwt/uibinder/rebind/IndentedWriter.java Fri Aug 20 12:46:57 2010
@@ -42,7 +42,8 @@
    * Outputs a new line.
    */
   public void newline() {
-    pw.println();
+    // Unix-style line endings for consistent behavior across platforms.
+    pw.print('\n');
   }

   /**
@@ -60,7 +61,8 @@
    */
   public void write(String format) {
     printIndent();
-    pw.println(format);
+    pw.print(format);
+    newline();
   }

   /**
@@ -69,7 +71,7 @@
   public void write(String format, Object... args) {
     printIndent();
     pw.printf(format, args);
-    pw.println();
+    newline();
   }

   private void printIndent() {
=======================================
--- /trunk/user/src/com/google/gwt/user/rebind/StringSourceWriter.java Mon Nov 23 16:21:36 2009 +++ /trunk/user/src/com/google/gwt/user/rebind/StringSourceWriter.java Fri Aug 20 12:46:57 2010
@@ -33,7 +33,7 @@
   private final PrintWriter out = new PrintWriter(buffer);

   public void beginJavaDocComment() {
-    out.println("/**");
+    println("/**");
     indent();
     indentPrefix = " * ";
   }
@@ -72,7 +72,8 @@

   public void println() {
     maybeIndent();
-    out.println();
+    // Unix-style line endings for consistent behavior across platforms.
+    out.print('\n');
     needsIndent = true;
   }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to