Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4459

Type annotations defeat org.jboss:jandex bytecode parser sometimes

    XMLWordPrintableJSON

    Details

      Description

      For instance, the following code in org.apache.calcite.linq4j.EnumerableDefaults.WrapMap

          @Override public Set<Entry<@KeyFor("this") K, V>> entrySet() {
            return new AbstractSet<Entry<@KeyFor("this") K, V>>() {
      

      produces the following exception with org.jboss:jandex:2.0.3.Final

      Caused by: java.lang.IllegalStateException: Class extends type annotation appeared on a non class target
        at org.jboss.jandex.Indexer.processTypeAnnotation(Indexer.java:403)
        at org.jboss.jandex.Indexer.processTypeAnnotations(Indexer.java:380)
        at org.jboss.jandex.Indexer.processAttributes(Indexer.java:314)
        at org.jboss.jandex.Indexer.processMethodInfo(Indexer.java:271)
        at org.jboss.jandex.Indexer.index(Indexer.java:1454)
      

      Note: Calcite bytecode is perfectly valid (provided a recent javac is used), however, jandex is used by Hibernate, Quarkus (and other projects), so it might result in non-tirival exceptions like IllegalStateException: Class extends type annotation appeared on a non class target while users would have absolutely no clue which class causes failure and why.

      Sample jandex issues: https://github.com/wildfly/jandex/issues/98, https://github.com/wildfly/jandex/issues/88, https://github.com/wildfly/jandex/issues/80, and others.

      I suggest we parse Calcite-produced classes with Jandex, so we know when incompatibility happens.

      Here's the same case for pgjdbc/pgjdbc: https://github.com/pgjdbc/pgjdbc/pull/2010

        Attachments

          Activity

            People

            • Assignee:
              vladimirsitnikov Vladimir Sitnikov
              Reporter:
              vladimirsitnikov Vladimir Sitnikov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m