1 /*
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
151 }
152
153 @Override
154 public JavaType getParameterType(int index, ResolvedJavaType accessingClass) {
155 if (accessingClass == null) {
156 // Caller doesn't care about resolution context so return an unresolved
157 // or primitive type (primitive type resolution is context free)
158 return getUnresolvedOrPrimitiveType(runtime, parameters.get(index));
159 }
160 if (parameterTypes == null) {
161 parameterTypes = new ResolvedJavaType[parameters.size()];
162 }
163
164 ResolvedJavaType type = parameterTypes[index];
165 if (!checkValidCache(type, accessingClass)) {
166 JavaType result = runtime.lookupType(parameters.get(index), (HotSpotResolvedObjectType) accessingClass, false);
167 if (result instanceof ResolvedJavaType) {
168 type = (ResolvedJavaType) result;
169 parameterTypes[index] = type;
170 } else {
171 return result;
172 }
173 }
174 return type;
175 }
176
177 @Override
178 public String toMethodDescriptor() {
179 assert originalString.equals(Signature.super.toMethodDescriptor());
180 return originalString;
181 }
182
183 @Override
184 public JavaKind getReturnKind() {
185 return JavaKind.fromTypeString(returnType);
186 }
187
188 @Override
189 public JavaType getReturnType(ResolvedJavaType accessingClass) {
190 if (accessingClass == null) {
191 // Caller doesn't care about resolution context so return an unresolved
192 // or primitive type (primitive type resolution is context free)
193 return getUnresolvedOrPrimitiveType(runtime, returnType);
194 }
195 if (!checkValidCache(returnTypeCache, accessingClass)) {
196 JavaType result = runtime.lookupType(returnType, (HotSpotResolvedObjectType) accessingClass, false);
197 if (result instanceof ResolvedJavaType) {
198 returnTypeCache = (ResolvedJavaType) result;
199 } else {
|
1 /*
2 * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
151 }
152
153 @Override
154 public JavaType getParameterType(int index, ResolvedJavaType accessingClass) {
155 if (accessingClass == null) {
156 // Caller doesn't care about resolution context so return an unresolved
157 // or primitive type (primitive type resolution is context free)
158 return getUnresolvedOrPrimitiveType(runtime, parameters.get(index));
159 }
160 if (parameterTypes == null) {
161 parameterTypes = new ResolvedJavaType[parameters.size()];
162 }
163
164 ResolvedJavaType type = parameterTypes[index];
165 if (!checkValidCache(type, accessingClass)) {
166 JavaType result = runtime.lookupType(parameters.get(index), (HotSpotResolvedObjectType) accessingClass, false);
167 if (result instanceof ResolvedJavaType) {
168 type = (ResolvedJavaType) result;
169 parameterTypes[index] = type;
170 } else {
171 assert result != null;
172 return result;
173 }
174 }
175 assert type != null;
176 return type;
177 }
178
179 @Override
180 public String toMethodDescriptor() {
181 assert originalString.equals(Signature.super.toMethodDescriptor()) : originalString + " != " + Signature.super.toMethodDescriptor();
182 return originalString;
183 }
184
185 @Override
186 public JavaKind getReturnKind() {
187 return JavaKind.fromTypeString(returnType);
188 }
189
190 @Override
191 public JavaType getReturnType(ResolvedJavaType accessingClass) {
192 if (accessingClass == null) {
193 // Caller doesn't care about resolution context so return an unresolved
194 // or primitive type (primitive type resolution is context free)
195 return getUnresolvedOrPrimitiveType(runtime, returnType);
196 }
197 if (!checkValidCache(returnTypeCache, accessingClass)) {
198 JavaType result = runtime.lookupType(returnType, (HotSpotResolvedObjectType) accessingClass, false);
199 if (result instanceof ResolvedJavaType) {
200 returnTypeCache = (ResolvedJavaType) result;
201 } else {
|