Skip to content

Unable to parse generated classes during descriptor generation #944

@ascopes

Description

@ascopes

Affected version

3.15.1

Bug description

I am using org.immutables:immutables to generate code for my Maven Plugin project.

One of the components I am using is org.immutables:data which generates reflective metadata for a generated class.

It seems that the maven-plugin-plugin is attempting to parse this and falling over, despite the fact it is valid code.

The line it chokes on appears to be the following:

    public final Datatype.Feature<MavenProtocPlugin, @Nullable List<String>> jvmArgs_;

specifically at the end of the List identifier before the < that follows it.

As a result of this, I am unable to use generated code with the maven-plugin-plugin, since there is no way to ask it to skip scanning generated code -- not entirely sure why it is attempting to scan this generated code as it is not a Mojo that should be converted to documentation.

Maven: 3.9.10

Java: 17

Exception:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.15.1:descriptor (default-descriptor) on project protobuf-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.15.1:descriptor failed: syntax error @[64,68] in file:/home/ashley/code/protobuf-maven-plugin/protobuf-maven-plugin/target/generated-sources/annotations/io/github/ascopes/protobufmavenplugin/plugins/Datatypes_MavenProtocPlugin.java -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.15.1:descriptor (default-descriptor) on project protobuf-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.15.1:descriptor failed: syntax error @[64,68] in file:/home/ashley/code/protobuf-maven-plugin/protobuf-maven-plugin/target/generated-sources/annotations/io/github/ascopes/protobufmavenplugin/plugins/Datatypes_MavenProtocPlugin.java
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run (Thread.java:840)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.15.1:descriptor failed: syntax error @[64,68] in file:/home/ashley/code/protobuf-maven-plugin/protobuf-maven-plugin/target/generated-sources/annotations/io/github/ascopes/protobufmavenplugin/plugins/Datatypes_MavenProtocPlugin.java
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run (Thread.java:840)
Caused by: com.thoughtworks.qdox.parser.ParseException: syntax error @[64,68] in file:/home/ashley/code/protobuf-maven-plugin/protobuf-maven-plugin/target/generated-sources/annotations/io/github/ascopes/protobufmavenplugin/plugins/Datatypes_MavenProtocPlugin.java
    at com.thoughtworks.qdox.parser.impl.Parser.yyerror (Parser.java:2013)
    at com.thoughtworks.qdox.parser.impl.Parser.yyparse (Parser.java:2135)
    at com.thoughtworks.qdox.parser.impl.Parser.parse (Parser.java:1994)
    at com.thoughtworks.qdox.library.SourceLibrary.parse (SourceLibrary.java:232)
    at com.thoughtworks.qdox.library.SourceLibrary.parse (SourceLibrary.java:209)
    at com.thoughtworks.qdox.library.SourceLibrary.addSource (SourceLibrary.java:159)
    at com.thoughtworks.qdox.library.SortedClassLibraryBuilder.addSource (SortedClassLibraryBuilder.java:174)
    at com.thoughtworks.qdox.JavaProjectBuilder.addSource (JavaProjectBuilder.java:151)
    at com.thoughtworks.qdox.JavaProjectBuilder$2.visitFile (JavaProjectBuilder.java:224)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:103)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan (DirectoryScanner.java:81)
    at com.thoughtworks.qdox.JavaProjectBuilder.addSourceTree (JavaProjectBuilder.java:218)
    at com.thoughtworks.qdox.JavaProjectBuilder.addSourceTree (JavaProjectBuilder.java:205)
    at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.extendJavaProjectBuilder (JavaAnnotationsMojoDescriptorExtractor.java:658)
    at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.extendJavaProjectBuilder (JavaAnnotationsMojoDescriptorExtractor.java:640)
    at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.scanJavadoc (JavaAnnotationsMojoDescriptorExtractor.java:252)
    at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.execute (JavaAnnotationsMojoDescriptorExtractor.java:204)
    at org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePluginDescriptor (DefaultMojoScanner.java:97)
    at org.apache.maven.plugin.plugin.DescriptorGeneratorMojo.generate (DescriptorGeneratorMojo.java:347)
    at org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute (AbstractGeneratorMojo.java:91)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:193)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:180)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run (Thread.java:840)

