RFR: JDK-8312418: Add Elements.getEnumConstantBody [v5]

Pavel Rappo prappo at openjdk.org
Thu Aug 24 22:19:15 UTC 2023

On Thu, 24 Aug 2023 20:08:49 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Trivial implementation to get feedback on the proposed API.
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
>   Refactor as suggested by jjg.

src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 779:

> 777:     default TypeElement getEnumConstantBody(VariableElement enumConstant) {
> 778:         switch(enumConstant.getKind()) {
> 779:         case ENUM_CONSTANT -> throw new UnsupportedOperationException();

Hm... Most retrofitted methods in this API return null or false, not throw UnsupportedOperationException. The only other exception seems to be Elements.getFileObjectOf. Is this the new approach, or it just does make more sense for these two particular methods?


PR Review Comment: https://git.openjdk.org/jdk/pull/14939#discussion_r1304926293

More information about the compiler-dev mailing list