Skip to content

Commit f2aa7bc

Browse files
author
Pritham Marupaka
committed
review changes
1 parent 2be22e7 commit f2aa7bc

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

conjure-java-core/src/main/java/com/palantir/conjure/java/Options.java

+5
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,14 @@ default boolean preferObjectBuilders() {
188188
}
189189

190190
/**
191+
* Warning: this is an experimental feature.
192+
* <p>
191193
* If enabled, endpoints that have associated errors will return a result type: a sealed interface permitting
192194
* subclasses for the endpoint's return value, and each endpoint error. Each endpoint error is a subclass of
193195
* {@link com.palantir.dialogue.EndpointError}.
196+
*<p>
197+
* Producing JARs with this feature enabled will result in a compile-time break when consumers bump their dependency
198+
* on the JAR. This is because the return types of every endpoint with associated errors will change.
194199
*/
195200
@Value.Default
196201
default boolean generateDialogueEndpointErrorResultTypes() {

conjure-java-core/src/main/java/com/palantir/conjure/java/services/dialogue/DialogueServiceGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private static Stream<JavaFile> generateFilesForService(
106106
DialogueInterfaceGenerator interfaceGenerator,
107107
StaticFactoryMethodGenerator blockingGenerator,
108108
StaticFactoryMethodGenerator asyncGenerator) {
109-
List<JavaFile> files = new ArrayList<>(/* initialCapacity= */ 4);
109+
List<JavaFile> files = new ArrayList<>(/* initialCapacity= */ 3);
110110
if (!serviceDef.getEndpoints().isEmpty()) {
111111
files.add(endpointsGenerator.endpointsClass(serviceDef));
112112
}

conjure-java-core/src/main/java/com/palantir/conjure/java/services/dialogue/ReturnTypeMapper.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ public TypeName async(Optional<Type> type) {
4747
return ParameterizedTypeName.get(LISTENABLE_FUTURE, Primitives.box(baseType(type)));
4848
}
4949

50-
public boolean isBinaryOrOptionalBinary(TypeName returnType) {
50+
boolean isBinaryOrOptionalBinary(TypeName returnType) {
5151
return isBinary(returnType) || isOptionalBinary(returnType);
5252
}
5353

54-
public boolean isOptionalBinary(TypeName returnType) {
54+
boolean isOptionalBinary(TypeName returnType) {
5555
return returnType.equals(baseType(Type.optional(OptionalType.of(Type.primitive(PrimitiveType.BINARY)))));
5656
}
5757

58-
public boolean isBinary(TypeName returnType) {
58+
boolean isBinary(TypeName returnType) {
5959
return returnType.equals(baseType(Type.primitive(PrimitiveType.BINARY)));
6060
}
6161
}

readme.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ The recommended way to use conjure-java is via a build tool like [gradle-conjure
5151
--preferObjectBuilders
5252
Exclude static factory methods from generated objects with one or more fields. Note that for
5353
objects without any fields, this will still generate the static factory method.
54-
--generateDialogueEndpointErrorResultTypes
55-
For endpoints with errors associated with them, generate methods which return result types in Dialogue clients
54+
--generateDialogueEndpointErrorResultTypes
55+
This is an experimental feature. If enabled, endpoints that have associated errors will return a
56+
result type: a sealed interface permitting subclasses for the endpoint's return value, and each
57+
endpoint error. Producing JARs with this feature enabled will result in a compile-time break when
58+
consumers bump their dependency on the JAR. This is because the return types of every endpoint with
59+
associated errors will change.
5660

5761
### Known Tag Values
5862

0 commit comments

Comments
 (0)