Java Generated Code Findbugs Violation: UCF_USELESS_CONTROL_FLOW
What version of protobuf and what language are you using? Version: v3.6.0 Language: Java
What operating system (Linux, Windows, ...) and version? Mac Mojave 10.14.2 (18C54)
What runtime / compiler are you using (e.g., python version or gcc version)
Via Maven Plugin: http://os72.github.io/protoc-jar-maven-plugin
Plugin Source: https://github.com/os72/protoc-jar-maven-plugin
Plugin Version: 3.6.0.2 Protoc Version: 3.6.1 Library Version: com.google.protobuf:protobuf-java:3.6.1
What did you do?
- git clone https://github.com/InscopeMetrics/client-protocol.git
- cd client-protocol
- git checkout proto-findbugs-issue
- mvn verify
What did you expect to see
[INFO] --- findbugs-maven-plugin:3.0.5:check (findbugs-check) @ protocol ---
[INFO] BugInstance size is 0
[INFO] Error size is 0
[INFO] No errors/warnings found
What did you see instead?
[INFO] --- findbugs-maven-plugin:3.0.5:check (findbugs-check) @ protocol ---
[INFO] BugInstance size is 10
[INFO] Error size is 0
[INFO] Total bugs: 10
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV1$AnnotationEntry$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV1$AnnotationEntry$Builder] At ClientV1.java:[line 5908] UCF_USELESS_CONTROL_FLOW
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV1$DimensionEntry$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV1$DimensionEntry$Builder] At ClientV1.java:[line 6595] UCF_USELESS_CONTROL_FLOW
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV1$DoubleQuantity$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV1$DoubleQuantity$Builder] At ClientV1.java:[line 7257] UCF_USELESS_CONTROL_FLOW
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV1$Unit$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV1$Unit$Builder] At ClientV1.java:[line 4122] UCF_USELESS_CONTROL_FLOW
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV2$AnnotationEntry$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV2$AnnotationEntry$Builder] At ClientV2.java:[line 6750] UCF_USELESS_CONTROL_FLOW
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV2$DimensionEntry$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV2$DimensionEntry$Builder] At ClientV2.java:[line 7437] UCF_USELESS_CONTROL_FLOW
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV2$Quantity$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV2$Quantity$Builder] At ClientV2.java:[line 8196] UCF_USELESS_CONTROL_FLOW
[INFO] Useless control flow in com.inscopemetrics.client.protocol.ClientV2$Unit$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV2$Unit$Builder] At ClientV2.java:[line 4964] UCF_USELESS_CONTROL_FLOW
...
Anything else we should know about your project / environment
The project includes JDK Wrapper and Maven Wrapper so it can be run without installing these dependencies using ./jdk-wrapper.sh ./mvnw verify
Findbugs is deprecated; however, the issue is also flagged by its successor Spotbugs:
[INFO] --- spotbugs-maven-plugin:3.1.12:check (spotbugs-check) @ protocol ---
[INFO] BugInstance size is 10
[INFO] Error size is 0
[INFO] Total bugs: 10
[ERROR] Useless control flow in com.inscopemetrics.client.protocol.ClientV1$AnnotationEntry$Builder.maybeForceBuilderInitialization() [com.inscopemetrics.client.protocol.ClientV1$AnnotationEntry$Builder] At ClientV1.java:[line 5931] UCF_USELESS_CONTROL_FLOW
...
Could you copy and paste one of the examples of useless control flow from the generated code here? Thanks.
In Builder methods I see conditions withouth body
private void maybe***() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
Is there any progress?
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.