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

Excavator: Upgrades Baseline to the latest version #557

Merged
merged 12 commits into from
Oct 14, 2019
2 changes: 1 addition & 1 deletion .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
<module name="NestedTryDepth"/> <!-- Java Coding Guide: Try/catch blocks: never nested -->
<module name="NonEmptyAtclauseDescription"/> <!-- Java Style Guide: At-clauses -->
<module name="ParameterName"> <!-- Java Style Guide: Parameter names -->
<property name="format" value="^[a-z][a-zA-Z0-9]+$"/>
<property name="format" value="^_?[a-z][a-zA-Z0-9]+$"/>
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc"/> <!-- Java Style Guide: General form -->
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ buildscript {
classpath 'com.netflix.nebula:gradle-info-plugin:5.1.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.netflix.nebula:nebula-publishing-plugin:14.0.0'
classpath 'com.palantir.baseline:gradle-baseline-java:2.3.0'
classpath 'com.palantir.baseline:gradle-baseline-java:2.19.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.12.4'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0'
Expand Down Expand Up @@ -71,7 +71,7 @@ subprojects {
tasks.withType(JavaCompile) {
options.errorprone.errorproneArgs += ['-Xep:PreferSafeLoggingPreconditions:OFF', '-Xep:PreferSafeLoggableExceptions:OFF']
options.compilerArgs += ['-Werror']

// necessary until https://github.com/palantir/gradle-baseline/pull/582
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
options.compilerArgs += ['--release', '8']
Expand Down
1 change: 1 addition & 0 deletions conjure-java-client-verifier/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies {
testCompile sourceSets.generatedJersey.output
testCompile sourceSets.generatedUndertow.output
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @ferozco 🌶🌶🌶🌶

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👻


compileOnly 'org.immutables:value::annotations'
testCompileOnly 'org.immutables:value::annotations'
Expand Down
5 changes: 5 additions & 0 deletions conjure-java-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ dependencies {
compileOnly 'org.immutables:value::annotations'
testCompileOnly 'org.immutables:value::annotations'
}

tasks.withType(JavaCompile) {
// this complains about the integrationInput directory
options.errorprone.errorproneArgs += '-Xep:StrictUnusedVariable:OFF'
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,37 @@ public CodeBlock visitOptional(OptionalType value) {
}

@Override
public CodeBlock visitList(ListType value) {
public CodeBlock visitList(ListType _value) {
return CodeBlock.of("$T.emptyList()", Collections.class);
}

@Override
public CodeBlock visitSet(SetType value) {
public CodeBlock visitSet(SetType _value) {
return CodeBlock.of("$T.emptySet()", Collections.class);
}

@Override
public CodeBlock visitMap(MapType value) {
public CodeBlock visitMap(MapType _value) {
return CodeBlock.of("$T.emptyMap()", Collections.class);
}

@Override
public CodeBlock visitPrimitive(PrimitiveType value) {
public CodeBlock visitPrimitive(PrimitiveType _value) {
throw new SafeIllegalArgumentException("Cannot backfill non-defaultable parameter type.");
}

@Override
public CodeBlock visitReference(TypeName value) {
public CodeBlock visitReference(TypeName _value) {
throw new SafeIllegalArgumentException("Cannot backfill non-defaultable parameter type.");
}

@Override
public CodeBlock visitExternal(ExternalReference value) {
public CodeBlock visitExternal(ExternalReference _value) {
throw new SafeIllegalArgumentException("Cannot backfill non-defaultable parameter type.");
}

@Override
public CodeBlock visitUnknown(String unknownType) {
public CodeBlock visitUnknown(String _unknownType) {
throw new SafeIllegalArgumentException("Cannot backfill non-defaultable parameter type.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,42 @@ enum DefaultableTypeVisitor implements Type.Visitor<Boolean> {
INSTANCE;

@Override
public Boolean visitOptional(OptionalType value) {
public Boolean visitOptional(OptionalType _value) {
return true;
}

@Override
public Boolean visitList(ListType value) {
public Boolean visitList(ListType _value) {
return true;
}

@Override
public Boolean visitSet(SetType value) {
public Boolean visitSet(SetType _value) {
return true;
}

@Override
public Boolean visitMap(MapType value) {
public Boolean visitMap(MapType _value) {
return true;
}

@Override
public Boolean visitPrimitive(PrimitiveType value) {
public Boolean visitPrimitive(PrimitiveType _value) {
return false;
}

@Override
public Boolean visitReference(TypeName value) {
public Boolean visitReference(TypeName _value) {
return false;
}

@Override
public Boolean visitExternal(ExternalReference value) {
public Boolean visitExternal(ExternalReference _value) {
return false;
}

@Override
public Boolean visitUnknown(String unknownType) {
public Boolean visitUnknown(String _unknownType) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,15 @@ private Optional<String> addAuthCode(

return endpointDefinition.getAuth().get().accept(new AuthType.Visitor<Optional<String>>() {
@Override
public Optional<String> visitHeader(HeaderAuthType value) {
public Optional<String> visitHeader(HeaderAuthType _value) {
// header auth
code.addStatement("$1T $2N = $3N.auth().header($4N)",
AuthHeader.class, AUTH_HEADER_VAR_NAME, RUNTIME_VAR_NAME, EXCHANGE_VAR_NAME);
return Optional.of(AUTH_HEADER_VAR_NAME);
}

@Override
public Optional<String> visitCookie(CookieAuthType value) {
public Optional<String> visitCookie(CookieAuthType _value) {
code.addStatement("$1T $2N = $3N.auth().cookie($4N, $5S)",
BearerToken.class,
COOKIE_TOKEN_VAR_NAME,
Expand Down Expand Up @@ -640,17 +640,17 @@ private Optional<CodeBlock> getComplexTypeStringDeserializer(
Type type, TypeMapper typeMapper, String resultVarName, String paramsVarName, String paramId) {
return type.accept(new DefaultTypeVisitor<Optional<String>>() {
@Override
public Optional<String> visitExternal(ExternalReference value) {
public Optional<String> visitExternal(ExternalReference _value) {
return Optional.of("deserializeComplex");
}

@Override
public Optional<String> visitReference(com.palantir.conjure.spec.TypeName value) {
public Optional<String> visitReference(com.palantir.conjure.spec.TypeName _value) {
return Optional.of("deserializeComplex");
}

@Override
public Optional<String> visitPrimitive(PrimitiveType value) {
public Optional<String> visitPrimitive(PrimitiveType _value) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ private List<ParameterSpec> createServiceMethodParameters(EndpointDefinition end
endpointDef.getAuth().ifPresent(
authType -> parameterSpecs.add(authType.accept(new AuthType.Visitor<ParameterSpec>() {
@Override
public ParameterSpec visitHeader(HeaderAuthType value) {
public ParameterSpec visitHeader(HeaderAuthType _value) {
return ParameterSpec.builder(ClassName.get(AuthHeader.class), "authHeader").build();
}

@Override
public ParameterSpec visitCookie(CookieAuthType value) {
public ParameterSpec visitCookie(CookieAuthType _value) {
return ParameterSpec.builder(ClassName.get(BearerToken.class), "cookieToken").build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class UndertowTypeFunctions {
static boolean isAliasType(Type type) {
return type.accept(new IsTypeVisitor() {
@Override
public Boolean visitReference(com.palantir.conjure.spec.TypeName value) {
public Boolean visitReference(com.palantir.conjure.spec.TypeName _value) {
return true;
}
});
Expand Down Expand Up @@ -116,7 +116,7 @@ static String primitiveTypeName(PrimitiveType in) {
static Type toConjureTypeWithoutAliases(final Type in, final List<TypeDefinition> typeDefinitions) {
return in.accept(new Type.Visitor<Type>() {
@Override
public Type visitPrimitive(PrimitiveType value) {
public Type visitPrimitive(PrimitiveType _value) {
return in;
}

Expand Down Expand Up @@ -150,12 +150,12 @@ public Type visitReference(com.palantir.conjure.spec.TypeName value) {
}

@Override
public Type visitExternal(ExternalReference value) {
public Type visitExternal(ExternalReference _value) {
return in;
}

@Override
public Type visitUnknown(String unknownType) {
public Type visitUnknown(String _unknownType) {
return in;
}
});
Expand All @@ -178,7 +178,7 @@ public OptionalType visitOptional(OptionalType value) {

private abstract static class GetTypeVisitor<T> extends DefaultTypeVisitor<T> {
@Override
public T visitUnknown(String unknownType) {
public T visitUnknown(String _unknownType) {
throw new UnsupportedOperationException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,12 @@ public Boolean visitPrimitive(PrimitiveType value) {
}

@Override
public Boolean visitOptional(OptionalType value) {
public Boolean visitOptional(OptionalType _value) {
return false;
}

@Override
public Boolean visitReference(com.palantir.conjure.spec.TypeName value) {
public Boolean visitReference(com.palantir.conjure.spec.TypeName _value) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,17 @@ public Boolean visitOptional(OptionalType value) {
}

@Override
public Boolean visitList(ListType value) {
public Boolean visitList(ListType _value) {
return Boolean.TRUE;
}

@Override
public Boolean visitSet(SetType value) {
public Boolean visitSet(SetType _value) {
return Boolean.TRUE;
}

@Override
public Boolean visitMap(MapType value) {
public Boolean visitMap(MapType _value) {
return Boolean.TRUE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ private static MethodSpec generateExceptionFactory(
methodBuilder.addCode(", cause");
}

entry.getSafeArgs().stream().forEach(arg ->
entry.getSafeArgs().forEach(arg ->
processArg(typeMapper, methodBuilder, arg, true));

entry.getUnsafeArgs().stream().forEach(arg ->
entry.getUnsafeArgs().forEach(arg ->
processArg(typeMapper, methodBuilder, arg, false));
methodBuilder.addCode(");");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public static String sanitizeParameterName(String input, EndpointDefinition endp
Optional<String> maybeAuthParamName = endpoint.getAuth()
.map(authType -> authType.accept(new AuthType.Visitor<String>() {
@Override
public String visitHeader(HeaderAuthType header) {
public String visitHeader(HeaderAuthType _header) {
return "authHeader";
}

@Override
public String visitCookie(CookieAuthType cookie) {
public String visitCookie(CookieAuthType _cookie) {
return "cookieToken";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ public final class ParameterOrder {
/** Produces an ordering for ParamaterType of Header, Path, Query, Body. */
private static final ParameterType.Visitor<Integer> PARAM_SORT_ORDER = new ParameterType.Visitor<Integer>() {
@Override
public Integer visitBody(BodyParameterType value) {
public Integer visitBody(BodyParameterType _value) {
return 30;
}

@Override
public Integer visitHeader(HeaderParameterType value) {
public Integer visitHeader(HeaderParameterType _value) {
return 0;
}

@Override
public Integer visitPath(PathParameterType value) {
public Integer visitPath(PathParameterType _value) {
return 10;
}

@Override
public Integer visitQuery(QueryParameterType value) {
public Integer visitQuery(QueryParameterType _value) {
return 20;
}

@Override
public Integer visitUnknown(String unknownType) {
public Integer visitUnknown(String _unknownType) {
return -1;
}
};
Expand All @@ -68,22 +68,22 @@ public Integer visitUnknown(String unknownType) {
*/
private static final Type.Visitor<Integer> TYPE_SORT_ORDER = new DefaultTypeVisitor<Integer>() {
@Override
public Integer visitOptional(OptionalType value) {
public Integer visitOptional(OptionalType _value) {
return 1;
}

@Override
public Integer visitList(ListType value) {
public Integer visitList(ListType _value) {
return 1;
}

@Override
public Integer visitSet(SetType value) {
public Integer visitSet(SetType _value) {
return 1;
}

@Override
public Integer visitMap(MapType value) {
public Integer visitMap(MapType _value) {
return 1;
}

Expand Down
Loading