for (Field field : declaredFields) {
if (Modifier.isStatic(field.getModifiers())) {
defineAnnotatedConstant(field);
}
}
if (Modifier.isPublic(field.getModifiers())) {
proxy.getSingletonClass().addMethod(name, new StaticFieldSetter(name, proxy, field));
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyModule.java
|
|
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaClass.java
|
Method name: void defineAnnotatedConstants(Class)
|
|
Method name: void install(RubyModule)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 2
|
|
1 | for (Field field : declaredFields) {↵ | | |
|
2 | if (Modifier.isStatic(field.getModifiers())) {↵ | | 1 | if (Modifier.isPublic(field.getModifiers())) {↵
|
3 | defineAnnotatedConstant(field);↵ | | 2 | proxy.getSingletonClass().addMethod(name, new StaticFieldSetter(name, proxy, field));↵
|
4 | }↵ | | 3 | ↵
|
5 | } | | 4 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 4 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | if (Modifier.isStatic(field.getModifiers())) | | 1 | if (Modifier.isPublic(field.getModifiers())) |
| | | 2 | proxy.getSingletonClass().addMethod(name, new StaticFieldSetter(name, proxy, field)); |
4 | defineAnnotatedConstant(field); | | | |
Precondition Violations (0)
Row |
Violation |