During a recent code review for a PR in Liberty Tools for IntelliJ (https://github.com/OpenLiberty/liberty-tools-intellij/pull/1037) we noticed a comment in the code "A single field cannot have the same" which we couldn't make sense of and started to wonder whether the constraint being checked is correct. A diagnostic is reported if both the "jakarta.persistence.MapKey" and "jakarta.persistence.MapKeyClass" are present. We should check if that's actually correct and if it is, update this comment to accurately state what the constraint is. It would be best if it contained a link / reference to the relevant portion of the Jakarta Persistence spec.
if (hasMapKeyAnnotation && hasMapKeyClassAnnotation) {
// A single field cannot have the same
Range range = PositionUtils.toNameRange(method, context.getUtils());
diagnostics.add(context.createDiagnostic(uri,
Messages.getMessage("MapKeyAnnotationsNotOnSameMethod"), range,
Constants.DIAGNOSTIC_SOURCE, null,
ErrorCode.InvalidMapKeyAnnotationsOnSameMethod, DiagnosticSeverity.Error));
}
During a recent code review for a PR in Liberty Tools for IntelliJ (https://github.com/OpenLiberty/liberty-tools-intellij/pull/1037) we noticed a comment in the code "A single field cannot have the same" which we couldn't make sense of and started to wonder whether the constraint being checked is correct. A diagnostic is reported if both the "jakarta.persistence.MapKey" and "jakarta.persistence.MapKeyClass" are present. We should check if that's actually correct and if it is, update this comment to accurately state what the constraint is. It would be best if it contained a link / reference to the relevant portion of the Jakarta Persistence spec.