Search code examples
javaeclipsegwtjsni

Eclipse Java Editor Formatter adds unnecessary spaces to GWT JSNI method body


I have declared jsni method in my Java file as follow:

public static native void alert(String msg) /*-{
    $wnd.alert(msg);
}-*/;

But when I click ctrl + shift + f to format my code using declared formatter I am getting this:

public static native void alert(String msg) /*-{
                                            $wnd.alert(msg);
                                            }-*/;

How can I fix this?


Solution

  • When using the proper JSNI-aware editor, Eclipse will use the JavaScript formatter for JSNI, so this is where you'll tweak those things (indentation, spacing around/inside parentheses and braces, etc.)