This generates two annotations that potentially collide.
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ObjectiveOption {
float value();
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ObjectiveOption {
float value();
}
I really like the name ObjectiveOption here and am reluctant to qualify the name with its target ObjectiveMethodOption because this collision is just so rare. Instead I’d like to introduce a mechanism where developers who introduce such collisions in the .proto can choose disambiguating names.
We’ll create a new extension:
extend google.protobuf.FieldOptions {
/**
* Sets the name used for this field in generated code.
*
* This may only be applied to extension fields, and only impacts the generated names for option
* annotations.
*
* It is an error to apply this option to regular message fields and oneof fields.
*
* This doesn't impact the name used an any encoding or decoding, such as JSON encoding.
*/
optional string wire_name = 9999; // TODO
}
We’ve got a problem where Wire generates broken code when the same option name is used for different targets in the same package.
This generates two annotations that potentially collide.
I really like the name
ObjectiveOption
here and am reluctant to qualify the name with its targetObjectiveMethodOption
because this collision is just so rare. Instead I’d like to introduce a mechanism where developers who introduce such collisions in the.proto
can choose disambiguating names.We’ll create a new extension:
And users would use it like so: