< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/Method.java

Print this page

205       *     if they correspond to java.lang classes. For instance "Object" means "Object" if this
206       *     option is true, or "java.lang.Object" otherwise.
207       * @return the descriptor corresponding to the given type name.
208       */
209     private static String getDescriptorInternal(final String type, final boolean defaultPackage) {
210         if ("".equals(type)) {
211             return type;
212         }
213 
214         StringBuilder stringBuilder = new StringBuilder();
215         int arrayBracketsIndex = 0;
216         while ((arrayBracketsIndex = type.indexOf("[]", arrayBracketsIndex) + 1) > 0) {
217             stringBuilder.append('[');
218         }
219 
220         String elementType = type.substring(0, type.length() - stringBuilder.length() * 2);
221         String descriptor = PRIMITIVE_TYPE_DESCRIPTORS.get(elementType);
222         if (descriptor != null) {
223             stringBuilder.append(descriptor);
224         } else {

225             stringBuilder.append('L');
226             if (elementType.indexOf('.') < 0) {
227                 if (!defaultPackage) {
228                     stringBuilder.append("java/lang/");
229                 }
230                 stringBuilder.append(elementType);
231             } else {
232                 stringBuilder.append(elementType.replace('.', '/'));
233             }
234             stringBuilder.append(';');
235         }
236         return stringBuilder.toString();
237     }
238 
239     /**
240       * Returns the name of the method described by this object.
241       *
242       * @return the name of the method described by this object.
243       */
244     public String getName() {

205       *     if they correspond to java.lang classes. For instance "Object" means "Object" if this
206       *     option is true, or "java.lang.Object" otherwise.
207       * @return the descriptor corresponding to the given type name.
208       */
209     private static String getDescriptorInternal(final String type, final boolean defaultPackage) {
210         if ("".equals(type)) {
211             return type;
212         }
213 
214         StringBuilder stringBuilder = new StringBuilder();
215         int arrayBracketsIndex = 0;
216         while ((arrayBracketsIndex = type.indexOf("[]", arrayBracketsIndex) + 1) > 0) {
217             stringBuilder.append('[');
218         }
219 
220         String elementType = type.substring(0, type.length() - stringBuilder.length() * 2);
221         String descriptor = PRIMITIVE_TYPE_DESCRIPTORS.get(elementType);
222         if (descriptor != null) {
223             stringBuilder.append(descriptor);
224         } else {
225             // FIXME: support Q-type
226             stringBuilder.append('L');
227             if (elementType.indexOf('.') < 0) {
228                 if (!defaultPackage) {
229                     stringBuilder.append("java/lang/");
230                 }
231                 stringBuilder.append(elementType);
232             } else {
233                 stringBuilder.append(elementType.replace('.', '/'));
234             }
235             stringBuilder.append(';');
236         }
237         return stringBuilder.toString();
238     }
239 
240     /**
241       * Returns the name of the method described by this object.
242       *
243       * @return the name of the method described by this object.
244       */
245     public String getName() {
< prev index next >