Skip to content

Missing whitespace on case in zuul-core/.../Http2MetricsChannelHandlers.java with If-else-if-else to switch #7458

@timtebeek

Description

@timtebeek

Problem

Describe the issue you are experiencing.

Expected behavior

Describe what you expected to see.

Example diff

From: zuul-core/src/main/java/com/netflix/netty/common/metrics/Http2MetricsChannelHandlers.java

protected void incrementCounter(Registry registry, String counterName, String metricId, Http2Frame frame) {
long errorCode;
-        if (frame instanceof Http2ResetFrame resetFrame) {
-            errorCode = resetFrame.errorCode();
-        } else if (frame instanceof Http2GoAwayFrame goAwayFrame) {
-            errorCode = goAwayFrame.errorCode();
-        } else {
-            errorCode = -1;
+        switch (frame) {
+            caseHttp2ResetFrame resetFrame -> errorCode = resetFrame.errorCode();
+            caseHttp2GoAwayFrame goAwayFrame -> errorCode = goAwayFrame.errorCode();
+            case null -> errorCode = -1;
}

registry.counter(counterName, "id", metricId, "frame", frame.name(), "error_code", Long.toString(errorCode))

Recipes in example diff:

  • org.openrewrite.java.migrate.lang.IfElseIfConstructToSwitch
  • org.openrewrite.java.migrate.UpgradeJavaVersion

References:

  • View original result
  • Recipe ID: org.openrewrite.java.migrate.lang.IfElseIfConstructToSwitch
  • Recipe Name: If-else-if-else to switch
  • Repository: Netflix/zuul/master
  • Created at Wed Apr 22 2026 22:15:03 GMT+0200 (Central European Summer Time)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions