< prev index next >

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

Print this page

 97         int offset; // Current offset in the parsed signature (parsed from left to right).
 98         char currentChar; // The signature character at 'offset', or just before.
 99 
100         // If the signature starts with '<', it starts with TypeParameters, i.e. a formal type parameter
101         // identifier, followed by one or more pair ':',ReferenceTypeSignature (for its class bound and
102         // interface bounds).
103         if (signature.charAt(0) == '<') {
104             // Invariant: offset points to the second character of a formal type parameter name at the
105             // beginning of each iteration of the loop below.
106             offset = 2;
107             do {
108                 // The formal type parameter name is everything between offset - 1 and the first ':'.
109                 int classBoundStartOffset = signature.indexOf(':', offset);
110                 signatureVistor.visitFormalTypeParameter(
111                         signature.substring(offset - 1, classBoundStartOffset));
112 
113                 // If the character after the ':' class bound marker is not the start of a
114                 // ReferenceTypeSignature, it means the class bound is empty (which is a valid case).
115                 offset = classBoundStartOffset + 1;
116                 currentChar = signature.charAt(offset);
117                 if (currentChar == 'L' || currentChar == '[' || currentChar == 'T') {
118                     offset = parseType(signature, offset, signatureVistor.visitClassBound());
119                 }
120 
121                 // While the character after the class bound or after the last parsed interface bound
122                 // is ':', we need to parse another interface bound.
123                 while ((currentChar = signature.charAt(offset++)) == ':') {
124                     offset = parseType(signature, offset, signatureVistor.visitInterfaceBound());
125                 }
126 
127                 // At this point a TypeParameter has been fully parsed, and we need to parse the next one
128                 // (note that currentChar is now the first character of the next TypeParameter, and that
129                 // offset points to the second character), unless the character just after this
130                 // TypeParameter signals the end of the TypeParameters.
131             } while (currentChar != '>');
132         } else {
133             offset = 0;
134         }
135 
136         // If the (optional) TypeParameters is followed by '(' this means we are parsing a
137         // MethodSignature, which has JavaTypeSignature type inside parentheses, followed by a Result

 97         int offset; // Current offset in the parsed signature (parsed from left to right).
 98         char currentChar; // The signature character at 'offset', or just before.
 99 
100         // If the signature starts with '<', it starts with TypeParameters, i.e. a formal type parameter
101         // identifier, followed by one or more pair ':',ReferenceTypeSignature (for its class bound and
102         // interface bounds).
103         if (signature.charAt(0) == '<') {
104             // Invariant: offset points to the second character of a formal type parameter name at the
105             // beginning of each iteration of the loop below.
106             offset = 2;
107             do {
108                 // The formal type parameter name is everything between offset - 1 and the first ':'.
109                 int classBoundStartOffset = signature.indexOf(':', offset);
110                 signatureVistor.visitFormalTypeParameter(
111                         signature.substring(offset - 1, classBoundStartOffset));
112 
113                 // If the character after the ':' class bound marker is not the start of a
114                 // ReferenceTypeSignature, it means the class bound is empty (which is a valid case).
115                 offset = classBoundStartOffset + 1;
116                 currentChar = signature.charAt(offset);
117                 if (currentChar == 'L' || currentChar == 'Q' || currentChar == '[' || currentChar == 'T') {
118                     offset = parseType(signature, offset, signatureVistor.visitClassBound());
119                 }
120 
121                 // While the character after the class bound or after the last parsed interface bound
122                 // is ':', we need to parse another interface bound.
123                 while ((currentChar = signature.charAt(offset++)) == ':') {
124                     offset = parseType(signature, offset, signatureVistor.visitInterfaceBound());
125                 }
126 
127                 // At this point a TypeParameter has been fully parsed, and we need to parse the next one
128                 // (note that currentChar is now the first character of the next TypeParameter, and that
129                 // offset points to the second character), unless the character just after this
130                 // TypeParameter signals the end of the TypeParameters.
131             } while (currentChar != '>');
132         } else {
133             offset = 0;
134         }
135 
136         // If the (optional) TypeParameters is followed by '(' this means we are parsing a
137         // MethodSignature, which has JavaTypeSignature type inside parentheses, followed by a Result
< prev index next >