< prev index next >

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

Print this page
@@ -57,10 +57,11 @@
   * THE POSSIBILITY OF SUCH DAMAGE.
   */
  package jdk.internal.org.objectweb.asm;
  
  import java.lang.reflect.Constructor;
+ import java.lang.reflect.InvocationTargetException;
  import java.lang.reflect.Method;
  
  /**
   * A Java field or method type. This class can be used to make it easier to manipulate type and
   * method descriptors.

@@ -332,11 +333,12 @@
          // Parse the argument types, one at a each loop iteration.
          while (methodDescriptor.charAt(currentOffset) != ')') {
              while (methodDescriptor.charAt(currentOffset) == '[') {
                  currentOffset++;
              }
-             if (methodDescriptor.charAt(currentOffset++) == 'L') {
+             char c = methodDescriptor.charAt(currentOffset++);
+             if (c == 'L' || c == 'Q') {
                  // Skip the argument descriptor content.
                  int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
                  currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
              }
              ++numArgumentTypes;

@@ -351,11 +353,12 @@
          while (methodDescriptor.charAt(currentOffset) != ')') {
              final int currentArgumentTypeOffset = currentOffset;
              while (methodDescriptor.charAt(currentOffset) == '[') {
                  currentOffset++;
              }
-             if (methodDescriptor.charAt(currentOffset++) == 'L') {
+             char c = methodDescriptor.charAt(currentOffset++);
+             if (c == 'L' || c == 'Q') {
                  // Skip the argument descriptor content.
                  int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
                  currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
              }
              argumentTypes[currentArgumentTypeIndex++] =

@@ -422,11 +425,12 @@
          // Skip the argument types, one at a each loop iteration.
          while (methodDescriptor.charAt(currentOffset) != ')') {
              while (methodDescriptor.charAt(currentOffset) == '[') {
                  currentOffset++;
              }
-             if (methodDescriptor.charAt(currentOffset++) == 'L') {
+             char c = methodDescriptor.charAt(currentOffset++);
+             if (c == 'L' || c == 'Q') {
                  // Skip the argument descriptor content.
                  int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
                  currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
              }
          }

@@ -465,10 +469,11 @@
              case 'D':
                  return DOUBLE_TYPE;
              case '[':
                  return new Type(ARRAY, descriptorBuffer, descriptorBegin, descriptorEnd);
              case 'L':
+             case 'Q':
                  return new Type(OBJECT, descriptorBuffer, descriptorBegin + 1, descriptorEnd - 1);
              case '(':
                  return new Type(METHOD, descriptorBuffer, descriptorBegin, descriptorEnd);
              default:
                  throw new IllegalArgumentException();

@@ -670,14 +675,19 @@
              } else {
                  throw new AssertionError();
              }
              stringBuilder.append(descriptor);
          } else {
-             stringBuilder.append('L').append(getInternalName(currentClass)).append(';');
+             stringBuilder.append(isPrimitiveClass(currentClass) ? 'Q' : 'L').append(getInternalName(currentClass)).append(';');
          }
      }
  
+     static boolean isPrimitiveClass(Class<?> clazz) {
+         int mods = clazz.getModifiers();
+         return (mods & 0x00000100) != 0;
+     }
+ 
      // -----------------------------------------------------------------------------------------------
      // Methods to get the sort, dimension, size, and opcodes corresponding to a Type or descriptor.
      // -----------------------------------------------------------------------------------------------
  
      /**

@@ -767,11 +777,12 @@
                  argumentsSize += 2;
              } else {
                  while (methodDescriptor.charAt(currentOffset) == '[') {
                      currentOffset++;
                  }
-                 if (methodDescriptor.charAt(currentOffset++) == 'L') {
+                 char c = methodDescriptor.charAt(currentOffset++);
+                 if (c == 'L' || c == 'Q') {
                      // Skip the argument descriptor content.
                      int semiColumnOffset = methodDescriptor.indexOf(';', currentOffset);
                      currentOffset = Math.max(currentOffset, semiColumnOffset + 1);
                  }
                  argumentsSize += 1;
< prev index next >