I want to check whether some particular Java classes want to be commited. If so, I want to check if serialVersionUID is changed inside source of that particular class (new and old value).
How to do it? Any examples PLS.
Regards
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should be able to find plenty of examples on the web about setting up SVN hooks — here is the relevant chapter from the SVN book. Scroll down to Hook Scripts.
As to detecting
serialVersionUIDI share similar views to Andrzej Doyle: if you’re parsing the source code, there will likely be cases where you’ll incorrectly detect it. However, your source code in question may be simple enough that it works 99% of the time — and the ramifications of getting it wrong may not be too disastrous. Only you know the answer to that.So, a really simple way to check for it (assuming a Linux/UNIX/Mac OS environment) is to use a shell script that uses
grepto look for ‘serialVersionUID’. However, I can immediately think of a way this could detect a false positive: if an inner class declares it, a simple grep would detect it for the containing class (since we’re not parsing the file, we have no knowledge of the actual class structure inside).