MCPcopy Index your code
hub / github.com/clojure/clojure / getDescriptor

Method getDescriptor

src/jvm/clojure/asm/commons/Method.java:179–207  ·  view source on GitHub ↗

Returns the descriptor corresponding to the given type name. @param type a Java type name. @param defaultPackage true if unqualified class names belong to the default package, or false if they correspond to java.lang classes. For instance "Object" means "Object" if this option is true, or "

(final String type, final boolean defaultPackage)

Source from the content-addressed store, hash-verified

177 * @return the descriptor corresponding to the given type name.
178 */
179 private static String getDescriptor(final String type, final boolean defaultPackage) {
180 if ("".equals(type)) {
181 return type;
182 }
183
184 StringBuilder stringBuilder = new StringBuilder();
185 int arrayBracketsIndex = 0;
186 while ((arrayBracketsIndex = type.indexOf("[]", arrayBracketsIndex) + 1) > 0) {
187 stringBuilder.append('[');
188 }
189
190 String elementType = type.substring(0, type.length() - stringBuilder.length() * 2);
191 String descriptor = PRIMITIVE_TYPE_DESCRIPTORS.get(elementType);
192 if (descriptor != null) {
193 stringBuilder.append(descriptor);
194 } else {
195 stringBuilder.append('L');
196 if (elementType.indexOf('.') < 0) {
197 if (!defaultPackage) {
198 stringBuilder.append("java/lang/");
199 }
200 stringBuilder.append(elementType);
201 } else {
202 stringBuilder.append(elementType.replace('.', '/'));
203 }
204 stringBuilder.append(';');
205 }
206 return stringBuilder.toString();
207 }
208
209 /**
210 * Returns the name of the method described by this object.

Callers 8

emitUnboxedMethod · 0.95
emitMethod · 0.95
emitStaticsMethod · 0.95
getMethodMethod · 0.95
GeneratorAdapterMethod · 0.45
fieldInsnMethod · 0.45
invokeInsnMethod · 0.45
newLocalMethod · 0.45

Calls 7

appendMethod · 0.80
lengthMethod · 0.65
getMethod · 0.65
equalsMethod · 0.45
indexOfMethod · 0.45
replaceMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected