MCPcopy Create free account
hub / github.com/evernat/dead-code-detector / getMethodDescription

Method getMethodDescription

src/main/java/dcd/DcdHelper.java:108–136  ·  view source on GitHub ↗
(String methodKey)

Source from the content-addressed store, hash-verified

106 }
107
108 static String getMethodDescription(String methodKey) {
109 final int index = methodKey.indexOf(METHOD_SEPARATOR);
110 final String methodName = methodKey.substring(0, index);
111 final String desc = methodKey.substring(index + 1);
112 final Type returnType = Type.getReturnType(desc);
113 final Type[] argumentTypes = Type.getArgumentTypes(desc);
114 final StringBuilder methodDesc = new StringBuilder();
115 final String javalang = "java.lang.";
116 if (returnType != Type.VOID_TYPE) {
117 String className = returnType.getClassName();
118 if (className.startsWith(javalang)) {
119 className = className.substring(javalang.length());
120 }
121 methodDesc.append(className).append(' ');
122 }
123 methodDesc.append(methodName).append('(');
124 for (final Type argumentType : argumentTypes) {
125 String className = argumentType.getClassName();
126 if (className.startsWith(javalang)) {
127 className = className.substring(javalang.length());
128 }
129 methodDesc.append(className).append(", ");
130 }
131 if (argumentTypes.length > 0) {
132 methodDesc.delete(methodDesc.length() - 2, methodDesc.length());
133 }
134 methodDesc.append(')');
135 return methodDesc.toString();
136 }
137
138 static String getFieldDescription(String field) {
139 final int index = field.indexOf(METHOD_SEPARATOR);

Callers 2

getMethodDescriptionMethod · 0.95
reportDeadCodeMethod · 0.95

Calls 2

appendMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected