< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/classfile/Signature.java

Print this page

125             case 'C':
126                 sigp++;
127                 return new SimpleType("char");
128 
129             case 'D':
130                 sigp++;
131                 return new SimpleType("double");
132 
133             case 'F':
134                 sigp++;
135                 return new SimpleType("float");
136 
137             case 'I':
138                 sigp++;
139                 return new SimpleType("int");
140 
141             case 'J':
142                 sigp++;
143                 return new SimpleType("long");
144 

145             case 'L':
146                 return parseClassTypeSignature();
147 
148             case 'S':
149                 sigp++;
150                 return new SimpleType("short");
151 
152             case 'T':
153                 return parseTypeVariableSignature();
154 
155             case 'V':
156                 sigp++;
157                 return new SimpleType("void");
158 
159             case 'Z':
160                 sigp++;
161                 return new SimpleType("boolean");
162 
163             case '[':
164                 sigp++;

174 
175             case '-':
176                 sigp++;
177                 return new WildcardType(WildcardType.Kind.SUPER, parseTypeSignature());
178 
179             default:
180                 throw new IllegalStateException(debugInfo());
181         }
182     }
183 
184     private List<Type> parseTypeSignatures(char term) {
185         sigp++;
186         List<Type> types = new ArrayList<>();
187         while (sig.charAt(sigp) != term)
188             types.add(parseTypeSignature());
189         sigp++;
190         return types;
191     }
192 
193     private Type parseClassTypeSignature() {
194         assert sig.charAt(sigp) == 'L';
195         sigp++;
196         return parseClassTypeSignatureRest();
197     }
198 
199     private Type parseClassTypeSignatureRest() {
200         StringBuilder sb = new StringBuilder();
201         List<Type> argTypes = null;
202         ClassType t = null;
203         char sigch ;
204 
205         do {
206             switch  (sigch = sig.charAt(sigp)) {
207                 case '<':
208                     argTypes = parseTypeSignatures('>');
209                     break;
210 
211                 case '.':
212                 case ';':
213                     sigp++;
214                     t = new ClassType(t, sb.toString(), argTypes);

125             case 'C':
126                 sigp++;
127                 return new SimpleType("char");
128 
129             case 'D':
130                 sigp++;
131                 return new SimpleType("double");
132 
133             case 'F':
134                 sigp++;
135                 return new SimpleType("float");
136 
137             case 'I':
138                 sigp++;
139                 return new SimpleType("int");
140 
141             case 'J':
142                 sigp++;
143                 return new SimpleType("long");
144 
145             case 'Q':
146             case 'L':
147                 return parseClassTypeSignature();
148 
149             case 'S':
150                 sigp++;
151                 return new SimpleType("short");
152 
153             case 'T':
154                 return parseTypeVariableSignature();
155 
156             case 'V':
157                 sigp++;
158                 return new SimpleType("void");
159 
160             case 'Z':
161                 sigp++;
162                 return new SimpleType("boolean");
163 
164             case '[':
165                 sigp++;

175 
176             case '-':
177                 sigp++;
178                 return new WildcardType(WildcardType.Kind.SUPER, parseTypeSignature());
179 
180             default:
181                 throw new IllegalStateException(debugInfo());
182         }
183     }
184 
185     private List<Type> parseTypeSignatures(char term) {
186         sigp++;
187         List<Type> types = new ArrayList<>();
188         while (sig.charAt(sigp) != term)
189             types.add(parseTypeSignature());
190         sigp++;
191         return types;
192     }
193 
194     private Type parseClassTypeSignature() {
195         assert sig.charAt(sigp) == 'L' || sig.charAt(sigp) == 'Q';
196         sigp++;
197         return parseClassTypeSignatureRest();
198     }
199 
200     private Type parseClassTypeSignatureRest() {
201         StringBuilder sb = new StringBuilder();
202         List<Type> argTypes = null;
203         ClassType t = null;
204         char sigch ;
205 
206         do {
207             switch  (sigch = sig.charAt(sigp)) {
208                 case '<':
209                     argTypes = parseTypeSignatures('>');
210                     break;
211 
212                 case '.':
213                 case ';':
214                     sigp++;
215                     t = new ClassType(t, sb.toString(), argTypes);
< prev index next >