diff --git a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java index a3db17bf65..9bcfd67f68 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java @@ -1269,18 +1269,35 @@ private static boolean conflictingPair(Pair currentPair, Set classNames, AbstractCodeFragment fragment) { + Set matches = new LinkedHashSet(); for(String className : classNames) { for(LeafExpression expr : fragment.getStringLiterals()) { if(expr.getString().equals(s) && s.contains(className)) { - return className; + matches.add(className); } } for(AbstractCall call : fragment.getMethodInvocations()) { if(call.actualString().equals(s) && s.contains(className)) { - return className; + matches.add(className); } } } + if(matches.size() == 1) { + return matches.iterator().next(); + } + else if(matches.size() > 1) { + //return the longest match + String longest = null; + for(String match : matches) { + if(longest == null) { + longest = match; + } + else if(match.length() > longest.length()) { + longest = match; + } + } + return longest; + } return null; }