uschindler commented on PR #13329:
URL: https://github.com/apache/lucene/pull/13329#issuecomment-2085327836
Here is my code that works:
```java
/**
* Return true if the method is synthetic enum (values/valueOf) or record
accessor method.
* According to the doctree documentation, the "included" set never
includes synthetic/mandated elements.
* UweSays: It should not happen but it happens!
*/
private boolean isSyntheticMethod(Element element) {
// exclude all not explicitely declared methods
if (elementUtils.getOrigin(element) != Origin.EXPLICIT) {
return true;
}
// exclude record accessors
if (element instanceof ExecutableElement ex &&
elementUtils.recordComponentFor(ex) != null) {
return true;
}
// exclude special enum methods
String simpleName = element.getSimpleName().toString();
if (simpleName.equals("values") || simpleName.equals("valueOf")) {
if (element.getEnclosingElement().getKind() == ElementKind.ENUM) {
return true;
}
}
return false;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]