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

Inner static block is causing compilation error #718

Closed
AntonPanikov opened this issue Sep 17, 2018 · 3 comments
Closed

Inner static block is causing compilation error #718

AntonPanikov opened this issue Sep 17, 2018 · 3 comments
Assignees
Labels
Milestone

Comments

@AntonPanikov
Copy link

Inner static init block is causing compilation error:

package test

class Test {
    class TestInner {
        static {
        }
    }
}

Compile error:

The method <clinit> cannot be declared static; static methods can only be declared in a static or top level type

I am on 3.1.0.xx-201809160115-e47

@eric-milles
Copy link
Member

If your TestInner class does not need to reference any instance members of Test, you can add the static modifier to the inner class. This will suppress the error.

@eric-milles eric-milles self-assigned this Sep 17, 2018
@eric-milles eric-milles added this to the v3.1.0 milestone Sep 17, 2018
@eric-milles
Copy link
Member

Ready to test

@AntonPanikov
Copy link
Author

Tested on 3.1.0.xx-201809172153-e47
It is fixed

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

No branches or pull requests

2 participants