SafeVarargs annotation on private methods in java 8

Issue #208 resolved
Sebastian Hjelm created an issue

ExtendJ 8.0.1-189-g6a0d36d JavaSE 8

The SafeVarargs annotation should not be allowed on non-final, non-static methods in java 8.

The following code will compile in ExtendJ but not in javac:

@SafeVarargs
private void m(String... strings) {
}

Comments (3)

  1. Jesper Öqvist

    The attributes for checking the SafeVarargs annotation were okay, but the isFinal attribute did not behave as expected/intended. See issue #210.

    Fixing the isFinal issue also fixes this issue.

  2. Jesper Öqvist

    MethodDecl.isFinal() only tests for final modifier

    The isFinal attribute on MethodDecl was too smart. It was used in situations where only the final modifier should have effect, allowing private methods (and non-final methods in final classes) to act as if declared with the final keyword.

    This change affects generated bytecode: the ACC_FINAL flag is now only generated if a method is declared with the final modifier.

    fixes #210 fixes #208

    → <<cset 38bf0d5aabc6>>

  3. Log in to comment