Вопрос

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