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

Apply automatic fixes for error-prone ImmutablesStyle #481

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-481.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Apply automatic fixes for error-prone `ImmutablesStyle`
links:
- https://github.com/palantir/metric-schema/pull/481
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

import com.palantir.logsafe.Preconditions;
import com.palantir.logsafe.SafeArg;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.nio.file.Path;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import org.immutables.value.Value;

@JavaGeneratorArgsStyle
@Value.Immutable
@Value.Style(
visibility = Value.Style.ImplementationVisibility.PACKAGE,
overshadowImplementation = true,
jdkOnly = true,
get = {"get*", "is*"})
public abstract class JavaGeneratorArgs {

private static final Predicate<String> LIBRARY_NAME =
Expand Down Expand Up @@ -67,3 +67,13 @@ public static Builder builder() {
return new Builder();
}
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@SuppressWarnings({"checkstyle:OuterTypeFilename", "checkstyle:OneTopLevelClass"})
@Value.Style(
visibility = Value.Style.ImplementationVisibility.PACKAGE,
overshadowImplementation = true,
jdkOnly = true,
get = {"get*", "is*"})
@interface JavaGeneratorArgsStyle {}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.palantir.metric.schema.MetricNamespace;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.immutables.value.Value;

@NamespaceStyle
@Value.Immutable
@Value.Style(
overshadowImplementation = true,
jdkOnly = true,
get = {"get*", "is*"})
@JsonDeserialize(as = ImmutableNamespace.class)
@JsonSerialize(as = ImmutableNamespace.class)
interface Namespace {
Expand All @@ -40,3 +41,12 @@ static Builder builder() {
return new Builder();
}
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@SuppressWarnings({"checkstyle:OuterTypeFilename", "checkstyle:OneTopLevelClass"})
@Value.Style(
overshadowImplementation = true,
jdkOnly = true,
get = {"get*", "is*"})
@interface NamespaceStyle {}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;
import org.immutables.value.Value;

@SectionStyle
@Value.Immutable
@Value.Style(
overshadowImplementation = true,
jdkOnly = true,
get = {"get*", "is*"})
@JsonDeserialize(as = ImmutableSection.class)
@JsonSerialize(as = ImmutableSection.class)
interface Section {
Expand All @@ -40,3 +41,12 @@ static Builder builder() {
return new Builder();
}
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@SuppressWarnings({"checkstyle:OuterTypeFilename", "checkstyle:OneTopLevelClass"})
@Value.Style(
overshadowImplementation = true,
jdkOnly = true,
get = {"get*", "is*"})
@interface SectionStyle {}