File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EcoreValidator.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EcoreValidator.java | |||
Method name: boolean validateEPackage_UniqueClassifierNames(EPackage, DiagnosticChain, Map
|
Method name: boolean validateEEnum_UniqueEnumeratorNames(EEnum, DiagnosticChain, Map
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | String key = name.replace("_", "").toUpperCase();↵ | 1 | String key = name.replace("_", "").toUpperCase();↵ | |
2 | int index = names.indexOf(key);↵ | 2 | int index = names.indexOf(key);↵ | |
3 | if (index != -1)↵ | 3 | if (index != -1)↵ | |
4 | {↵ | 4 | {↵ | |
5 | if (diagnostics == null)↵ | 5 | if (diagnostics == null)↵ | |
6 | {↵ | 6 | {↵ | |
7 | return false;↵ | 7 | return false;↵ | |
8 | }↵ | 8 | }↵ | |
9 | else↵ | 9 | else↵ | |
10 | {↵ | 10 | {↵ | |
11 | result = false;↵ | 11 | result = false;↵ | |
12 | EClassifier otherEClassifier = eClassifiers.get(index);↵ | 12 | EEnumLiteral otherEEnumLiteral = eLiterals.get(index);↵ | |
13 | String otherName = otherEClassifier.getName();↵ | 13 | String otherName = otherEEnumLiteral.getName();↵ | |
14 | diagnostics.add↵ | 14 | diagnostics.add↵ | |
15 | (createDiagnostic↵ | 15 | (createDiagnostic↵ | |
16 | (name.equals(otherName) ? Diagnostic.ERROR : Diagnostic.WARNING,↵ | 16 | (name.equals(otherName) ? Diagnostic.ERROR : Diagnostic.WARNING,↵ | |
17 | DIAGNOSTIC_SOURCE,↵ | 17 | DIAGNOSTIC_SOURCE,↵ | |
18 | UNIQUE_CLASSIFIER_NAMES,↵ | 18 | UNIQUE_ENUMERATOR_NAMES,↵ | |
19 | name.equals(otherName) ? "_UI_EPackageUniqueClassifierNames_diagnostic" : "_UI_EPackageDissimilarClassifierNames_diagnostic",↵ | 19 | name.equals(otherName) ? "_UI_EEnumUniqueEnumeratorNames_diagnostic" : "_UI_EEnumDissimilarEnumeratorNames_diagnostic",↵ | |
20 | name.equals(otherName) ? new Object[] { name } : new Object[] { name, otherName },↵ | 20 | name.equals(otherName) ? new Object[] { name } : new Object[] { name, otherName },↵ | |
21 | new Object[] { ePackage, eClassifier, otherEClassifier },↵ | 21 | new Object[] { eEnum, eEnumLiteral, otherEEnumLiteral },↵ | |
22 | context));↵ | 22 | context));↵ | |
23 | }↵ | 23 | }↵ | |
24 | }↵ | 24 | }↵ | |
25 | names.add(key); | 25 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 47 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 7.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | String key = name.replace("_", "").toUpperCase(); | 8 | String key = name.replace("_", "").toUpperCase(); | |||||||||||||||
8 | int index = names.indexOf(key); | 9 | int index = names.indexOf(key); | |||||||||||||||
9 | if (index != -1) | 10 | if (index != -1) | |||||||||||||||
10 | if (diagnostics == null) | 11 | if (diagnostics == null) | |||||||||||||||
11 | return false; | 12 | return false; | |||||||||||||||
else | else | |||||||||||||||||
12 | result = false; | 13 | result = false; | |||||||||||||||
13 | EClassifier otherEClassifier = eClassifiers.get(index); |
| | |||||||||||||||
|
| 14 | EEnumLiteral otherEEnumLiteral = eLiterals.get(index); | |||||||||||||||
14 | String otherName = otherEClassifier.getName(); |
| 15 | String otherName = otherEEnumLiteral.getName(); | ||||||||||||||
15 | diagnostics.add(createDiagnostic(name.equals(otherName) ? Diagnostic.ERROR : Diagnostic.WARNING, DIAGNOSTIC_SOURCE, UNIQUE_CLASSIFIER_NAMES, name.equals(otherName) ? "_UI_EPackageUniqueClassifierNames_diagnostic" : "_UI_EPackageDissimilarClassifierNames_diagnostic", name.equals(otherName) ? new Object[] {name} : new Object[] {name, otherName}, new Object[] {ePackage, eClassifier, otherEClassifier}, context)); |
| | |||||||||||||||
|
| 16 | diagnostics.add(createDiagnostic(name.equals(otherName) ? Diagnostic.ERROR : Diagnostic.WARNING, DIAGNOSTIC_SOURCE, UNIQUE_ENUMERATOR_NAMES, name.equals(otherName) ? "_UI_EEnumUniqueEnumeratorNames_diagnostic" : "_UI_EEnumDissimilarEnumeratorNames_diagnostic", name.equals(otherName) ? new Object[] {name} : new Object[] {name, otherName}, new Object[] {eEnum, eEnumLiteral, otherEEnumLiteral}, context)); | |||||||||||||||
16 | names.add(key); | 17 | names.add(key); |
Row | Violation |
---|---|
1 | Unmatched statement EClassifier otherEClassifier=eClassifiers.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement EEnumLiteral otherEEnumLiteral=eLiterals.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Type org.eclipse.emf.ecore.EClassifier of variable otherEClassifier does not match with type org.eclipse.emf.ecore.EEnumLiteral of variable otherEEnumLiteral |
4 | Unmatched statement diagnostics.add(createDiagnostic(name.equals(otherName) ? Diagnostic.ERROR : Diagnostic.WARNING,DIAGNOSTIC_SOURCE,UNIQUE_CLASSIFIER_NAMES,name.equals(otherName) ? "_UI_EPackageUniqueClassifierNames_diagnostic" : "_UI_EPackageDissimilarClassifierNames_diagnostic",name.equals(otherName) ? new Object[]{name} : new Object[]{name,otherName},new Object[]{ePackage,eClassifier,otherEClassifier},context)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement diagnostics.add(createDiagnostic(name.equals(otherName) ? Diagnostic.ERROR : Diagnostic.WARNING,DIAGNOSTIC_SOURCE,UNIQUE_ENUMERATOR_NAMES,name.equals(otherName) ? "_UI_EEnumUniqueEnumeratorNames_diagnostic" : "_UI_EEnumDissimilarEnumeratorNames_diagnostic",name.equals(otherName) ? new Object[]{name} : new Object[]{name,otherName},new Object[]{eEnum,eEnumLiteral,otherEEnumLiteral},context)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Clone fragment #1 returns variables index, otherName, result , while Clone fragment #2 returns variables index, otherName, result |