#689 Loosen RedundantModifer test for @SafeVarargs-annotated functions (java 1.7)

SVN_Head
closed
nobody
None
1
2013-10-26
2012-11-19
No

The java 7 compiler requires a final modifier for @SafeVarargs-annotated functions, even if the class itself is final. It would be useful if checkstyle could detect this case and allow it even if the RedundantModifer test is enabled.

Example:

public final class VarargsTest<T> {
    @SafeVarargs
    public final void foo(final T... values) {
    }
}

Removing the seemingly redundant "final" modifier on foo will cause a compile error.

Tested with Eclipse Checkstyle Plug-in 5.6.0.201209221626

Discussion

  • Roman Ivanov
    Roman Ivanov
    2013-10-26

    thanks for raising issue.

    http://docs.oracle.com/javase/7/docs/api/java/lang/SafeVarargs.html
    it looks like a compiler problem, if I could say so :).

    but look like even java compiler did not desided yet what to do this this problem "Future versions of the platform may mandate compiler errors for such unsafe operations.", so we whould rather wait.

    As work around please user Checkstyle supporess abilities for such cases. Sorry.

    Further activity please reflect to mail list and https://github.com/checkstyle/checkstyle/issues

     
  • Roman Ivanov
    Roman Ivanov
    2013-10-26

    • status: open --> closed