Improve on 3a840543cb5eef880a4caffd51c5d60eef79af47

It turns out that a method declaration with a null return type is _only_ used
to represent construction declarations that don't match the enclosing class
name; void-returning methods have a return type set to the primtive type node
for void.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113315860
diff --git a/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java b/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java
index 9f4077b..00cd848 100644
--- a/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java
+++ b/core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java
@@ -1307,12 +1307,7 @@
             builder.open(Indent.If.make(breakBeforeType, plusFour, ZERO));
             openedNameAndTypeScope = true;
           }
-          if (node.getReturnType2() == null) {
-            // ecj parses constructor declarations with the wrong name (e.g. `class X { Y() {} }`)
-            // as regular method declarations, so don't assume that an absent return type means
-            // the method is void-returning.
-            builder.guessToken("void");
-          } else {
+          if (node.getReturnType2() != null) {
             node.getReturnType2().accept(this);
           }
         }
diff --git a/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java b/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java
index 12cbce7..c78be2c 100644
--- a/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java
+++ b/core/src/test/java/com/google/googlejavaformat/java/FormatterTest.java
@@ -256,4 +256,12 @@
     String expect = "class X {\n  Y() {}\n}\n";
     assertThat(output).isEqualTo(expect);
   }
+  
+  @Test
+  public void voidMethod() throws FormatterException {
+    String input = "class X { void Y() {} }";
+    String output = new Formatter().formatSource(input);
+    String expect = "class X {\n  void Y() {}\n}\n";
+    assertThat(output).isEqualTo(expect);
+  }
 }