Question

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

Was it helpful?

Solution

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 serialVersionUID I 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 grep to 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).

OTHER TIPS

I would rather use continuous integration server like jenkins and create jobs that check stuff and send out emails when stuff happens

:)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top