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

Cannot access org.immutables.value.Value error when extending standard rules

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.32.0
    • None
    • core
    • None
    • Tested with JDK 8, 11, 17, 19

       

    Description

      A compilation error is raised when a project depends on calcite-core (version 1.28.0 onwards) and log4j2-core and there is a custom rule extending some standard rule from Calcite, which uses the [Immutables library](https://immutables.github.io/) @Value annotation.

      The error is the following:

      [ERROR] cannot access org.immutables.value.Value
      [ERROR]   class file for org.immutables.value.Value not found
      

      To reproduce the problem it suffices to do the following.

      1. Create a maven project with the following dependencies:

      <dependency>
            <groupId>org.apache.calcite</groupId>
            <artifactId>calcite-core</artifactId>
            <version>1.32.0</version>
          </dependency>
          <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.17.1</version>
          </dependency>
      

      2. Write a rule that extends some standard rule from Calcite.

      import org.apache.calcite.rel.rules.ProjectMergeRule;
      
      public class MyProjectMergeRule extends ProjectMergeRule {
        public MyProjectMergeRule(Config config) {
          super(config);
        }
      }
      

      3. Compile the project

      mvn clean install
      

      The problem is not dependent to a specific JDK or maven version but does require log4j-core to be in the classpath; log4j-core has an annotation processor and this somehow triggers the problem when the annotations are not in the classpath (LOG4J2-3609).

      Calcite does not declare the immutable annotations as an implementation dependency thus the annatations are not present in (the classpath of) 3rd party projects depending on calcite-core.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zabetak Stamatis Zampetakis
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: