tsantalis / RefactoringMiner

MIT License
345 stars 132 forks source link

Proper handling of newlines when parsing comments #725

Closed koppor closed 1 month ago

koppor commented 1 month ago

I am investigating another "interesting" PR (https://github.com/koppor/jabref/pull/687)

I noticed that comments are now handled. Thank you for that!

It would be great if RefactoringMinor could handle newlines. Currently, if "only" line breaks change, it is determined as deleted/new - not as moved:

grafik

tsantalis commented 1 month ago

Move code from main to initLogging

Screenshot from 2024-05-27 15-21-00

tsantalis commented 1 month ago

@koppor

It's really cool the tool finds that routeLoggingToSlf4J and addLogToDisk have been merged to initLogging On top of that initializeLogger has been inlined to initLogging.

This is a challenging case, but our tool did pretty well !!

tsantalis commented 1 month ago

Diff after supporting move code from main to initLogging

Screenshot from 2024-05-28 05-54-05

koppor commented 1 month ago

Thank you for continuosly improving the tool! - (I still miss the connecting lines (https://github.com/tsantalis/RefactoringMiner/issues/703#issuecomment-2051136238) to see which block went where). I am still used to the IntelliJ "Resolve Conflicts" dialog ^^)

tsantalis commented 1 month ago

@koppor @pouryafard75 The javadoc is matched as follows:

Screenshot from 2024-05-28 20-03-14

Screenshot from 2024-05-28 20-05-56

tsantalis commented 1 month ago

@pouryafard75

4 of our tests failed after this update. I checked them and all of them have reformatted Javadoc. So, the change is positive. I will check if the Javadoc mappings can be further improved.

org.opentest4j.AssertionFailedError: Failed for https://github.com/belaban/JGroups/commit/f1533756133dec84ce8218202585ac85904da7c9 , srcFileName: src/org/jgroups/auth/FixedMembershipToken.java ==> expected: <112842> but was: <113219>

org.opentest4j.AssertionFailedError: Failed for https://github.com/spring-projects/spring-security/commit/fcc9a34356817d93c24b5ccf3107ec234a28b136 , srcFileName: web/src/main/java/org/springframework/security/web/context/SaveContextOnUpdateOrErrorResponseWrapper.java ==> expected: <442150> but was: <443825>

org.opentest4j.AssertionFailedError: Failed for https://github.com/addthis/hydra/commit/7fea4c9d5ee97d4a61ad985cadc9c5c0ab2db780 , srcFileName: hydra-main/src/main/java/com/addthis/hydra/job/spawn/SpawnBalancer.java ==> expected: <2844989> but was: <2846125>

org.opentest4j.AssertionFailedError: Failed for https://github.com/AsyncHttpClient/async-http-client/commit/f01d8610b9ceebc1de59d42f569b8af3efbe0a0f , srcFileName: api/src/test/java/org/asynchttpclient/oauth/OAuthSignatureCalculatorTest.java ==> expected: <219056> but was: <221438>

org.opentest4j.AssertionFailedError: Failed for https://github.com/nutzam/nutz/commit/de7efe40dad0f4bb900c4fffa80ed377745532b3 , srcFileName: src/org/nutz/dao/util/Daos.java ==> expected: <1103701> but was: <1103968>

tsantalis commented 1 month ago

@koppor @pouryafard75

image

This issue has been fixed to perfection! Thanks Pouria for your nice implementation.