force whitespace between ')' and '{'

in our code we sometimes have this

public class Demo{
    public String value(){
        if (something){  
            while(true){
                ...
            }
        }
    }
}

I'm currently trying to configure my checkstyle configuration to force developers to have a space before '{':

public class Demo {
    public String value() {
        if (something) {  
            while(true) {
                ...
            }
        }
    }
}

but I can't get it to work. Does anybody know the correct checkstyle configuration for this particular setup? I want to check this code as part of my gradle build


If you use eclipse you could have a look at "Window/Preferences/Java/Code Style/Formatter". You can set almost everything.

For your problem :

这里

If you want use checkstyle you can go to "Window/Preferences/Checkstyle/New ...". And doing some thing like that : 这里

链接地址: http://www.djcxy.com/p/22366.html

上一篇: 如何计算24?

下一篇: 强制')'和'{'之间的空白