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_UniqueSubpackageNames(EPackage, DiagnosticChain, Map
|
Method name: boolean validateEOperation_UniqueParameterNames(EOperation, DiagnosticChain, Map
|
|||
Number of AST nodes: 15 | Number of AST nodes: 15 | |||
1 | boolean result = true;↵ | 1 | boolean result = true;↵ | |
2 | List<String> names = new ArrayList<String>();↵ | 2 | List<String> names = new ArrayList<String>();↵ | |
3 | EList<EPackage> eSubpackages = ePackage.getESubpackages();↵ | 3 | EList<EPa↵ | |
4 | for (EPackage eSubpackage : eSubpackage↵ | 4 | rameter> eParameters = eOperation.getEParameters();↵ | |
5 | s)↵ | 5 | for (EParameter eParameter : eParameters)↵ | |
6 | {↵ | 6 | {↵ | |
7 | String name = eSubpackage.getName();↵ | 7 | String name = eParameter.getName();↵ | |
8 | if (name != null)↵ | 8 | if (name != null)↵ | |
9 | {↵ | 9 | {↵ | |
10 | int index = names.indexOf(name);↵ | 10 | int index = names.indexOf(name);↵ | |
11 | if (index != -1)↵ | 11 | if (index != -1)↵ | |
12 | {↵ | 12 | {↵ | |
13 | if (diagnostics == null)↵ | 13 | if (diagnostics == null)↵ | |
14 | {↵ | 14 | {↵ | |
15 | return false;↵ | 15 | return false;↵ | |
16 | }↵ | 16 | }↵ | |
17 | else↵ | 17 | else↵ | |
18 | {↵ | 18 | {↵ | |
19 | result = false;↵ | 19 | result = false;↵ | |
20 | EPackage otherESubpackage = eSubpackages.get(index);↵ | 20 | EParameter otherEParameter = eParameters.get(index);↵ | |
21 | diagnostics.add↵ | 21 | diagnostics.add↵ | |
22 | (createDiagnostic↵ | 22 | (createDiagnostic↵ | |
23 | (Diagnostic.ERROR,↵ | 23 | (Diagnostic.ERROR,↵ | |
24 | DIAGNOSTIC_SOURCE,↵ | 24 | DIAGNOSTIC_SOURCE,↵ | |
25 | UNIQUE_SUBPACKAGE_NAMES,↵ | 25 | UNIQUE_PARAMETER_NAMES,↵ | |
26 | "_UI_EPackageUniqueSubpackageNames_diagnostic", ↵ | 26 | "_UI_EOperationUniqueParameterNames_diagnostic", ↵ | |
27 | new Object[] { name },↵ | 27 | new Object[] { name },↵ | |
28 | new Object[] { ePackage, eSubpackage, otherESubpackage },↵ | 28 | new Object[] { eOperation, eParameter, otherEParameter },↵ | |
29 | context));↵ | 29 | context));↵ | |
30 | }↵ | 30 | }↵ | |
31 | }↵ | 31 | }↵ | |
32 | }↵ | 32 | }↵ | |
33 | names.add(name);↵ | 33 | names.add(name);↵ | |
34 | }↵ | 34 | }↵ | |
35 | return result; | 35 |
| |
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 32 |
Number of mapped statements | 7 |
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) | 2.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | String name = eSubpackage.getName(); |
| 5 | String name = eParameter.getName(); | ||||||||||||||
6 | if (name != null) | 6 | if (name != null) | |||||||||||||||
7 | int index = names.indexOf(name); | 7 | int index = names.indexOf(name); | |||||||||||||||
8 | if (index != -1) | 8 | if (index != -1) | |||||||||||||||
9 | if (diagnostics == null) | 9 | if (diagnostics == null) | |||||||||||||||
10 | return false; | 10 | return false; | |||||||||||||||
else | else | |||||||||||||||||
11 | result = false; | 11 | result = false; | |||||||||||||||
|
| 12 | EParameter otherEParameter = eParameters.get(index); | |||||||||||||||
12 | EPackage otherESubpackage = eSubpackages.get(index); |
| | |||||||||||||||
|
| 13 | diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_PARAMETER_NAMES, "_UI_EOperationUniqueParameterNames_diagnostic", new Object[] {name}, new Object[] {eOperation, eParameter, otherEParameter}, context)); | |||||||||||||||
13 | diagnostics.add(createDiagnostic(Diagnostic.ERROR, DIAGNOSTIC_SOURCE, UNIQUE_SUBPACKAGE_NAMES, "_UI_EPackageUniqueSubpackageNames_diagnostic", new Object[] {name}, new Object[] {ePackage, eSubpackage, otherESubpackage}, context)); |
| |
Row | Violation |
---|---|
1 | Type org.eclipse.emf.ecore.EPackage of variable eSubpackage does not match with type org.eclipse.emf.ecore.EParameter of variable eParameter |
2 | Unmatched statement EParameter otherEParameter=eParameters.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement EPackage otherESubpackage=eSubpackages.get(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement diagnostics.add(createDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,UNIQUE_PARAMETER_NAMES,"_UI_EOperationUniqueParameterNames_diagnostic",new Object[]{name},new Object[]{eOperation,eParameter,otherEParameter},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(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,UNIQUE_SUBPACKAGE_NAMES,"_UI_EPackageUniqueSubpackageNames_diagnostic",new Object[]{name},new Object[]{ePackage,eSubpackage,otherESubpackage},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, name, result , while Clone fragment #2 returns variables index, name, result |