Generated class:

package io.github.ascopes.protobufmavenplugin.plugins;

import com.google.common.collect.ImmutableList;
import com.google.common.reflect.TypeToken;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import org.immutables.data.Datatype;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

import java.io.IOException;
/**
 * Metamodel definitions for introspection of immutable datatypes.
 * @see ImmutableMavenProtocPlugin
 */
@SuppressWarnings("all")
@Generated("org.immutables.processor.ProxyProcessor")
@org.immutables.value.Generated(from = "io.github.ascopes.protobufmavenplugin.plugins", generator = "Datatypes")
public final class Datatypes_MavenProtocPlugin {
  @SuppressWarnings({"unchecked", "raw"})
  public static <T> Datatype<T> constuct(TypeToken<T> type) {
    Class<?> raw = type.getRawType();
    if (raw == MavenProtocPlugin.class || raw == ImmutableMavenProtocPlugin.class) {
      return (Datatype<T>) MavenProtocPlugin_.INSTANCE;
    }
    throw new IllegalArgumentException(type.toString());
  }

  public static MavenProtocPlugin_ _MavenProtocPlugin() {
    return MavenProtocPlugin_.INSTANCE;
  }


  @SuppressWarnings({"unchecked", "raw"})
  public static final class MavenProtocPlugin_ implements Datatype<MavenProtocPlugin> {
    private static final MavenProtocPlugin_ INSTANCE = new MavenProtocPlugin_(TypeToken.of(MavenProtocPlugin.class));
    public static final String NAME = "MavenProtocPlugin";
    public static final String GROUP_ID_ = "groupId";
    public static final String ARTIFACT_ID_ = "artifactId";
    public static final String TYPE_ = "type";
    public static final String CLASSIFIER_ = "classifier";
    public static final String OPTIONS_ = "options";
    public static final String OUTPUT_DIRECTORY_ = "outputDirectory";
    public static final String REGISTER_AS_COMPILATION_ROOT_ = "registerAsCompilationRoot";
    public static final String ORDER_ = "order";
    public static final String SKIP_ = "skip";
    public static final String VERSION_ = "version";
    public static final String JVM_ARGS_ = "jvmArgs";
    public static final String JVM_CONFIG_ARGS_ = "jvmConfigArgs";
    public static final String MAIN_CLASS_ = "mainClass";
    private final TypeToken<MavenProtocPlugin> type;
    public final Datatype.Feature<MavenProtocPlugin, String> groupId_;
    public final Datatype.Feature<MavenProtocPlugin, String> artifactId_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable String> type_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable String> classifier_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable String> options_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable Path> outputDirectory_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable Boolean> registerAsCompilationRoot_;
    public final Datatype.Feature<MavenProtocPlugin, Integer> order_;
    public final Datatype.Feature<MavenProtocPlugin, Boolean> skip_;
    public final Datatype.Feature<MavenProtocPlugin, @NonNull String> version_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable List<String>> jvmArgs_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable List<String>> jvmConfigArgs_;
    public final Datatype.Feature<MavenProtocPlugin, @Nullable String> mainClass_;
    private final ImmutableList<Datatype.Feature<MavenProtocPlugin, ?>> features;

    private MavenProtocPlugin_(TypeToken<MavenProtocPlugin> type) {
      this.type = type;
      this.groupId_ = Datatype.Feature.of(0, NAME, GROUP_ID_, TypeToken.of(String.class), true, true, true, false, false);
      this.artifactId_ = Datatype.Feature.of(1, NAME, ARTIFACT_ID_, TypeToken.of(String.class), true, true, true, false, false);
      this.type_ = Datatype.Feature.of(2, NAME, TYPE_, TypeToken.of(String.class), true, true, true, true, false);
      this.classifier_ = Datatype.Feature.of(3, NAME, CLASSIFIER_, TypeToken.of(String.class), true, true, true, true, false);
      this.options_ = Datatype.Feature.of(4, NAME, OPTIONS_, TypeToken.of(String.class), true, true, true, true, false);
      this.outputDirectory_ = Datatype.Feature.of(5, NAME, OUTPUT_DIRECTORY_, TypeToken.of(Path.class), true, true, true, true, false);
      this.registerAsCompilationRoot_ = Datatype.Feature.of(6, NAME, REGISTER_AS_COMPILATION_ROOT_, TypeToken.of(Boolean.class), true, true, true, true, false);
      this.order_ = Datatype.Feature.of(7, NAME, ORDER_, TypeToken.of(int.class), false, true, true, true, false);
      this.skip_ = Datatype.Feature.of(8, NAME, SKIP_, TypeToken.of(boolean.class), false, true, true, true, false);
      this.version_ = Datatype.Feature.of(9, NAME, VERSION_, TypeToken.of(String.class), true, true, true, false, false);
      this.jvmArgs_ = Datatype.Feature.of(10, NAME, JVM_ARGS_, new TypeToken<@Nullable List<String>>() {}, true, true, true, true, false);
      this.jvmConfigArgs_ = Datatype.Feature.of(11, NAME, JVM_CONFIG_ARGS_, new TypeToken<@Nullable List<String>>() {}, true, true, true, true, false);
      this.mainClass_ = Datatype.Feature.of(12, NAME, MAIN_CLASS_, TypeToken.of(String.class), true, true, true, true, false);
      this.features = ImmutableList.of(groupId_, artifactId_, type_, classifier_, options_, outputDirectory_, registerAsCompilationRoot_, order_, skip_, version_, jvmArgs_, jvmConfigArgs_, mainClass_);
    }

    @Override public <FEATURE_T_> FEATURE_T_ get(Datatype.Feature<MavenProtocPlugin, FEATURE_T_> feature, MavenProtocPlugin instance) {
      int i = feature.index();
      if (i >= features.size() || features.get(i) != feature) {
        throw new IllegalArgumentException("Alien feature " + feature);
      }
      switch (i) {
      case 0: return (FEATURE_T_) instance.getGroupId();
      case 1: return (FEATURE_T_) instance.getArtifactId();
      case 2: return (FEATURE_T_) instance.getType();
      case 3: return (FEATURE_T_) instance.getClassifier();
      case 4: return (FEATURE_T_) instance.getOptions();
      case 5: return (FEATURE_T_) instance.getOutputDirectory();
      case 6: return (FEATURE_T_) instance.isRegisterAsCompilationRoot();
      case 7: return (FEATURE_T_) (Object) instance.getOrder();
      case 8: return (FEATURE_T_) (Object) instance.isSkip();
      case 9: return (FEATURE_T_) instance.getVersion();
      case 10: return (FEATURE_T_) instance.getJvmArgs();
      case 11: return (FEATURE_T_) instance.getJvmConfigArgs();
      case 12: return (FEATURE_T_) instance.getMainClass();
      default: throw new IllegalArgumentException("Non-readable feature " + feature);
      }
    }

