-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRDGenerator: Change format
in @PrinterColumn
to enum
#6455
Comments
I have already worked on this and discovered a blocker at least for me. If we change the annotation param If I run the unit tests, I can cast it to the enum. But if I run this via the annotation processor, I'm not able to cast it. How can I get the value of an enum from an annotation if sundrio's AptContext is used? |
I don't know about the right direction or the right approach when dealing with APT. The only thing I can suggest is to do a hacky |
Thanks, you got me somehow into the right direction. // o is in case of running as annotation processor an instance of com.sun.tools.javac.code.Symbol$VarSymbol
private static Optional<PrinterColumnFormat> findPrinterColumnFormat(Object o) {
if (o == null) {
return Optional.empty();
}
if (o instanceof PrinterColumnFormat) {
return Optional.of((PrinterColumnFormat) o);
}
String symbol = o.toString();
return Arrays.stream(PrinterColumnFormat.values())
.filter(f -> f.name().equals(symbol))
.findFirst();
} Will polish the MR further in the next days. |
format
in @PrinterColum
to enumformat
in @PrinterColum
to enum
format
in @PrinterColum
to enumformat
in @PrinterColumn
to enum
Is your task related to a problem? Please describe
To align with the upcoming
@AdditionalPrinterColumn
annotation and to make this typesafe, the type offormat
in@PrinterColumn
should be changed to an enum.Describe the solution you'd like
This enum should be shared between
@AdditionalPrinterColumn
and@PrinterColumn
.Describe alternatives you've considered
Phase it out:
formatStrict
, deprecateformat
(with 7.0)format
with enum param, deprecateformatStrict
(with 8.0)formatStrict
(with 9.0)Additional context
First discussed here:
Note that this would be a breaking change.
The text was updated successfully, but these errors were encountered: