Frage

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?

War es hilfreich?

Lösung

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>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top