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

Y_ has incorrect spelling : CONSTANTS are not handled well #27

Closed
paulvi opened this issue Jul 4, 2014 · 5 comments
Closed

Y_ has incorrect spelling : CONSTANTS are not handled well #27

paulvi opened this issue Jul 4, 2014 · 5 comments

Comments

@paulvi
Copy link
Contributor

paulvi commented Jul 4, 2014

for code private final List<String> EMPTY_LIST = new LinkedList<String>();

there is "Y_ has incorrect spelling" message

@stuarthendren
Copy link
Owner

Constants are a problem. I am otherwise following the google java coding style guide, but in constants I have to simplify.

The definition of a constant used is that is has to be static final; that is, it is constant for all instances of the class. Which is why your example gets an incorrect spelling. I think this definition is widely used but Google's definition is more strict, it has to be truly constant. Even making your list static would not make it a true constant, because it changes as you add things to the list.

@paulvi
Copy link
Contributor Author

paulvi commented Aug 11, 2014

jdt_spelling-constants

now classic example has incorrect warnings

@paulvi
Copy link
Contributor Author

paulvi commented Aug 11, 2014

jdt_spelling-constants2

@stuarthendren
Copy link
Owner

Hi Paul,

Not sure what you are saying? That first one is because they are not static as I commented.
That second one looks fine.

@paulvi
Copy link
Contributor Author

paulvi commented Aug 11, 2014

The first picture has private final int ... OK, got it, it does not have static.

Unlike the value of a constant, the value of a final variable is not necessarily known at compile time.

https://en.wikipedia.org/wiki/Final_(Java)

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

No branches or pull requests

2 participants