Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong return types for StubMethodDescriptor #13200

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

namelessssssssssss
Copy link
Contributor

The StubMethodDescriptor seems to have wrong returnTypes when initialized.

   public StubMethodDescriptor(String methodName,
        Class<?> requestClass,
        Class<?> responseClass,
        StubServiceDescriptor serviceDescriptor,
        RpcType rpcType,
        Pack requestPack,
        Pack responsePack,
        UnPack requestUnpack,
        UnPack responseUnpack) {
        this.methodName = methodName;
        this.serviceDescriptor = serviceDescriptor;
        this.rpcType = rpcType;
        this.requestPack = requestPack;
        this.responsePack = responsePack;
        this.responseUnpack = responseUnpack;
        this.requestUnpack = requestUnpack;
        this.parameterClasses = new Class<?>[]{requestClass};
        this.returnClass = responseClass;
        this.paramDesc = ReflectUtils.getDesc(parameterClasses);
        this.compatibleParamSignatures = Stream.of(parameterClasses).map(Class::getName).toArray(String[]::new);
       //It this correct?
        this.returnTypes = new Type[]{requestClass, requestClass};
        serviceDescriptor.addMethod(this);
    }

This problem has no effect if we only use triple protocol, because TripleInvoker only use param returnClass to get method return type.
But it may cause a serialization problem when other protocols use protobuf serialization with triple stub.

@namelessssssssssss namelessssssssssss marked this pull request as ready for review October 14, 2023 06:31
@codecov-commenter
Copy link

codecov-commenter commented Oct 14, 2023

Codecov Report

❗ No coverage uploaded for pull request base (3.3@3e50bdd). Click here to learn what that means.
The diff coverage is n/a.

@@          Coverage Diff           @@
##             3.3   #13200   +/-   ##
======================================
  Coverage       ?   68.41%           
  Complexity     ?        8           
======================================
  Files          ?     1717           
  Lines          ?    70801           
  Branches       ?    10236           
======================================
  Hits           ?    48437           
  Misses         ?    17681           
  Partials       ?     4683           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sonarcloud
Copy link

sonarcloud bot commented Oct 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@AlbumenJ AlbumenJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@namelessssssssssss
Copy link
Contributor Author

issue #13158

Copy link
Member

@EarthChen EarthChen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EarthChen EarthChen merged commit 027aba5 into apache:3.3 Oct 17, 2023
14 checks passed
@AlbumenJ
Copy link
Member

Please also fix on 3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants