Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quick fix for attempt to override final method #612

Closed
eric-milles opened this issue Jun 22, 2018 · 0 comments
Closed

Add quick fix for attempt to override final method #612

eric-milles opened this issue Jun 22, 2018 · 0 comments
Assignees
Milestone

Comments

@eric-milles
Copy link
Member

This test case produces the error for trying to override a final method. In the Java Editor, there is a quick fix provided: "Remove 'final' modifier of 'Foo.meth'(..)"

    @Test
    public void testOverriding_FinalMethod1() {
        runNegativeTest(new String[] {
            "Bar.groovy",
            "class Bar {\n" +
            "  final def getFinalProperty() {}\n" +
            "}\n",

            "Foo.groovy",
            "class Foo extends Bar {\n" +
            "  def getFinalProperty() {}\n" +
            "}\n",
        },
        "----------\n" +
        "1. ERROR in Foo.groovy (at line 2)\n" +
        "\tdef getFinalProperty() {}\n" +
        "\t    ^^^^^^^^^^^^^^^^\n" +
        "Groovy:You are not allowed to override the final method getFinalProperty() from class 'Bar'.\n" +
        "----------\n");
    }
@eric-milles eric-milles added this to the v3.3.0 milestone Oct 17, 2018
@eric-milles eric-milles self-assigned this Jan 17, 2019
eric-milles added a commit that referenced this issue Jan 20, 2019
- Errors on constructor/method declarations should cover parameter list
- Move sourceEnds table population to GroovyCompilationUnitDeclaration
- TODO: Should enum constants with a body get the same treatment?

#611 #612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant