support for 'id(this)'

just changed this in JD
This commit is contained in:
Gavin King 2024-03-25 21:44:20 +01:00
parent 866585d4b6
commit 7b189d0200
1 changed files with 6 additions and 1 deletions

View File

@ -1923,7 +1923,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
final AccessType accessType = getAccessType(entityType); final AccessType accessType = getAccessType(entityType);
final String nextToken = tokens.nextToken(); final String nextToken = tokens.nextToken();
for ( Element member : context.getElementUtils().getAllMembers(entityType) ) { for ( Element member : context.getElementUtils().getAllMembers(entityType) ) {
if ( "#id".equals(nextToken) && hasAnnotation( member, ID) ) { if ( isIdRef(nextToken) && hasAnnotation( member, ID) ) {
return member; return member;
} }
final Element match = final Element match =
@ -1935,6 +1935,11 @@ public class AnnotationMetaEntity extends AnnotationMeta {
return null; return null;
} }
private static boolean isIdRef(String nextToken) {
return "#id".equals(nextToken) // for Jakarta Data M4 release
|| "id(this)".equals(nextToken); // post M4
}
private @Nullable Element memberMatchingPath( private @Nullable Element memberMatchingPath(
TypeElement entityType, TypeElement entityType,
Element candidate, Element candidate,