Skip to content

ignore when annotated with @Generated #1984

Closed

Description

@xenoterracide

would be good to ignore any class, method etc if it has the annotation @Generated, any one. This would probably solve a lot of problems using lombok and other such code generation frameworks. You can do this

-XepDisableWarningsInGeneratedCode : Disables warnings in classes annotated with @javax.annotation.Generated or @javax.annotation.processing.Generated

but it doesn't disable errors, or things that aren't using those annotations, the former of which I know is problematic in recent versions of java.

UPDATE

actually it didn't even ignore classes decorated with those, immutables generated this and I had that setting enabled and I was still getting errors.

package com.xenoterracide.scaf;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.immutables.value.Generated;

/**
 * Immutable implementation of {@link SkeletonConfiguration}.
 * <p>
 * Use the builder to create immutable instances:
 * {@code ImmutableSkeletonConfiguration.builder()}.
 */
@Generated(from = "SkeletonConfiguration", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
final class ImmutableSkeletonConfiguration implements SkeletonConfiguration {
 ... // pruned for brevity

using java 11

Activity

  1. cushon commented on Jan 6, 2021

    @cushon
    Collaborator

    actually it didn't even ignore classes decorated with those, immutables generated this and I had that setting enabled and I was still getting errors.

       import org.immutables.value.Generated;
    

    It's still using org.immutables.value.Generated, not javax.annotation.Generated or javax.annotation.processing.Generated.

    The other bug suggestion it tries to use a javax.* annotation if it's available, and the code does seem to be doing that: https://github.com/immutables/immutables/blame/e31f58d44612f2211679a07229a96d9ddf62aa7a/value-processor/src/org/immutables/value/processor/Asts.generator#L65-L66. Do you know why that isn't happening here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions