title: Change Java.g4 grammar file
body: <p>I need to get parameters of method declaration of java file. 
  I am using JavaBaseListener interface and those method : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>@Override
      public Object visitMethodDeclaration(JavaParser.MethodDeclarationContext ctx) {
          TokenStream tokens = parser.getTokenStream();
          String type = "void";
          if(ctx.type() != null) {
              type = tokens.getText(ctx.type().getSourceInterval());
          }
          String args = tokens.getText(ctx.formalParameters());
  
          System.out.println("\t" + type + " " + ctx.Identifier() + args + ";");
          return super.visitMethodDeclaration(ctx);
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The problem is, that there are no white spaces between method name and method classname. 
  Input : private void addLoan(Loan loan) </p>
  
  <p>Output : void addLoan(Loanloan);</p>
  
  <p>I tried to change java.g4 grammar file, and added whitespace there</p>
  
  <p>formalParameter
  :   variableModifier* type " " variableDeclaratorId
  ;</p>
  
  <p>But now i have a lot of errors such as : </p>
  
  <p>line 1:6 no viable alternative at input 'public '
  line 1:12 extraneous input ' ' expecting Identifier
  line 1:20 extraneous input ' ' expecting {'extends', 'implements', '{', '&lt;'}
  line 2:5 no viable alternative at input 'List '
  ...</p>
  
  <p>What is the best solution for my problem and how can i handle it?
  Thanks in forward</p>