In bug prediction research topic, you need to compare version (N) from your code (Buggy code) with version (N+1) i.e (Fixed code) in order to get exact code changes and more over to normalise and anonymise these code changes to get bug fix-patterns
http://scg.unibe.ch/archive/papers/Osma14aMiningBugFixChanges.pdf https://pdfs.semanticscholar.org/80c0/a9509068c9073f5b510d145c6fe4dc548afe.pdf
I've tried comparing the two files and get lines numbers of difference using : Java.io.LineNumberReader.getLineNumber()
Method
but still I couldn't find a way to achieve the following form :
(( View ) getParent (1) ). invalidate () ---> View parent = ( View ) getParent (1) ;
if ( parent != null ) parent . invalidate ();
the previous extracted "Bug Hunk" and "Fix Hunk" then should be transformed into:
(( T0)T1(N)).T2 () ---> T0T3 =( T0)T1(N);
if(T3 != null )T3.T2 ();
I've considered using "JAVA parser" but it was a dead end!
Please Advice!