private void resolveTypeReferences(ProtoContext context) { Proto proto = context.getProto(); Deque<String> scopeLookupList = createScopeLookupList(proto); for (Service service : proto.getServices()) { for (ServiceMethod method : service.getMethods()) { String argTypeName = method.getArgTypeName(); FieldType argType = resolveFieldType(method, context, scopeLookupList, argTypeName); if (!(argType instanceof Message)) { String format = "Cannot use '%s' as a service method argument type: not a message"; throw new ParserException(method, format, argType.getName()); } method.setArgType((Message) argType); String returnTypeName = method.getReturnTypeName(); FieldType returnType = resolveFieldType(method, context, scopeLookupList, returnTypeName); if (!(returnType instanceof Message)) { String format = "Cannot use '%s' as a service method return type: not a message"; throw new ParserException(method, format, returnType.getName()); } method.setReturnType((Message) returnType); } } resolveTypeReferences(context, scopeLookupList, proto); }
private void resolveTypeReferences(ProtoContext context) { Proto proto = context.getProto(); Deque<String> scopeLookupList = createScopeLookupList(proto); for (Service service : proto.getServices()) { for (ServiceMethod method : service.getMethods()) { String argTypeName = method.getArgTypeName(); FieldType argType = resolveFieldType(method, context, scopeLookupList, argTypeName); if (!(argType instanceof Message)) { String format = "Cannot use '%s' as a service method argument type: not a message"; throw new ParserException(method, format, argType.getName()); } method.setArgType((Message) argType); String returnTypeName = method.getReturnTypeName(); FieldType returnType = resolveFieldType(method, context, scopeLookupList, returnTypeName); if (!(returnType instanceof Message)) { String format = "Cannot use '%s' as a service method return type: not a message"; throw new ParserException(method, format, returnType.getName()); } method.setReturnType((Message) returnType); } } resolveTypeReferences(context, scopeLookupList, proto); }