Skip to content

Commit adf921e

Browse files
committed
Remove unused code, suppress warnings, and make internal things package private
1 parent f2def4b commit adf921e

82 files changed

Lines changed: 928 additions & 3876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.palantir/revapi.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,145 @@ acceptedBreaks:
126126
old: "method void com.palantir.conjure.java.client.config.ClientConfiguration::checkTimeoutPrecision(java.time.Duration,\
127127
\ java.lang.String)"
128128
justification: "Removed internal method"
129+
"8.34.0":
130+
com.palantir.conjure.java.runtime:conjure-java-jaxrs-client:
131+
- code: "java.class.removed"
132+
old: "class com.palantir.conjure.java.client.jaxrs.CompatibleJaxRsContract"
133+
justification: "Removing Feign dependency and making internals private"
134+
- code: "java.class.removed"
135+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.CborDelegateDecoder"
136+
justification: "Removing Feign dependency and making internals private"
137+
- code: "java.class.removed"
138+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.CborDelegateEncoder"
139+
justification: "Removing Feign dependency and making internals private"
140+
- code: "java.class.removed"
141+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.EmptyContainerDecoder"
142+
justification: "Removing Feign dependency and making internals private"
143+
- code: "java.class.removed"
144+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.EndpointNameHeaderEnrichmentContract"
145+
justification: "Removing Feign dependency and making internals private"
146+
- code: "java.class.removed"
147+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.GuavaEmptyOptionalExpander"
148+
justification: "Removing Feign dependency and making internals private"
149+
- code: "java.class.removed"
150+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.GuavaNullOptionalExpander"
151+
justification: "Removing Feign dependency and making internals private"
152+
- code: "java.class.removed"
153+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.GuavaOptionalAwareContract"
154+
justification: "Removing Feign dependency and making internals private"
155+
- code: "java.class.removed"
156+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.GuavaOptionalAwareDecoder"
157+
justification: "Removing Feign dependency and making internals private"
158+
- code: "java.class.removed"
159+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.HeaderAccessUtils"
160+
justification: "Removing Feign dependency and making internals private"
161+
- code: "java.class.removed"
162+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.InputStreamDelegateDecoder"
163+
justification: "Removing Feign dependency and making internals private"
164+
- code: "java.class.removed"
165+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.InputStreamDelegateEncoder"
166+
justification: "Removing Feign dependency and making internals private"
167+
- code: "java.class.removed"
168+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8EmptyOptionalDoubleExpander"
169+
justification: "Removing Feign dependency and making internals private"
170+
- code: "java.class.removed"
171+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8EmptyOptionalExpander"
172+
justification: "Removing Feign dependency and making internals private"
173+
- code: "java.class.removed"
174+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8EmptyOptionalIntExpander"
175+
justification: "Removing Feign dependency and making internals private"
176+
- code: "java.class.removed"
177+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8EmptyOptionalLongExpander"
178+
justification: "Removing Feign dependency and making internals private"
179+
- code: "java.class.removed"
180+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8NullOptionalDoubleExpander"
181+
justification: "Removing Feign dependency and making internals private"
182+
- code: "java.class.removed"
183+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8NullOptionalExpander"
184+
justification: "Removing Feign dependency and making internals private"
185+
- code: "java.class.removed"
186+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8NullOptionalIntExpander"
187+
justification: "Removing Feign dependency and making internals private"
188+
- code: "java.class.removed"
189+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8NullOptionalLongExpander"
190+
justification: "Removing Feign dependency and making internals private"
191+
- code: "java.class.removed"
192+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8OptionalAwareContract"
193+
justification: "Removing Feign dependency and making internals private"
194+
- code: "java.class.removed"
195+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.Java8OptionalAwareDecoder"
196+
justification: "Removing Feign dependency and making internals private"
197+
- code: "java.class.removed"
198+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.MethodHeaderEnrichmentContract"
199+
justification: "Removing Feign dependency and making internals private"
200+
- code: "java.class.removed"
201+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.NeverReturnNullDecoder"
202+
justification: "Removing Feign dependency and making internals private"
203+
- code: "java.class.removed"
204+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.PathTemplateHeaderEnrichmentContract"
205+
justification: "Removing Feign dependency and making internals private"
206+
- code: "java.class.removed"
207+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.QosErrorDecoder"
208+
justification: "Removing Feign dependency and making internals private"
209+
- code: "java.class.removed"
210+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.SlashEncodingContract"
211+
justification: "Removing Feign dependency and making internals private"
212+
- code: "java.class.removed"
213+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.TextDelegateDecoder"
214+
justification: "Removing Feign dependency and making internals private"
215+
- code: "java.class.removed"
216+
old: "class com.palantir.conjure.java.client.jaxrs.feignimpl.TextDelegateEncoder"
217+
justification: "Removing Feign dependency and making internals private"
218+
- code: "java.class.removed"
219+
old: "enum com.palantir.conjure.java.client.jaxrs.feignimpl.NeverRetryingBackoffStrategy"
220+
justification: "Removing Feign dependency and making internals private"
221+
- code: "java.class.removed"
222+
old: "interface com.palantir.conjure.java.client.jaxrs.feignimpl.BackoffStrategy"
223+
justification: "Removing Feign dependency and making internals private"
224+
- code: "java.class.visibilityReduced"
225+
old: "class com.palantir.conjure.java.client.jaxrs.FeignJaxRsClientBuilder"
226+
new: "class com.palantir.conjure.java.client.jaxrs.FeignJaxRsClientBuilder"
227+
justification: "Removing Feign dependency and making internals private"
228+
- code: "java.class.visibilityReduced"
229+
old: "class com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility"
230+
new: "class com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility"
231+
justification: "Removing Feign dependency and making internals private"
232+
- code: "java.class.visibilityReduced"
233+
old: "enum com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations"
234+
new: "enum com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations"
235+
justification: "Removing Feign dependency and making internals private"
236+
- code: "java.method.visibilityReduced"
237+
old: "method boolean com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations::matches(java.lang.Class<?\
238+
\ extends java.lang.annotation.Annotation>)"
239+
new: "method boolean com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations::matches(java.lang.Class<?\
240+
\ extends java.lang.annotation.Annotation>)"
241+
justification: "Removing Feign dependency and making internals private"
242+
- code: "java.method.visibilityReduced"
243+
old: "method boolean com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations::matches(java.util.Set<java.lang.Class<?>>)"
244+
new: "method boolean com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations::matches(java.util.Set<java.lang.Class<?>>)"
245+
justification: "Removing Feign dependency and making internals private"
246+
- code: "java.method.visibilityReduced"
247+
old: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsClientBuilder::getCborObjectMapper()"
248+
new: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsClientBuilder::getCborObjectMapper()"
249+
justification: "Removing Feign dependency and making internals private"
250+
- code: "java.method.visibilityReduced"
251+
old: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsClientBuilder::getObjectMapper()"
252+
new: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsClientBuilder::getObjectMapper()"
253+
justification: "Removing Feign dependency and making internals private"
254+
- code: "java.method.visibilityReduced"
255+
old: "method java.lang.annotation.Annotation com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations::getAnnotation(java.lang.reflect.AnnotatedElement)"
256+
new: "method java.lang.annotation.Annotation com.palantir.conjure.java.client.jaxrs.JaxRsJakartaCompatibility.Annotations::getAnnotation(java.lang.reflect.AnnotatedElement)"
257+
justification: "Removing Feign dependency and making internals private"
258+
com.palantir.conjure.java.runtime:conjure-scala-jaxrs-client:
259+
- code: "java.class.visibilityReduced"
260+
old: "class com.palantir.conjure.java.client.jaxrs.FeignJaxRsScalaClientBuilder"
261+
new: "class com.palantir.conjure.java.client.jaxrs.FeignJaxRsScalaClientBuilder"
262+
justification: "Removing Feign dependency and making internals private"
263+
- code: "java.method.visibilityReduced"
264+
old: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsScalaClientBuilder::getCborObjectMapper()"
265+
new: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsScalaClientBuilder::getCborObjectMapper()"
266+
justification: "Removing Feign dependency and making internals private"
267+
- code: "java.method.visibilityReduced"
268+
old: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsScalaClientBuilder::getObjectMapper()"
269+
new: "method com.fasterxml.jackson.databind.ObjectMapper com.palantir.conjure.java.client.jaxrs.FeignJaxRsScalaClientBuilder::getObjectMapper()"
270+
justification: "Removing Feign dependency and making internals private"

conjure-java-jaxrs-client/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,3 @@ dependencies {
4141
testImplementation "org.mockito:mockito-junit-jupiter"
4242
testImplementation "com.palantir.safe-logging:preconditions-assertj"
4343
}
44-
45-
// feign.DefaultMethodHandler sets Lookup.IMPL_LOOKUP accessible resulting in
46-
// InaccessibleObjectException: Unable to make field static final java.lang.invoke.MethodHandles$Lookup
47-
// java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module java.base does not
48-
// "opens java.lang.invoke" to unnamed module
49-
moduleJvmArgs {
50-
opens 'java.base/java.lang.invoke'
51-
}

conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/AbstractDelegatingContract.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* Base class that provides the structure for a delegating {@link Contract}. Delegates the initial
26-
* {@link #parseAndValidatateMetadata(Class)} call to the wrapped Contract and then calls {@link #processMetadata(Class,
26+
* {@link #parseAndValidateMetadata(Class)} call to the wrapped Contract and then calls {@link #processMetadata(Class,
2727
* Method, MethodMetadata)} on all of the methods that have metadata from the initial call.
2828
*/
2929
abstract class AbstractDelegatingContract implements Contract {
@@ -35,8 +35,8 @@ abstract class AbstractDelegatingContract implements Contract {
3535
}
3636

3737
@Override
38-
public final List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType) {
39-
List<MethodMetadata> mdList = delegate.parseAndValidatateMetadata(targetType);
38+
public final List<MethodMetadata> parseAndValidateMetadata(Class<?> targetType) {
39+
List<MethodMetadata> mdList = delegate.parseAndValidateMetadata(targetType);
4040

4141
Map<String, MethodMetadata> methodMetadataByConfigKey = new LinkedHashMap<String, MethodMetadata>();
4242
for (MethodMetadata md : mdList) {
@@ -57,5 +57,5 @@ public final List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType
5757
return mdList;
5858
}
5959

60-
protected abstract void processMetadata(Class<?> targetType, Method method, MethodMetadata metadata);
60+
abstract void processMetadata(Class<?> targetType, Method method, MethodMetadata metadata);
6161
}

conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/AbstractFeignJaxRsClientBuilder.java

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import com.palantir.logsafe.Safe;
3232
import com.palantir.logsafe.SafeArg;
3333
import com.palantir.logsafe.exceptions.SafeIllegalArgumentException;
34-
import java.util.Objects;
3534

3635
/** Not meant to be implemented outside of this library. */
3736
abstract class AbstractFeignJaxRsClientBuilder {
@@ -47,9 +46,9 @@ abstract class AbstractFeignJaxRsClientBuilder {
4746
this.config = config;
4847
}
4948

50-
protected abstract ObjectMapper getObjectMapper();
49+
abstract ObjectMapper getObjectMapper();
5150

52-
protected abstract ObjectMapper getCborObjectMapper();
51+
abstract ObjectMapper getCborObjectMapper();
5352

5453
/** Set the host metrics registry to use when constructing the OkHttp client. */
5554
final AbstractFeignJaxRsClientBuilder hostEventsSink(HostEventsSink newHostEventsSink) {
@@ -90,76 +89,14 @@ static <T> T create(
9089
.encoder(createEncoder(clientNameForLogging, jsonMapper, cborMapper))
9190
.decoder(createDecoder(clientNameForLogging, jsonMapper, cborMapper))
9291
.errorDecoder(new DialogueFeignClient.RemoteExceptionDecoder(runtime))
93-
.client(new DialogueFeignClient(serviceClass, channel, runtime, FeignDialogueTarget.BASE_URL))
94-
.logLevel(Logger.Level.NONE) // we use Dialogue for logging. (note that NONE is the default)
95-
.retryer(new Retryer.Default(0, 0, 1)) // use dialogue retry mechanism only
96-
.target(new FeignDialogueTarget<>(serviceClass, channel));
97-
}
98-
99-
/**
100-
* Exists to fix equality computation between Feign client instances, which only compare the serviceClass and
101-
* target. However, there's a great deal of other configuration, and we handle failover/retries in Dialogue
102-
* which makes every client appear to use the same URL.
103-
*/
104-
private static final class FeignDialogueTarget<T> implements Target<T> {
105-
private static final String BASE_URL = "dialogue://feign";
106-
107-
private final Class<T> serviceClass;
108-
private final Target<T> delegate;
109-
// For equality checks
110-
private final Channel channel;
111-
112-
FeignDialogueTarget(Class<T> serviceClass, Channel channel) {
113-
this.serviceClass = serviceClass;
114-
this.channel = channel;
115-
this.delegate = new HardCodedTarget<>(serviceClass, BASE_URL);
116-
}
117-
118-
@Override
119-
public Class<T> type() {
120-
return serviceClass;
121-
}
122-
123-
@Override
124-
public String name() {
125-
return delegate.name();
126-
}
127-
128-
@Override
129-
public String url() {
130-
return delegate.url();
131-
}
132-
133-
@Override
134-
public Request apply(RequestTemplate input) {
135-
return delegate.apply(input);
136-
}
137-
138-
@Override
139-
public boolean equals(Object other) {
140-
if (this == other) {
141-
return true;
142-
}
143-
if (other == null || getClass() != other.getClass()) {
144-
return false;
145-
}
146-
FeignDialogueTarget<?> that = (FeignDialogueTarget<?>) other;
147-
return serviceClass.equals(that.serviceClass)
148-
&& delegate.equals(that.delegate)
149-
&& channel.equals(that.channel);
150-
}
151-
152-
@Override
153-
public int hashCode() {
154-
return Objects.hash(serviceClass, delegate, channel);
155-
}
92+
.client(new DialogueFeignClient(serviceClass, channel, runtime))
93+
.build(serviceClass);
15694
}
15795

15896
private static Contract createContract() {
159-
Contract contract = new CompatibleJaxRsContract();
97+
Contract contract = new JaxRsContract();
16098
contract = new GuavaOptionalAwareContract(contract);
16199
contract = new Java8OptionalAwareContract(contract);
162-
contract = new SlashEncodingContract(contract);
163100
contract = new MethodHeaderEnrichmentContract(contract);
164101
contract = new EndpointNameHeaderEnrichmentContract(contract);
165102
return contract;
@@ -180,7 +117,7 @@ private static Decoder createDecoder(
180117

181118
private static Encoder createEncoder(
182119
@Safe String clientNameForLogging, ObjectMapper jsonMapper, ObjectMapper cborMapper) {
183-
Encoder encoder = new ConjureFeignJacksonEncoder(jsonMapper);
120+
Encoder encoder = new JacksonEncoder(jsonMapper);
184121
encoder = new CborDelegateEncoder(cborMapper, encoder);
185122
encoder = new TextDelegateEncoder(encoder);
186123
encoder = new InputStreamDelegateEncoder(clientNameForLogging, encoder);

conjure-java-jaxrs-client/src/main/java/com/palantir/conjure/java/client/jaxrs/BackoffStrategy.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)