< prev index next >

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

Print this page

1401             case 'Z':
1402             case 'C':
1403             case 'B':
1404             case 'S':
1405             case 'I':
1406             case 'F':
1407             case 'J':
1408             case 'D':
1409                 return startPos + 1;
1410             case '[':
1411                 int pos = startPos + 1;
1412                 while (pos < descriptor.length() && descriptor.charAt(pos) == '[') {
1413                     ++pos;
1414                 }
1415                 if (pos < descriptor.length()) {
1416                     return checkDescriptor(version, descriptor, pos, false);
1417                 } else {
1418                     throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
1419                 }
1420             case 'L':

1421                 int endPos = descriptor.indexOf(';', startPos);
1422                 if (startPos == -1 || endPos - startPos < 2) {
1423                     throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
1424                 }
1425                 try {
1426                     checkInternalClassName(version, descriptor.substring(startPos + 1, endPos), null);
1427                 } catch (IllegalArgumentException e) {
1428                     throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor, e);
1429                 }
1430                 return endPos + 1;
1431             default:
1432                 throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
1433         }
1434     }
1435 
1436     /**
1437       * Checks that the given string is a valid method descriptor.
1438       *
1439       * @param version the class version.
1440       * @param descriptor the string to be checked.

1401             case 'Z':
1402             case 'C':
1403             case 'B':
1404             case 'S':
1405             case 'I':
1406             case 'F':
1407             case 'J':
1408             case 'D':
1409                 return startPos + 1;
1410             case '[':
1411                 int pos = startPos + 1;
1412                 while (pos < descriptor.length() && descriptor.charAt(pos) == '[') {
1413                     ++pos;
1414                 }
1415                 if (pos < descriptor.length()) {
1416                     return checkDescriptor(version, descriptor, pos, false);
1417                 } else {
1418                     throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
1419                 }
1420             case 'L':
1421             case 'Q':
1422                 int endPos = descriptor.indexOf(';', startPos);
1423                 if (startPos == -1 || endPos - startPos < 2) {
1424                     throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
1425                 }
1426                 try {
1427                     checkInternalClassName(version, descriptor.substring(startPos + 1, endPos), null);
1428                 } catch (IllegalArgumentException e) {
1429                     throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor, e);
1430                 }
1431                 return endPos + 1;
1432             default:
1433                 throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
1434         }
1435     }
1436 
1437     /**
1438       * Checks that the given string is a valid method descriptor.
1439       *
1440       * @param version the class version.
1441       * @param descriptor the string to be checked.
< prev index next >