File tree 4 files changed +15
-6
lines changed
conjure-java-core/src/main/java/com/palantir/conjure/java
4 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -188,9 +188,14 @@ default boolean preferObjectBuilders() {
188
188
}
189
189
190
190
/**
191
+ * Warning: this is an experimental feature.
192
+ * <p>
191
193
* If enabled, endpoints that have associated errors will return a result type: a sealed interface permitting
192
194
* subclasses for the endpoint's return value, and each endpoint error. Each endpoint error is a subclass of
193
195
* {@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.
194
199
*/
195
200
@ Value .Default
196
201
default boolean generateDialogueEndpointErrorResultTypes () {
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ private static Stream<JavaFile> generateFilesForService(
106
106
DialogueInterfaceGenerator interfaceGenerator ,
107
107
StaticFactoryMethodGenerator blockingGenerator ,
108
108
StaticFactoryMethodGenerator asyncGenerator ) {
109
- List <JavaFile > files = new ArrayList <>(/* initialCapacity= */ 4 );
109
+ List <JavaFile > files = new ArrayList <>(/* initialCapacity= */ 3 );
110
110
if (!serviceDef .getEndpoints ().isEmpty ()) {
111
111
files .add (endpointsGenerator .endpointsClass (serviceDef ));
112
112
}
Original file line number Diff line number Diff line change @@ -47,15 +47,15 @@ public TypeName async(Optional<Type> type) {
47
47
return ParameterizedTypeName .get (LISTENABLE_FUTURE , Primitives .box (baseType (type )));
48
48
}
49
49
50
- public boolean isBinaryOrOptionalBinary (TypeName returnType ) {
50
+ boolean isBinaryOrOptionalBinary (TypeName returnType ) {
51
51
return isBinary (returnType ) || isOptionalBinary (returnType );
52
52
}
53
53
54
- public boolean isOptionalBinary (TypeName returnType ) {
54
+ boolean isOptionalBinary (TypeName returnType ) {
55
55
return returnType .equals (baseType (Type .optional (OptionalType .of (Type .primitive (PrimitiveType .BINARY )))));
56
56
}
57
57
58
- public boolean isBinary (TypeName returnType ) {
58
+ boolean isBinary (TypeName returnType ) {
59
59
return returnType .equals (baseType (Type .primitive (PrimitiveType .BINARY )));
60
60
}
61
61
}
Original file line number Diff line number Diff line change @@ -51,8 +51,12 @@ The recommended way to use conjure-java is via a build tool like [gradle-conjure
51
51
--preferObjectBuilders
52
52
Exclude static factory methods from generated objects with one or more fields. Note that for
53
53
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.
56
60
57
61
### Known Tag Values
58
62
You can’t perform that action at this time.
0 commit comments