Skip to content

wire-grade-plugin strips deprecated option from EnumTypes #3075

Description

@aaron-edwards

When generating java and kotlin enums that have the option deprecated = true; flag the resulting enum generated does not contain the @Deprecated annotation. This appears to be due to the pruning functionality not retaining the deprecated flag and only affects the enum classes (enum constants, messages and fields all work as expected)

test/period.proto

syntax = "proto2";

enum Period {
  option deprecated = true;
  CRETACEOUS = 1;
}

build/Period.kt

// Code generated by Wire protocol buffer compiler, do not edit.
// Source: Period in period.proto
@file:Suppress(
  "DEPRECATION",
  "RUNTIME_ANNOTATION_NOT_SUPPORTED",
)

import com.squareup.wire.EnumAdapter
import com.squareup.wire.ProtoAdapter
import com.squareup.wire.Syntax.PROTO_2
import com.squareup.wire.WireEnum
import com.squareup.wire.`internal`.JvmField
import com.squareup.wire.`internal`.JvmStatic
import kotlin.Int
import kotlin.Suppress

public enum class Period(
  override val `value`: Int,
) : WireEnum {
  CRETACEOUS(1),
  ;

...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions