File path: /jruby-1.4.0/src/org/jruby/anno/AnnotationBinder.java | File path: /jruby-1.4.0/src/org/jruby/anno/AnnotationBinder.java | |||
Method name: void processMethodDeclarationMulti(MethodDeclaration)
|
Method name: void processMethodDeclaration(MethodDeclaration)
|
|||
Number of AST nodes: 15 | Number of AST nodes: 15 | |||
1 | JRubyMethod anno = md.getAnnotation(JRubyMethod.class);↵ | 1 | JRubyMethod anno = md.getAnnotation(JRubyMethod.class);↵ | |
2 | if (anno != null && out != null) {↵ | 2 | if (anno != null && out != null) {↵ | |
3 | boolean isStatic = md.getModifiers().contains(Modifier.STATIC);↵ | 3 | boolean isStatic = md.getModifiers().contains(Modifier.STATIC);↵ | |
4 | String qualifiedName = getActualQualifiedName(md.getDeclaringType());↵ | 4 | String qualifiedName = getActualQualifiedName(md.getDeclaringType());↵ | |
5 | boolean hasContext = false;↵ | 5 | boolean hasContext = false;↵ | |
6 | boolean hasBlock = false;↵ | 6 | boolean hasBlock = false;↵ | |
7 | for (ParameterDeclaration pd : md.getParameters()) {↵ | 7 | for (ParameterDeclaration pd : md.getParameters()) {↵ | |
8 | hasContext |= pd.getType().toString().equals("org.jruby.runtime.ThreadContext");↵ | 8 | hasContext |= pd.getType().toString().equals("org.jruby.runtime.ThreadContext");↵ | |
9 | hasBlock |= pd.getType().toString().equals("org.jruby.runtime.Block");↵ | 9 | hasBlock |= pd.getType().toString().equals("org.jruby.runtime.Block");↵ | |
10 | }↵ | 10 | }↵ | |
11 | int actualRequired = calculateActualRequired(md.getParameters().size(), anno.optional(), anno.rest(), isStatic, hasContext, hasBlock);↵ | 11 | int actualRequired = calculateActualRequired(md.getParameters().size(), anno.optional(), anno.rest(), isStatic, hasContext, hasBlock);↵ | |
12 | String annotatedBindingName = CodegenUtils.getAnnotatedBindingClassName(↵ | 12 | String annotatedBindingName = CodegenUtils.getAnnotatedBindingClassName(↵ | |
13 | md.getSimpleName(),↵ | 13 | md.getSimpleName(),↵ | |
14 | qualifiedName,↵ | 14 | qualifiedName,↵ | |
15 | isStatic,↵ | 15 | isStatic,↵ | |
16 | actualRequired,↵ | 16 | actualRequired,↵ | |
17 | anno.optional(),↵ | 17 | anno.optional(),↵ | |
18 | true,↵ | 18 | false,↵ | |
19 | anno.frame());↵ | 19 | anno.frame());↵ | |
20 | String implClass = anno.meta() ? "metaClass" : "cls";↵ | 20 | String implClass = anno.meta() ? "metaClass" : "cls";↵ | |
21 | out.println(" javaMethod = new " + annotatedBindingName + "(" + implClass + ", Visibility." + anno.visibility() + ");");↵ | 21 | out.println(" javaMethod = new " + annotatedBindingName + "(" + implClass + ", Visibility." + anno.visibility() + ");");↵ | |
22 | out.println(" populateMethod(javaMethod, " +↵ | 22 | out.println(" populateMethod(javaMethod, " +↵ | |
23 | "-1, \"" +↵ | 23 | getArityValue(anno, actualRequired) + ", \"" +↵ | |
24 | md.getSimpleName() + "\", " +↵ | 24 | md.getSimpleName() + "\", " +↵ | |
25 | isStatic + ", " +↵ | 25 | isStatic + ", " +↵ | |
26 | "CallConfiguration." + getCallConfigNameByAnno(anno) + ");");↵ | 26 | "CallConfiguration." + getCallConfigNameByAnno(anno) + ");");↵ | |
27 | generateMethodAddCalls(md, anno);↵ | 27 | generateMethodAddCalls(md, anno);↵ | |
28 | } | 28 |
| |
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 | 131 |
Number of mapped statements | 15 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 9.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | JRubyMethod anno = md.getAnnotation(JRubyMethod.class); | 1 | JRubyMethod anno = md.getAnnotation(JRubyMethod.class); | |||||||||||||||||||||||||
2 | if (anno != null && out != null) | 2 | if (anno != null && out != null) | |||||||||||||||||||||||||
3 | boolean isStatic = md.getModifiers().contains(Modifier.STATIC); | 3 | boolean isStatic = md.getModifiers().contains(Modifier.STATIC); | |||||||||||||||||||||||||
4 | String qualifiedName = getActualQualifiedName(md.getDeclaringType()); | 4 | String qualifiedName = getActualQualifiedName(md.getDeclaringType()); | |||||||||||||||||||||||||
5 | boolean hasContext = false; |
| 6 | boolean hasBlock = false; | ||||||||||||||||||||||||
6 | boolean hasBlock = false; |
| 5 | boolean hasContext = false; | ||||||||||||||||||||||||
7 | for (ParameterDeclaration pd : md.getParameters()) | 7 | for (ParameterDeclaration pd : md.getParameters()) | |||||||||||||||||||||||||
8 | hasContext |= pd.getType().toString().equals("org.jruby.runtime.ThreadContext"); | 8 | hasContext |= pd.getType().toString().equals("org.jruby.runtime.ThreadContext"); | |||||||||||||||||||||||||
9 | hasBlock |= pd.getType().toString().equals("org.jruby.runtime.Block"); | 9 | hasBlock |= pd.getType().toString().equals("org.jruby.runtime.Block"); | |||||||||||||||||||||||||
10 | int actualRequired = calculateActualRequired(md.getParameters().size(), anno.optional(), anno.rest(), isStatic, hasContext, hasBlock); | 10 | int actualRequired = calculateActualRequired(md.getParameters().size(), anno.optional(), anno.rest(), isStatic, hasContext, hasBlock); | |||||||||||||||||||||||||
11 | String annotatedBindingName = CodegenUtils.getAnnotatedBindingClassName(md.getSimpleName(), qualifiedName, isStatic, actualRequired, anno.optional(), true, anno.frame()); |
| 11 | String annotatedBindingName = CodegenUtils.getAnnotatedBindingClassName(md.getSimpleName(), qualifiedName, isStatic, actualRequired, anno.optional(), false, anno.frame()); | ||||||||||||||||||||||||
12 | String implClass = anno.meta() ? "metaClass" : "cls"; | 12 | String implClass = anno.meta() ? "metaClass" : "cls"; | |||||||||||||||||||||||||
13 | out.println(" javaMethod = new " + annotatedBindingName + "(" + implClass + ", Visibility." + anno.visibility() + ");"); | 13 | out.println(" javaMethod = new " + annotatedBindingName + "(" + implClass + ", Visibility." + anno.visibility() + ");"); | |||||||||||||||||||||||||
14 | out.println(" populateMethod(javaMethod, " + "-1, \"" + md.getSimpleName() + "\", " + isStatic + ", " + "CallConfiguration." + getCallConfigNameByAnno(anno) + ");"); |
| 15 | generateMethodAddCalls(md, anno); | ||||||||||||||||||||||||
15 | generateMethodAddCalls(md, anno); |
| 14 | out.println(" populateMethod(javaMethod, " + getArityValue(anno, actualRequired) + ", \"" + md.getSimpleName() + "\", " + isStatic + ", " + "CallConfiguration." + getCallConfigNameByAnno(anno) + ");"); |
Row | Violation |
---|---|
1 | Expression out.println(" populateMethod(javaMethod, " + "-1, \"" + md.getSimpleName() + "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression generateMethodAddCalls(md,anno) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression out.println(" populateMethod(javaMethod, " + "-1, \"" + md.getSimpleName() + "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") is a void method call, and thus it cannot be parameterized |
4 | Expression generateMethodAddCalls(md,anno) is a void method call, and thus it cannot be parameterized |
5 | Expression out.println(" populateMethod(javaMethod, " + "-1, \"" + md.getSimpleName() + "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression generateMethodAddCalls(md,anno) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression out.println(" populateMethod(javaMethod, " + "-1, \"" + md.getSimpleName() + "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") is a void method call, and thus it cannot be parameterized |
8 | Expression generateMethodAddCalls(md,anno) is a void method call, and thus it cannot be parameterized |
9 | Expression generateMethodAddCalls(md,anno) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression out.println(" populateMethod(javaMethod, " + getArityValue(anno,actualRequired) + ", \""+ md.getSimpleName()+ "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression generateMethodAddCalls(md,anno) is a void method call, and thus it cannot be parameterized |
12 | Expression out.println(" populateMethod(javaMethod, " + getArityValue(anno,actualRequired) + ", \""+ md.getSimpleName()+ "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") is a void method call, and thus it cannot be parameterized |
13 | Expression generateMethodAddCalls(md,anno) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression out.println(" populateMethod(javaMethod, " + getArityValue(anno,actualRequired) + ", \""+ md.getSimpleName()+ "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression generateMethodAddCalls(md,anno) is a void method call, and thus it cannot be parameterized |
16 | Expression out.println(" populateMethod(javaMethod, " + getArityValue(anno,actualRequired) + ", \""+ md.getSimpleName()+ "\", "+ isStatic+ ", "+ "CallConfiguration."+ getCallConfigNameByAnno(anno)+ ");") is a void method call, and thus it cannot be parameterized |