Skip to content

NPE in ComponentMetaData.fullName when another annotation processor fails #475

@benalexau

Description

@benalexau

Affects: 3.9-RC3, 3.9

Works in: 3.9-RC2

Cause: One of these commits between RC2 and RC3:

Stack trace:

  java.lang.NullPointerException: Cannot invoke "String.contains(java.lang.CharSequence)" because "topPackage" is null
      at io.avaje.jsonb.generator.ComponentMetaData.fullName(ComponentMetaData.java:53)
      at io.avaje.jsonb.generator.JsonbProcessor.process(JsonbProcessor.java:133)

Step to reproduce:

  <?xml version="1.0" encoding="UTF-8"?>
  <project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>test</groupId>
    <artifactId>jsonb-test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
      <maven.compiler.release>21</maven.compiler.release>
    </properties>
    <dependencies>
      <dependency>
        <groupId>io.avaje</groupId>
        <artifactId>avaje-jsonb</artifactId>
        <version>3.9</version>
      </dependency>
      <dependency>
        <groupId>io.avaje</groupId>
        <artifactId>avaje-spi-service</artifactId>
        <version>2.14</version>
      </dependency>
    </dependencies>
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.13.0</version>
          <configuration>
            <annotationProcessorPaths>
              <path>
                <groupId>io.avaje</groupId>
                <artifactId>avaje-spi-service</artifactId>
                <version>2.14</version>
              </path>
              <path>
                <groupId>io.avaje</groupId>
                <artifactId>avaje-jsonb-generator</artifactId>
                <version>3.9</version>
              </path>
            </annotationProcessorPaths>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </project>

Then in src/main/java/test/BadService.java:

package test;

import io.avaje.spi.ServiceProvider;

@ServiceProvider(DoesNotExist.class)
public class BadService {}

Run mvn clean compile.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions