Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-11 Thread Joe Darcy
On Fri, 11 Feb 2022 15:24:45 GMT, Sam Brannen wrote: >> Joe Darcy has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Respond to review feedback. > > src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java >

Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-11 Thread Sam Brannen
On Thu, 10 Feb 2022 22:12:57 GMT, Joe Darcy wrote: >> Two changes to the toString output for annotations to give better source >> fidelity: >> >> 1) For enum constants, call their name method rather than their toString >> method. An enum class can override the toString method to print

Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-11 Thread Sam Brannen
On Thu, 10 Feb 2022 22:09:16 GMT, Joe Darcy wrote: >> src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java >> line 256: >> >>> 254: return Objects.toString(finalComponent.getCanonicalName(), >>> 255: "") + >>> 256:

Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-11 Thread Sam Brannen
On Thu, 10 Feb 2022 22:12:57 GMT, Joe Darcy wrote: >> Two changes to the toString output for annotations to give better source >> fidelity: >> >> 1) For enum constants, call their name method rather than their toString >> method. An enum class can override the toString method to print

Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-10 Thread Jaikiran Pai
On Thu, 10 Feb 2022 22:08:27 GMT, Joe Darcy wrote: >> src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java >> line 197: >> >>> 195: // Predicate above covers enum constants, including >>> 196: // those with specialized class

Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-10 Thread Joe Darcy
On Thu, 10 Feb 2022 14:04:01 GMT, Jaikiran Pai wrote: > Hello Joe, would it be better to use the new syntax for `instanceof` here to > avoid the subsequent cast? > > ``` > else if (value instanceof Enum v) > > return toSourceString(v); > ``` Fair point; updated in subsequent push.

Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-10 Thread Joe Darcy
On Thu, 10 Feb 2022 14:56:46 GMT, Sam Brannen wrote: >> Joe Darcy has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Respond to review feedback. > > src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java >

Re: RFR: JDK-8281462: Annotation toString output for enum not reusable for source input [v2]

2022-02-10 Thread Joe Darcy
> Two changes to the toString output for annotations to give better source > fidelity: > > 1) For enum constants, call their name method rather than their toString > method. An enum class can override the toString method to print something > other than the name. > > 2) Switch from using