Java – IntelliJ code formatting, keeping / * package * / on the same line

In some cases, it makes sense to use package visibility for certain methods

/* package */ int getSpan() {  
    return mSpan; 
}

However, IntelliJ automatic formatting puts this comment on a separate line... Only for the final method: / Is there any way to configure the format so that all comments appear on the same line?

Solution

I have encountered problems similar to my Scala code in IntelliJ, including:

import ExecutionContext.Implicits.global // TODO use own execution context

Formatted as:

import ExecutionContext.Implicits.global

// TODO use own execution context

I try to stop this by leaving the comments in the first column below during formatting:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>