Uploaded image for project: 'Jandex'
  1. Jandex
  2. JANDEX-40

Ignore module-info.class files when running under Java8

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 2.0.4.Final
    • 2.0.2.Final, 2.0.3.Final
    • None

      I pulled down the latest json-p api jar:
      <dependency>
      <groupId>javax.json</groupId>
      <artifactId>javax.json-api</artifactId>
      <version>1.1</version>
      </dependency>

      and included it in a WF-Swarm 2017.7.0 deployment. It ended up blowing up with an IllegalStateException. Looking into why, the problem is that the javax.json-api jar is including a module-info.class file that has been compiled with Java9. The attached TestIndexer.java test shows the problem once you have downloaded the javax.json-api jar and set its path in TestIndexer.main:

      Exception in thread "main" java.lang.IllegalStateException: Unknown tag! pos=4 poolCount = 18
      at org.jboss.jandex.Indexer.processConstantPool(Indexer.java:1417)
      at org.jboss.jandex.Indexer.index(Indexer.java:1451)
      at test.TestIndexer.loadDependentIndexFromArchive(TestIndexer.java:35)
      at test.TestIndexer.load(TestIndexer.java:46)
      at test.TestIndexer.main(TestIndexer.java:50)

      The bad tag it is running into is the new CONSTANT_Module=19 tag.

      We should guard against this now that people are starting to this, by either just explicitly skipping module-info.class file entries seen, or skip all classes that have a version greater than the current vm version.

            jgreene@redhat.com Jason Greene
            starksm64 Scott Stark (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: