Short version:
What is the MOST appropriate access modifier for serialVersionUID? Eclipse defaults to private, but are there anything wrong with setting it to something more visible?
Background:
I'm writing a library that heavily extends ArrayList. I want Eclipse to throw a warning if I don't include serialVersionUID in a serialized class. I ALSO want the compiler to throw a warning if it encounters a field WITHOUT a javadoc comment. Finally, I want the editor to remove unused fields if they are not in use.
So to achieve this, I set my class body template to this
/**
* Generated Serial Version UID
*/
public static final long serialVersionUID=7707109240879740918L;
Where the value of serialVersionUID is just an arbitrarily chosen random number that I've hardcoded into the template.
The field is public to get around the "unused variable issue".
The field has a hard-coded comment to get around the uncommented-field issue.
Yes, I know it's very picky, but I'm a lazy perfectionist who doesn't want to have to manually add that serialVersionUID each time and write the comment myself.
Sadly, I can't specify specific kinds of class templates that apply to only serialized classes, nor can I specify a template specific to the field serialVersionUID, hence the need to hard code it all and set to non-private to avoid the compiler complaining about the lack of comment AND the editor removing the unused value when I clean up my source code.
Whatever my reasons, have I introduced a potential bug or vulnerability in this class by setting serialVersionUID to anything other than private?