< prev index next >

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

Print this page

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

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

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