Skip to content

Commit 8ae5cf5

Browse files
committed
Match method copyTitle() with copyField()
JabRef/jabref#13280 jabgui/src/main/java/org/jabref/gui/edit/CopyMoreAction.java
1 parent f237cff commit 8ae5cf5

File tree

5 files changed

+45
-20
lines changed

5 files changed

+45
-20
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,17 +366,17 @@ Currently, it supports the detection of the following refactorings:
366366
**File**: [data.json](https://github.com/tsantalis/RefactoringMiner/blob/master/src/test/resources/oracle/data.json)
367367

368368
The original benchmark has been extended by adding newly supported refactoring types by RefactoringMiner.
369-
As of **August 18, 2025** the precision and recall of RefactoringMiner on this benchmark is:
369+
As of **August 26, 2025** the precision and recall of RefactoringMiner on this benchmark is:
370370

371371
| Refactoring Type | TP | FP | FN | Precision | Recall |
372372
|:-----------------------|-----------:|--------:|--------:|--------:|--------:|
373-
|**Total**|12454 | 15 | 223 | 0.999 | 0.982|
373+
|**Total**|12459 | 15 | 221 | 0.999 | 0.983|
374374
|Extract Method|1010 | 1 | 21 | 0.999 | 0.980|
375375
|Rename Class|56 | 0 | 2 | 1.000 | 0.966|
376376
|Move Attribute|257 | 0 | 8 | 1.000 | 0.970|
377377
|Move And Rename Attribute|17 | 0 | 0 | 1.000 | 1.000|
378378
|Replace Attribute| 1 | 0 | 0 | 1.000 | 1.000|
379-
|Rename Method|395 | 2 | 21 | 0.995 | 0.950|
379+
|Rename Method|396 | 2 | 20 | 0.995 | 0.952|
380380
|Inline Method|118 | 0 | 1 | 1.000 | 0.992|
381381
|Move Method|388 | 3 | 5 | 0.992 | 0.987|
382382
|Move And Rename Method|132 | 0 | 4 | 1.000 | 0.971|
@@ -396,7 +396,7 @@ As of **August 18, 2025** the precision and recall of RefactoringMiner on this b
396396
|Replace Anonymous With Class| 8 | 0 | 0 | 1.000 | 1.000|
397397
|Rename Package|16 | 0 | 0 | 1.000 | 1.000|
398398
|Move Package|10 | 0 | 0 | 1.000 | 1.000|
399-
|Extract Variable|306 | 0 | 0 | 1.000 | 1.000|
399+
|Extract Variable|307 | 0 | 0 | 1.000 | 1.000|
400400
|Extract Attribute|25 | 0 | 0 | 1.000 | 1.000|
401401
|Inline Variable|120 | 0 | 0 | 1.000 | 1.000|
402402
|Inline Attribute| 9 | 0 | 0 | 1.000 | 1.000|
@@ -418,7 +418,7 @@ As of **August 18, 2025** the precision and recall of RefactoringMiner on this b
418418
|Change Variable Type|810 | 2 | 7 | 0.998 | 0.991|
419419
|Change Parameter Type|654 | 1 | 10 | 0.998 | 0.985|
420420
|Change Attribute Type|244 | 0 | 8 | 1.000 | 0.968|
421-
|Add Method Annotation|333 | 0 | 1 | 1.000 | 0.997|
421+
|Add Method Annotation|334 | 0 | 0 | 1.000 | 1.000|
422422
|Remove Method Annotation|97 | 0 | 0 | 1.000 | 1.000|
423423
|Modify Method Annotation|29 | 0 | 0 | 1.000 | 1.000|
424424
|Add Attribute Annotation|62 | 0 | 1 | 1.000 | 0.984|
@@ -430,15 +430,15 @@ As of **August 18, 2025** the precision and recall of RefactoringMiner on this b
430430
|Add Parameter Annotation|34 | 0 | 0 | 1.000 | 1.000|
431431
|Remove Parameter Annotation| 4 | 0 | 0 | 1.000 | 1.000|
432432
|Modify Parameter Annotation| 2 | 0 | 0 | 1.000 | 1.000|
433-
|Add Parameter|851 | 1 | 1 | 0.999 | 0.999|
433+
|Add Parameter|852 | 1 | 1 | 0.999 | 0.999|
434434
|Remove Parameter|318 | 0 | 0 | 1.000 | 1.000|
435435
|Reorder Parameter| 9 | 0 | 0 | 1.000 | 1.000|
436436
|Add Variable Annotation| 1 | 0 | 0 | 1.000 | 1.000|
437437
|Remove Variable Annotation| 4 | 0 | 0 | 1.000 | 1.000|
438438
|Add Thrown Exception Type|41 | 0 | 0 | 1.000 | 1.000|
439439
|Remove Thrown Exception Type|270 | 0 | 0 | 1.000 | 1.000|
440440
|Change Thrown Exception Type| 9 | 0 | 0 | 1.000 | 1.000|
441-
|Change Method Access Modifier|333 | 0 | 0 | 1.000 | 1.000|
441+
|Change Method Access Modifier|334 | 0 | 0 | 1.000 | 1.000|
442442
|Change Attribute Access Modifier|232 | 0 | 0 | 1.000 | 1.000|
443443
|Encapsulate Attribute|52 | 0 | 0 | 1.000 | 1.000|
444444
|Add Method Modifier|90 | 0 | 0 | 1.000 | 1.000|

src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ private void updateMapperSet(TreeSet<UMLOperationBodyMapper> mapperSet, UMLOpera
23292329
mapperSet.add(operationBodyMapper);
23302330
}
23312331
else if(mappedElementsMoreThanNonMappedT1AndT2(mappings, operationBodyMapper) &&
2332-
(absoluteDifferenceInPosition <= differenceInPosition || zeroNonMapped || containsAnonymousClassDiff) &&
2332+
(relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) || zeroNonMapped || containsAnonymousClassDiff) &&
23332333
compatibleSignatures(removedOperation, addedOperation, absoluteDifferenceInPosition) &&
23342334
removedOperation.testMethodCheck(addedOperation)) {
23352335
isPartOfMethodMovedFromDeletedMethod(removedOperation, addedOperation, operationBodyMapper, mapperSet);
@@ -2338,15 +2338,15 @@ else if(mappedElementsMoreThanNonMappedT1AndT2(mappings, operationBodyMapper) &&
23382338
}
23392339
else if(removedOperation.isConstructor() == addedOperation.isConstructor() &&
23402340
mappedElementsMoreThanNonMappedT2(mappings, operationBodyMapper) &&
2341-
absoluteDifferenceInPosition <= differenceInPosition &&
2341+
relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) &&
23422342
(isPartOfMethodExtracted(removedOperation, addedOperation) || isPartOfMethodMovedToExistingMethod(removedOperation, addedOperation) ||
23432343
(operationBodyMapper.exactMatches() > 0 && !mapperWithZeroNonMappedStatementsOrIdenticalMethodName && isPartOfMethodMovedToAddedMethod(removedOperation, addedOperation, operationBodyMapper))) &&
23442344
removedOperation.testMethodCheck(addedOperation)) {
23452345
mapperSet.add(operationBodyMapper);
23462346
}
23472347
else if(removedOperation.isConstructor() == addedOperation.isConstructor() &&
23482348
mappedElementsMoreThanNonMappedT1(mappings, operationBodyMapper) &&
2349-
absoluteDifferenceInPosition <= differenceInPosition &&
2349+
relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) &&
23502350
(isPartOfMethodInlined(removedOperation, addedOperation) || isPartOfMethodMovedFromExistingMethod(removedOperation, addedOperation) ||
23512351
(operationBodyMapper.exactMatches() > 0 && !mapperWithZeroNonMappedStatementsOrIdenticalMethodName && isPartOfMethodMovedFromDeletedMethod(removedOperation, addedOperation, operationBodyMapper, mapperSet))) &&
23522352
removedOperation.testMethodCheck(addedOperation)) {
@@ -2470,7 +2470,7 @@ else if(allStatementsMappedOrParameterized(operationBodyMapper)) {
24702470
if(totalMappings.size() > 0) {
24712471
int absoluteDifferenceInPosition = computeAbsoluteDifferenceInPositionWithinClass(removedOperation, addedOperation);
24722472
if(singleUnmatchedStatementCallsAddedOperation(operationBodyMapper) &&
2473-
absoluteDifferenceInPosition <= differenceInPosition &&
2473+
relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) &&
24742474
compatibleSignatures(removedOperation, addedOperation, absoluteDifferenceInPosition)) {
24752475
mapperSet.add(operationBodyMapper);
24762476
}
@@ -2479,13 +2479,17 @@ else if(allStatementsMappedOrParameterized(operationBodyMapper)) {
24792479
int absoluteDifferenceInPosition = computeAbsoluteDifferenceInPositionWithinClass(removedOperation, addedOperation);
24802480
if(removedOperation.isConstructor() == addedOperation.isConstructor() &&
24812481
mappedElementsMoreThanNonMappedT2(mappings, operationBodyMapper) &&
2482-
absoluteDifferenceInPosition <= differenceInPosition &&
2482+
relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) &&
24832483
removedOperation.testMethodCheck(addedOperation)) {
24842484
mapperSet.add(operationBodyMapper);
24852485
}
24862486
}
24872487
}
24882488

2489+
private boolean relativePositionCheck(int differenceInPosition, int absoluteDifferenceInPosition) {
2490+
return absoluteDifferenceInPosition <= differenceInPosition || (removedOperations.size() == addedOperations.size() && removedOperations.size() == 1 && !originalClass.isTestClass() && !nextClass.isTestClass());
2491+
}
2492+
24892493
private void updateMapperSet(TreeSet<UMLOperationBodyMapper> mapperSet, UMLOperation removedOperation, UMLOperation operationInsideAnonymousClass, UMLOperation addedOperation, int differenceInPosition) throws RefactoringMinerTimedOutException {
24902494
UMLOperationBodyMapper operationBodyMapper = new UMLOperationBodyMapper(removedOperation, operationInsideAnonymousClass, this);
24912495
int mappings = operationBodyMapper.mappingsWithoutBlocks();
@@ -2495,19 +2499,19 @@ private void updateMapperSet(TreeSet<UMLOperationBodyMapper> mapperSet, UMLOpera
24952499
mapperSet.add(operationBodyMapper);
24962500
}
24972501
else if(mappedElementsMoreThanNonMappedT1AndT2(mappings, operationBodyMapper) &&
2498-
absoluteDifferenceInPosition <= differenceInPosition &&
2502+
relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) &&
24992503
compatibleSignatures(removedOperation, addedOperation, absoluteDifferenceInPosition)) {
25002504
mapperSet.add(operationBodyMapper);
25012505
}
25022506
else if(removedOperation.isConstructor() == addedOperation.isConstructor() &&
25032507
mappedElementsMoreThanNonMappedT2(mappings, operationBodyMapper) &&
2504-
absoluteDifferenceInPosition <= differenceInPosition &&
2508+
relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) &&
25052509
(isPartOfMethodExtracted(removedOperation, addedOperation) || isPartOfMethodMovedToExistingMethod(removedOperation, addedOperation))) {
25062510
mapperSet.add(operationBodyMapper);
25072511
}
25082512
else if(removedOperation.isConstructor() == addedOperation.isConstructor() &&
25092513
mappedElementsMoreThanNonMappedT1(mappings, operationBodyMapper) &&
2510-
absoluteDifferenceInPosition <= differenceInPosition &&
2514+
relativePositionCheck(differenceInPosition, absoluteDifferenceInPosition) &&
25112515
(isPartOfMethodInlined(removedOperation, addedOperation) || isPartOfMethodMovedFromExistingMethod(removedOperation, addedOperation))) {
25122516
mapperSet.add(operationBodyMapper);
25132517
}

src/test/java/org/refactoringminer/test/TestAllRefactorings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public void testAllRefactorings() throws Exception {
1717
GitHistoryRefactoringMinerImpl detector = new GitHistoryRefactoringMinerImpl();
1818
TestBuilder test = new TestBuilder(detector, REPOS, Refactorings.All.getValue());
1919
RefactoringPopulator.feedRefactoringsInstances(Refactorings.All.getValue(), Systems.FSE.getValue(), test);
20-
test.assertExpectationsWithGitHubAPI(12454, 15, 223);
20+
test.assertExpectationsWithGitHubAPI(12459, 15, 221);
2121
}
2222
}

src/test/resources/oracle/data.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81129,7 +81129,7 @@
8112981129
"description": "Rename Method public getInvocationUsagePercentage() : double renamed to private invocationsUsedPercentage() : double in class com.hazelcast.spi.impl.operationservice.impl.InvocationRegistry",
8113081130
"comment": "<p>We have an Extract local variable&nbsp;maxConcurrentInvocations, and an if statement added.</p>",
8113181131
"validation": "TP",
81132-
"detectionTools": "RefDiff",
81132+
"detectionTools": "RefactoringMiner, RefDiff",
8113381133
"validators": "Matin, Nikos"
8113481134
}, {
8113581135
"type": "Move Method",
@@ -82438,7 +82438,7 @@
8243882438
"description": "Add Method Annotation @Probe(name = \"invocations.usedPercentage\") in method private invocationsUsedPercentage() : double from class com.hazelcast.spi.impl.operationservice.impl.InvocationRegistry",
8243982439
"comment": "<p>Assuming TP for<br />Rename Method public getInvocationUsagePercentage() : double renamed to private invocationsUsedPercentage() : double in class com.hazelcast.spi.impl.operationservice.impl.InvocationRegistry</p>",
8244082440
"validation": "CTP",
82441-
"detectionTools": "GumTreeDiff",
82441+
"detectionTools": "RefactoringMiner, GumTreeDiff",
8244282442
"validators": "Nikos"
8244382443
}, {
8244482444
"type": "Remove Method Annotation",
@@ -83175,6 +83175,20 @@
8317583175
"validation": "TP",
8317683176
"detectionTools": "RefactoringMiner",
8317783177
"validators": null
83178+
}, {
83179+
"type": "Extract Variable",
83180+
"description": "Extract Variable maxConcurrentInvocations : int in method private invocationsUsedPercentage() : double from class com.hazelcast.spi.impl.operationservice.impl.InvocationRegistry",
83181+
"comment": null,
83182+
"validation": "TP",
83183+
"detectionTools": "RefactoringMiner",
83184+
"validators": null
83185+
}, {
83186+
"type": "Change Method Access Modifier",
83187+
"description": "Change Method Access Modifier public to private in method private invocationsUsedPercentage() : double from class com.hazelcast.spi.impl.operationservice.impl.InvocationRegistry",
83188+
"comment": null,
83189+
"validation": "TP",
83190+
"detectionTools": "RefactoringMiner",
83191+
"validators": null
8317883192
}],
8317983193
"refDiffExecutionTime": 5604
8318083194
}, {
@@ -95367,6 +95381,13 @@
9536795381
"validation": "TP",
9536895382
"detectionTools": "RefactoringMiner",
9536995383
"validators": "Nikos"
95384+
}, {
95385+
"type": "Add Parameter",
95386+
"description": "Add Parameter shoudShowMenuButton : boolean in method public FavouritesAdapter(activity Activity, list List<FavouritePoint>, shoudShowMenuButton boolean) from class net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter",
95387+
"comment": null,
95388+
"validation": "TP",
95389+
"detectionTools": "RefactoringMiner",
95390+
"validators": null
9537095391
}],
9537195392
"refDiffExecutionTime": 2032
9537295393
}, {

src/test/resources/oracle/expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ ce4b0e22659c16ae83d421f9621fd3e922750764, 2, 0, 0
250250
72dda3404820a82d53f1a16bb2ed9ad95f745d3c, 6, 0, 0
251251
35b6c869546a7968b6fd2f640add6eea87e03c22, 80, 0, 2
252252
4184c577f4bbc57f3ac13639557cfd99cdaca3e7, 4, 0, 0
253-
30c4ae09745d6062077925a54f27205b7401d8df, 294, 0, 4
253+
30c4ae09745d6062077925a54f27205b7401d8df, 298, 0, 2
254254
03573a655bcbb77f7a76d8e22d851cc22796b4f8, 3, 0, 0
255255
043030723632627b0908dca6b24dae91d3dfd938, 10, 0, 0
256256
e3b0d87b3ca0fd27cec39937cb3dc3a05b0cfc4e, 4, 0, 0
@@ -518,7 +518,7 @@ c1359c843bd03a694f846c8140e24ed646bbb913, 8, 0, 0
518518
8c5a20d786e66ee4c4b0d743f0f80bf681c419be, 1, 0, 0
519519
02d3fa171d02c9d82c7bdcaeb739f47d0c0006a0, 4, 0, 0
520520
c45b9e6615181b7d8f4d7b5b1cc141169081c02c, 7, 0, 0
521-
e95aa8ab32a0334b9c941799060fd601297d05e4, 4, 0, 0
521+
e95aa8ab32a0334b9c941799060fd601297d05e4, 5, 0, 0
522522
deb8e5ca64fcf633edbd89523af472da813b6772, 1, 0, 0
523523
e58c9c3eef4c6e44b21a97cfbd2862bb2eb4627a, 11, 0, 0
524524
a9b1e5d67421ed98b49ae25c3bbd6e27a0ab1590, 7, 0, 0

0 commit comments

Comments
 (0)