private void ensureParameterTypes() { if (parameterTypes == null) { parameterTypes = Arrays.stream(method.getParameterTypes()) .map(type -> context.getClass(type)) .toArray(sz -> new ReflectClass<?>[sz]); } }
private boolean isWrappedNativeCall(MethodReader method) { if (!method.hasModifier(ElementModifier.NATIVE)) { return false; } for (ValueType type : method.getParameterTypes()) { if (type.isObject(String.class)) { return true; } } return false; }
continue; if (!Arrays.equals(method.getParameterTypes(), internalParameterTypes)) { continue;
private boolean validateSignature(MethodReader method, CallLocation callLocation, boolean[] byRefParams) { if (method.getResultType() != ValueType.VOID && !typeHelper.isSupportedType(method.getResultType())) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " + "declaration, since it returns wrong type", method.getReference()); return false; } ValueType[] parameterTypes = method.getParameterTypes(); AnnotationContainerReader[] parameterAnnotations = method.getParameterAnnotations(); for (int i = 0; i < parameterTypes.length; i++) { ValueType paramType = parameterTypes[i]; if (!typeHelper.isSupportedType(paramType)) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " + "declaration: its " + (i + 1) + "th parameter has wrong type", method.getReference()); return false; } if (parameterAnnotations[i].get(JSByRef.class.getName()) != null) { if (!typeHelper.isSupportedByRefType(paramType)) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " + "declaration: its " + (i + 1) + "th parameter is declared as JSByRef, " + "which has incompatible type", method.getReference()); return false; } byRefParams[i] = true; } } return true; }
for (MethodReader reflectableMethod : cls.getMethods()) { linkType(agent, reflectableMethod.getResultType()); for (ValueType param : reflectableMethod.getParameterTypes()) { linkType(agent, param);
private void ensureParameterTypes() { if (parameterTypes == null) { parameterTypes = Arrays.stream(method.getParameterTypes()) .map(type -> context.getClass(type)) .toArray(sz -> new ReflectClass<?>[sz]); } }
continue; if (!Arrays.equals(method.getParameterTypes(), internalParameterTypes)) { continue;
private boolean validateSignature(MethodReader method, CallLocation callLocation, boolean[] byRefParams) { if (method.getResultType() != ValueType.VOID && !typeHelper.isSupportedType(method.getResultType())) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " + "declaration, since it returns wrong type", method.getReference()); return false; } ValueType[] parameterTypes = method.getParameterTypes(); AnnotationContainerReader[] parameterAnnotations = method.getParameterAnnotations(); for (int i = 0; i < parameterTypes.length; i++) { ValueType paramType = parameterTypes[i]; if (!typeHelper.isSupportedType(paramType)) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " + "declaration: its " + (i + 1) + "th parameter has wrong type", method.getReference()); return false; } if (parameterAnnotations[i].get(JSByRef.class.getName()) != null) { if (!typeHelper.isSupportedByRefType(paramType)) { diagnostics.error(callLocation, "Method {{m0}} is not a proper native JavaScript method " + "declaration: its " + (i + 1) + "th parameter is declared as JSByRef, " + "which has incompatible type", method.getReference()); return false; } byRefParams[i] = true; } } return true; }