    @Override public String name() { return NAME; }
    @Override public TypeToken<MavenProtocPlugin> type() { return type; }
    @Override public List<Datatype.Feature<MavenProtocPlugin, ?>> features() { return features; }
    @Override public String toString() { return "datatype<" + type + ">"; }
    @Override public boolean isInline() { return false; }
    @Override public boolean isInstantiable() { return true; }
    @Override public Datatype.Builder<MavenProtocPlugin> builder() {
      return new Datatype.Builder<MavenProtocPlugin>() {
        private final Object[] values = new Object[13];
        private MavenProtocPlugin instance;

        @Override public <FEATURE_T_> void set(Datatype.Feature<MavenProtocPlugin, FEATURE_T_> feature, FEATURE_T_ value) {
          int i = feature.index();
          if (i >= features.size() || features.get(i) != feature) {
            throw new IllegalArgumentException("Alien feature " + feature);
          }
          if (!feature.supportsInput()) {
            throw new IllegalArgumentException("Non-writable feature " + feature);
          }
          values[i] = value;
        }

        @Override public List<Datatype.Violation> verify() {
          List<Datatype.Violation> violations = ImmutableList.of();
          try {
            values[0] = (String) values[0];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(0)));
          }
          try {
            values[1] = (String) values[1];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(1)));
          }
          try {
            values[2] = (@Nullable String) values[2];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(2)));
          }
          try {
            values[3] = (@Nullable String) values[3];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(3)));
          }
          try {
            values[4] = (@Nullable String) values[4];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(4)));
          }
          try {
            values[5] = (@Nullable Path) values[5];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(5)));
          }
          try {
            values[6] = (@Nullable Boolean) values[6];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(6)));
          }
          try {
            values[7] = (Integer) values[7];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(7)));
          }
          try {
            values[8] = (Boolean) values[8];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(8)));
          }
          try {
            values[9] = (@NonNull String) values[9];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(9)));
          }
          try {
            values[10] = (@Nullable List<String>) values[10];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(10)));
          }
          try {
            values[11] = (@Nullable List<String>) values[11];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(11)));
          }
          try {
            values[12] = (@Nullable String) values[12];
          } catch (RuntimeException e) {
            if (violations.isEmpty()) violations = new ArrayList<>(1);
            String kind = e instanceof NullPointerException ? "null"
                : e instanceof ClassCastException ? "cast" : "wrong";
            violations.add(Datatype.Violation.of(kind, e.getMessage(), features.get(12)));
          }
          if (violations.isEmpty()) {
            try {
              instance = buildInstance();
            } catch (Exception e) {
              if (violations.isEmpty()) violations = new ArrayList<>(1);
              violations.add(Datatype.Violation.of("check", e.getMessage()));
            }
          }
          return ImmutableList.copyOf(violations);
        }

        @Override public MavenProtocPlugin build() {
          if (instance == null) return buildInstance();
          MavenProtocPlugin i = instance;
          instance = null;
          return i;
        }

        @Override public String toString() {
          StringBuilder sb = new StringBuilder().append(MavenProtocPlugin_.this).append(".builder(");
          sb.append(GROUP_ID_).append('=').append(values[0]).append(";");
          sb.append(ARTIFACT_ID_).append('=').append(values[1]).append(";");
          sb.append(TYPE_).append('=').append(values[2]).append(";");
          sb.append(CLASSIFIER_).append('=').append(values[3]).append(";");
          sb.append(OPTIONS_).append('=').append(values[4]).append(";");
          sb.append(OUTPUT_DIRECTORY_).append('=').append(values[5]).append(";");
          sb.append(REGISTER_AS_COMPILATION_ROOT_).append('=').append(values[6]).append(";");
          if (values[7] != null) sb.append(ORDER_).append('=').append(values[7]).append(";");
          if (values[8] != null) sb.append(SKIP_).append('=').append(values[8]).append(";");
          sb.append(VERSION_).append('=').append(values[9]).append(";");
          sb.append(JVM_ARGS_).append('=').append(values[10]).append(";");
          sb.append(JVM_CONFIG_ARGS_).append('=').append(values[11]).append(";");
          sb.append(MAIN_CLASS_).append('=').append(values[12]).append(";");
          return sb.append(")").toString();
        }

        private MavenProtocPlugin buildInstance() {
          ImmutableMavenProtocPlugin.Builder builder = ImmutableMavenProtocPlugin.builder();
          builder.groupId((String) values[0]);
          builder.artifactId((String) values[1]);
          builder.type((@Nullable String) values[2]);
          builder.classifier((@Nullable String) values[3]);
          builder.options((@Nullable String) values[4]);
          builder.outputDirectory((@Nullable Path) values[5]);
          builder.registerAsCompilationRoot((@Nullable Boolean) values[6]);
          if (values[7] != null) builder.order((int) values[7]);
          if (values[8] != null) builder.skip((boolean) values[8]);
          builder.version((@NonNull String) values[9]);
          builder.jvmArgs((@Nullable List<String>) values[10]);
          builder.jvmConfigArgs((@Nullable List<String>) values[11]);
          builder.mainClass((@Nullable String) values[12]);
          return builder.build();
        }
      };
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions