Skip to content

Commit

Permalink
Fix statement mappings in isomorphic lambda expressions
Browse files Browse the repository at this point in the history
JabRef/jabref#11430
src/main/java/org/jabref/preferences/JabRefPreferences.java
public AutoCompletePreferences getAutoCompletePreferences()

EasyBind.listen(autoCompletePreferences.nameFormatProperty(), (obs, oldValue, newValue) -> {
            if (autoCompletePreferences.getNameFormat() == AutoCompletePreferences.NameFormat.BOTH) {
                putBoolean(AUTOCOMPLETER_LAST_FIRST, false);
                putBoolean(AUTOCOMPLETER_FIRST_LAST, false);
            } else if (autoCompletePreferences.getNameFormat() == AutoCompletePreferences.NameFormat.LAST_FIRST) {
                putBoolean(AUTOCOMPLETER_LAST_FIRST, true);
                putBoolean(AUTOCOMPLETER_FIRST_LAST, false);
            } else {
                putBoolean(AUTOCOMPLETER_LAST_FIRST, false);
                putBoolean(AUTOCOMPLETER_FIRST_LAST, true);
            }
        });
  • Loading branch information
tsantalis committed Aug 5, 2024
1 parent 5713e8f commit 3230e5f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper
private Set<Pair<VariableDeclaration, VariableDeclaration>> movedVariables;
private int callsToExtractedMethod = 0;
private boolean nested;
private boolean lambdaBodyMapper;
private AbstractCall operationInvocation;
private Map<String, String> parameterToArgumentMap1;
private Map<String, String> parameterToArgumentMap2;
Expand Down Expand Up @@ -1274,6 +1275,7 @@ else if(lambda1.getBody() != null && lambda2.getBody() != null) {
addMapping(mapping);
}
else {
this.lambdaBodyMapper = true;
processCompositeStatements(composite1.getLeaves(), composite2.getLeaves(), composite1.getInnerNodes(), composite2.getInnerNodes());
}
}
Expand Down Expand Up @@ -5307,7 +5309,7 @@ else if(isomorphic && (container1.hasTestAnnotation() || container1.getName().st
}
}
}
if(parentMapper != null && matchCount > 1) {
if(parentMapper != null && !this.lambdaBodyMapper && matchCount > 1) {
Pair<CompositeStatementObject, CompositeStatementObject> switchParentEntry = multipleMappingsUnderTheSameSwitch(mappingSet);
boolean identicalSwitch = false;
if(switchParentEntry != null) {
Expand Down Expand Up @@ -5686,7 +5688,7 @@ else if(splitToMultipleAssignments.size() > 1) {
}
}
}
if(parentMapper != null && matchCount > 1) {
if(parentMapper != null && !this.lambdaBodyMapper && matchCount > 1) {
Pair<CompositeStatementObject, CompositeStatementObject> switchParentEntry = multipleMappingsUnderTheSameSwitch(mappingSet);
boolean identicalSwitch = false;
if(switchParentEntry != null) {
Expand Down

0 comments on commit 3230e5f

Please sign in to comment.