Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore when annotated with @Generated #1984

Closed
xenoterracide opened this issue Dec 4, 2020 · 1 comment · Fixed by #2125
Closed

ignore when annotated with @Generated #1984

xenoterracide opened this issue Dec 4, 2020 · 1 comment · Fixed by #2125

Comments

@xenoterracide
Copy link

xenoterracide commented Dec 4, 2020

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

@cushon
Copy link
Collaborator

cushon commented Jan 6, 2021

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?

copybara-service bot pushed a commit that referenced this issue Jan 19, 2021
to support non-standard annotations.

Fixes #1984, #1863

PiperOrigin-RevId: 352461144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants