Checkstyle's TrailingComment module detects the following as an invalid trailing comment in line 001:

000 private native void doSomething()/*-{
001    .. javascript code here ..
002 }-*/

Which is of course right, but I want to configure legalComment to ignore them. This is a regular expression, and I expected "-\{" would do the trick. It does not... did anyone have the same problem?

有帮助吗?

解决方案

It seems to me that the legalComment pattern is not applied to multiline comments. So you must solve your problem in the format property.

One way of doing that would be to allow trailing comments for native methods, like so:

<module name="TrailingComment">
    <property name="format" value="^(?:.+?\bnative\b.+?|[\s\}\);]*)$"/>
</module>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top