AnnotationBasedGenerator is not initialized when the interface is implemented by an (abstract) superclass instead of the concrete class (after upgrading to hibernate 7.3/7.4)

I wanted to file this as a JIRA issue, but I always get a permission error when
trying to create a ticket, so I’m posting it here instead.

Example

Abstract base class implementing the interface:

  public abstract class AbstractGeneration<T extends Annotation> implements BeforeExecutionGenerator, AnnotationBasedGenerator<T> {

      @Override
      public void initialize(T annotation, GeneratorCreationContext context) {
          // ...
      }
  }

Concrete generator referenced by a @ValueGenerationType annotation:

  public class ConcreteFieldGeneration extends AbstractGeneration<CustomAnnotation> {
      // does NOT declare "implements AnnotationBasedGenerator<CustomAnnotation>"
  }

Since 7.3/7.4 Hibernate fails to with AssertionFailure: "Could not find implementing interface". The change was introduced by fix the unchecked cast when initializing AnnotationBasedGenerator · hibernate/hibernate-orm@e72143d · GitHub

Workaround

Re-declare the interface on concrete subclass

Question

Was this change intentional?

This looks like a bug to me. The code should also be checking the interfaces of all the super classes of the AnnotationBasedGenerator. That code should probably use GenericsHelper.typeArguments(AnnotationBasedGenerator.class, annotationBased.getClass()) instead to determine the type variable assignment.
A pull request with an accompanying test is very much appreciated. For details about how you can make Jira work for you, take a look into these discussion mentioned here: Request for Jira issue creation permission (Hibernate ORM)

Mentioned issued didn’t solved the issue for me. I retried it now after several days. Login worked but if I click on “Create” I get “You are not authorized to perform this operation. Please log in. Close this dialog and press refresh in your browser” . I directly created an PR with my test case Resolve AnnotationBasedGenerator type argument through class hierarchy by stewue · Pull Request #12871 · hibernate/hibernate-orm · GitHub . GenericsHelper.typeArguments( AnnotationBasedGenerator.class, annotationType ) works

We have a long thread in our Zulip chat where people come by every now and then and it’s always the same

You are probably logged into another Jira organization’s account. Can you please click on your profile picture in the top-right and show us what’s there?

This topic also mentioned the problem: Trying to report a bug in Hibernate - #15 by luiscla27

Alright, clicking account icon → Login does help. Another annoying thing is that the banner is displayed only after you do that :slight_smile: . While you are authenticated, but before clicking that another Login thing, the banner is not displayed :slight_smile: .

With https://hibernate.atlassian.net/jira/for-you and my personal account (not the company account), it worked that way I was able to join and then create an issue → Jira. That didn’t work on the last attempt. Thanks