File path: /columba-1.4-src/core/src/main/java/org/columba/core/plugin/DefaultPluginLoader.java | File path: /columba-1.4-src/core/src/main/java/org/columba/core/plugin/Extension.java | |||
Method name: IExtensionInterface loadPlugin(String, String, Object[])
|
Method name: IExtensionInterface instanciateJavaClass(String, Object[])
|
|||
Number of AST nodes: 13 | Number of AST nodes: 13 | |||
1 | Class actClass;↵ | 1 | Class actClass;↵ | |
2 | actClass = loader.loadClass(className);↵ | 2 | actClass = loader.loadClass(className);↵ | |
3 | //↵ | 3 | //↵ | |
4 | // we can't just load the first constructor↵ | 4 | // we can't just load the first constructor↵ | |
5 | // -> go find the correct constructor based↵ | 5 | // -> go find the correct constructor based↵ | |
6 | // -> based on the arguments↵ | 6 | // -> based on the arguments↵ | |
7 | //↵ | 7 | //↵ | |
8 | if ((arguments == null) || (arguments.length == 0)) {↵ | 8 | if ((arguments == null) || (arguments.length == 0)) {↵ | |
9 | plugin = (IExtensionInterface) actClass.newInstance();↵ | 9 | plugin = (IExtensionInterface) actClass.newInstance();↵ | |
10 | } else {↵ | 10 | } else {↵ | |
11 | Constructor constructor;↵ | 11 | Constructor constructor;↵ | |
12 | constructor = ClassLoaderHelper↵ | 12 | constructor = ClassLoaderHelper↵ | |
13 | .findConstructor(arguments, actClass);↵ | 13 | .findConstructor(arguments, actClass);↵ | |
14 | // couldn't find correct constructor↵ | 14 | // couldn't find correct constructor↵ | |
15 | if (constructor == null) {↵ | 15 | if (constructor == null) {↵ | |
16 | LOG.severe("Couldn't find constructor for " + className↵ | 16 | LOG.severe("Couldn't find constructor for " + className↵ | |
17 | + " with matching argument-list: ");↵ | 17 | + " with matching argument-list: ");↵ | |
18 | for (int i = 0; i < arguments.length; i++) {↵ | 18 | for (int i = 0; i < arguments.length; i++) {↵ | |
19 | LOG.severe("argument[" + i + "]=" + arguments[i]);↵ | 19 | LOG.severe("argument[" + i + "]=" + arguments[i]);↵ | |
20 | }↵ | 20 | }↵ | |
21 | return null;↵ | 21 | return null;↵ | |
22 | } else {↵ | 22 | } else {↵ | |
23 | plugin = (IExtensionInterface) constructor↵ | 23 | plugin = (IExtensionInterface) constructor↵ | |
24 | .newInstance(arguments);↵ | 24 | .newInstance(arguments);↵ | |
25 | }↵ | 25 | }↵ | |
26 | }↵ | 26 | }↵ | |
27 | return plugin; | 27 |
| |
See real code fragment | See real code fragment |
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.5 |
Clones location | Clones are in different classes |
Number of node comparisons | 45 |
Number of mapped statements | 13 |
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) | 3.9 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
4 | Class actClass; | 5 | Class actClass; | |
5 | actClass = loader.loadClass(className); | 6 | actClass = loader.loadClass(className); | |
6 | if ((arguments == null) || (arguments.length == 0)) | 7 | if ((arguments == null) || (arguments.length == 0)) | |
7 | plugin = (IExtensionInterface)actClass.newInstance(); | 8 | plugin = (IExtensionInterface)actClass.newInstance(); | |
else | else | |||
8 | Constructor constructor; | 9 | Constructor constructor; | |
9 | constructor = ClassLoaderHelper.findConstructor(arguments, actClass); | 10 | constructor = ClassLoaderHelper.findConstructor(arguments, actClass); | |
10 | if (constructor == null) | 11 | if (constructor == null) | |
11 | LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: "); | 12 | LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: "); | |
12 | for (int i = 0; i < arguments.length; i++) | 13 | for (int i = 0; i < arguments.length; i++) | |
13 | LOG.severe("argument[" + i + "]=" + arguments[i]); | 14 | LOG.severe("argument[" + i + "]=" + arguments[i]); | |
14 | return null; | 15 | return null; | |
else | else | |||
15 | plugin = (IExtensionInterface)constructor.newInstance(arguments); | 16 | plugin = (IExtensionInterface)constructor.newInstance(arguments); | |
16 | return plugin; | 17 | return plugin; |
Row | Violation |
---|