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 fixes for fixing modifiers when attempting to reduce visibility of override method #611

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

Comments

@eric-milles
Copy link
Member

This test case produces the error for trying to reduce the visibility when overriding a method. In the Java Editor, there are 2 quick fixes provided:

  1. Set the visibility of the override to match the overridden method
  2. Set the visibility of the overridden method to match the override method
    @Test
    public void testOverriding_ReducedVisibility1() {
        runNegativeTest(new String[] {
            "Bar.groovy",
            "class Bar { public void baz() {} }\n",

            "Foo.groovy",
            "class Foo extends Bar { private void baz() {}\n }\n",
        }, "----------\n" +
            "1. ERROR in Foo.groovy (at line 1)\n" +
            "\tclass Foo extends Bar { private void baz() {}\n" +
            "\t                                     ^^^\n" +
            "Groovy:baz() in Foo cannot override baz in Bar; attempting to assign weaker access privileges; was public\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