Skip to content

Conversation

@xiaoyuuuuuupeng
Copy link
Contributor

What is the purpose of the change

when option java_outer_classname is empty and use Dubbo3TripleGenerator generate code , the DubboxxxServiceTriple has error.
My proto file :

syntax="proto3";
option java_package="com.example.dubbo.proto";
option java_multiple_files=true;
service TestService {
  rpc echo(EchoReq)returns(EchoRes);
}

message EchoReq{
  string name = 1;
}

message EchoRes{
  string msg = 1;
}

and protoc-plugin

  <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.6.1</version>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <protocPlugins>
                        <protocPlugin>
                            <id>dubbo</id>
                            <groupId>org.apache.dubbo</groupId>
                            <artifactId>dubbo-compiler</artifactId>
                            <version>3.0.10</version>
                            <mainClass>org.apache.dubbo.gen.tri.Dubbo3TripleGenerator</mainClass>
                        </protocPlugin>
                    </protocPlugins>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                            <goal>compile-custom</goal>
                            <goal>test-compile-custom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

generated code DubboTestServiceTriple cannot find the TestServiceOuterClass
WechatIMG24353

fixed: Dubbo3TripleGenerator use OuterClassName error

Brief changelog

1、change ProtoType util getJavaOuterClassname method from private to public
2、when option java_outer_classname is empty,serviceContext.outerClassName use ProtoType.getJavaOuterClassname method generate.

Verifying this change

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@sonarqubecloud
Copy link

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

@codecov-commenter
Copy link

codecov-commenter commented Nov 14, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.76%. Comparing base (c877d6e) to head (f1d599c).
⚠️ Report is 1196 commits behind head on 3.3.

Additional details and impacted files
@@            Coverage Diff             @@
##              3.3   #13355      +/-   ##
==========================================
- Coverage   40.77%   40.76%   -0.01%     
==========================================
  Files        1805     1805              
  Lines       75644    75644              
  Branches    10617    10617              
==========================================
- Hits        30841    30839       -2     
- Misses      40487    40499      +12     
+ Partials     4316     4306      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlbumenJ AlbumenJ merged commit 3171208 into apache:3.3 Nov 14, 2023
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.

3 participants