Skip to content

Commit

Permalink
Merge pull request #3406 from graphql-java/deprecation-annotation-fix
Browse files Browse the repository at this point in the history
Java 9 @deprecated annotation
  • Loading branch information
dondonz committed Jan 10, 2024
2 parents 6b61b31 + 420b9eb commit f6fe760
Show file tree
Hide file tree
Showing 43 changed files with 170 additions and 325 deletions.
22 changes: 0 additions & 22 deletions src/main/java/graphql/DeprecatedAt.java

This file was deleted.

23 changes: 7 additions & 16 deletions src/main/java/graphql/DirectivesUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
@Internal
public class DirectivesUtil {


@Deprecated // use GraphQLAppliedDirectives eventually
@DeprecatedAt("2022-02-24")
@Deprecated(since = "2022-02-24") // use GraphQLAppliedDirectives eventually
public static Map<String, GraphQLDirective> nonRepeatableDirectivesByName(List<GraphQLDirective> directives) {
// filter the repeatable directives
List<GraphQLDirective> singletonDirectives = directives.stream()
Expand All @@ -34,15 +32,13 @@ public static Map<String, GraphQLDirective> nonRepeatableDirectivesByName(List<G
return FpKit.getByName(singletonDirectives, GraphQLDirective::getName);
}

@Deprecated // use GraphQLAppliedDirectives eventually
@DeprecatedAt("2022-02-24")
@Deprecated(since = "2022-02-24") // use GraphQLAppliedDirectives eventually
public static Map<String, ImmutableList<GraphQLDirective>> allDirectivesByName(List<GraphQLDirective> directives) {

return ImmutableMap.copyOf(FpKit.groupingBy(directives, GraphQLDirective::getName));
}

@Deprecated // use GraphQLAppliedDirectives eventually
@DeprecatedAt("2022-02-24")
@Deprecated(since = "2022-02-24") // use GraphQLAppliedDirectives eventually
public static Optional<GraphQLArgument> directiveWithArg(List<GraphQLDirective> directives, String directiveName, String argumentName) {
GraphQLDirective directive = nonRepeatableDirectivesByName(directives).get(directiveName);
GraphQLArgument argument = null;
Expand All @@ -52,9 +48,7 @@ public static Optional<GraphQLArgument> directiveWithArg(List<GraphQLDirective>
return Optional.ofNullable(argument);
}


@Deprecated // use GraphQLAppliedDirectives eventually
@DeprecatedAt("2022-02-24")
@Deprecated(since = "2022-02-24") // use GraphQLAppliedDirectives eventually
public static boolean isAllNonRepeatable(List<GraphQLDirective> directives) {
if (directives == null || directives.isEmpty()) {
return false;
Expand All @@ -67,26 +61,23 @@ public static boolean isAllNonRepeatable(List<GraphQLDirective> directives) {
return true;
}

@Deprecated // use GraphQLAppliedDirectives eventually
@DeprecatedAt("2022-02-24")
@Deprecated(since = "2022-02-24") // use GraphQLAppliedDirectives eventually
public static List<GraphQLDirective> add(List<GraphQLDirective> targetList, GraphQLDirective newDirective) {
assertNotNull(targetList, () -> "directive list can't be null");
assertNotNull(newDirective, () -> "directive can't be null");
targetList.add(newDirective);
return targetList;
}

@Deprecated // use GraphQLAppliedDirectives eventually
@DeprecatedAt("2022-02-24")
@Deprecated(since = "2022-02-24") // use GraphQLAppliedDirectives eventually
public static List<GraphQLDirective> addAll(List<GraphQLDirective> targetList, List<GraphQLDirective> newDirectives) {
assertNotNull(targetList, () -> "directive list can't be null");
assertNotNull(newDirectives, () -> "directive list can't be null");
targetList.addAll(newDirectives);
return targetList;
}

@Deprecated // use GraphQLAppliedDirectives eventually
@DeprecatedAt("2022-02-24")
@Deprecated(since = "2022-02-24") // use GraphQLAppliedDirectives eventually
public static GraphQLDirective getFirstDirective(String name, Map<String, List<GraphQLDirective>> allDirectivesByName) {
List<GraphQLDirective> directives = allDirectivesByName.getOrDefault(name, emptyList());
if (directives.isEmpty()) {
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/graphql/ExecutionInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ public String getOperationName() {
*
* @deprecated - use {@link #getGraphQLContext()}
*/
@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
public Object getContext() {
return context;
}
Expand Down Expand Up @@ -273,8 +272,7 @@ public Builder localContext(Object localContext) {
*
* @deprecated - the {@link ExecutionInput#getGraphQLContext()} is a fixed mutable instance now
*/
@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
public Builder context(Object context) {
this.context = context;
return this;
Expand All @@ -289,8 +287,7 @@ public Builder context(Object context) {
*
* @deprecated - the {@link ExecutionInput#getGraphQLContext()} is a fixed mutable instance now
*/
@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
public Builder context(GraphQLContext.Builder contextBuilder) {
this.context = contextBuilder.build();
return this;
Expand All @@ -305,8 +302,7 @@ public Builder context(GraphQLContext.Builder contextBuilder) {
*
* @deprecated - the {@link ExecutionInput#getGraphQLContext()} is a fixed mutable instance now
*/
@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
public Builder context(UnaryOperator<GraphQLContext.Builder> contextBuilderFunction) {
GraphQLContext.Builder builder = GraphQLContext.newContext();
builder = contextBuilderFunction.apply(builder);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/graphql/TypeResolutionEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public GraphQLSchema getSchema() {
*
* @deprecated use {@link #getGraphQLContext()} instead
*/
@Deprecated
@DeprecatedAt("2021-12-27")
@Deprecated(since = "2021-12-27")
public <T> T getContext() {
//noinspection unchecked
return (T) context;
Expand Down
40 changes: 13 additions & 27 deletions src/main/java/graphql/collect/ImmutableMapWithNullValues.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package graphql.collect;

import graphql.Assert;
import graphql.DeprecatedAt;
import graphql.Internal;

import java.util.Collection;
Expand Down Expand Up @@ -82,29 +81,25 @@ public V get(Object key) {
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V put(K key, V value) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V remove(Object key) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public void putAll(Map<? extends K, ? extends V> m) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public void clear() {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -145,64 +140,55 @@ public void forEach(BiConsumer<? super K, ? super V> action) {
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V putIfAbsent(K key, V value) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public boolean remove(Object key, Object value) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public boolean replace(K key, V oldValue, V newValue) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V replace(K key, V value) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
@DeprecatedAt("2020-11-10")
@Deprecated(since = "2020-11-10")
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
throw new UnsupportedOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package graphql.execution;

import graphql.DeprecatedAt;
import graphql.ExecutionResult;
import graphql.PublicSpi;
import graphql.schema.DataFetcher;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/graphql/execution/DataFetcherResult.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package graphql.execution;

import com.google.common.collect.ImmutableList;
import graphql.DeprecatedAt;
import graphql.ExecutionResult;
import graphql.GraphQLError;
import graphql.Internal;
Expand Down Expand Up @@ -49,8 +48,7 @@ public class DataFetcherResult<T> {
* @deprecated use the {@link #newResult()} builder instead
*/
@Internal
@Deprecated
@DeprecatedAt("2019-01-11")
@Deprecated(since = "2019-01-11")
public DataFetcherResult(T data, List<GraphQLError> errors) {
this(data, errors, null, null);
}
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/graphql/execution/ExecutionContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import graphql.DeprecatedAt;
import graphql.ExecutionInput;
import graphql.GraphQLContext;
import graphql.GraphQLError;
Expand Down Expand Up @@ -120,8 +119,7 @@ public OperationDefinition getOperationDefinition() {
*
* @deprecated use {@link #getCoercedVariables()} instead
*/
@Deprecated
@DeprecatedAt("2022-05-24")
@Deprecated(since = "2022-05-24")
public Map<String, Object> getVariables() {
return coercedVariables.toMap();
}
Expand All @@ -137,8 +135,7 @@ public CoercedVariables getCoercedVariables() {
*
* @deprecated use {@link #getGraphQLContext()} instead
*/
@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
public <T> T getContext() {
return (T) context;
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/graphql/execution/ExecutionContextBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import graphql.DeprecatedAt;
import graphql.ExecutionInput;
import graphql.GraphQLContext;
import graphql.GraphQLError;
Expand Down Expand Up @@ -131,8 +130,7 @@ public ExecutionContextBuilder subscriptionStrategy(ExecutionStrategy subscripti
/*
* @deprecated use {@link #graphQLContext(GraphQLContext)} instead
*/
@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
public ExecutionContextBuilder context(Object context) {
this.context = context;
return this;
Expand All @@ -159,8 +157,7 @@ public ExecutionContextBuilder root(Object root) {
*
* @deprecated use {@link #coercedVariables(CoercedVariables)} instead
*/
@Deprecated
@DeprecatedAt("2022-05-24")
@Deprecated(since = "2022-05-24")
public ExecutionContextBuilder variables(Map<String, Object> variables) {
this.coercedVariables = CoercedVariables.of(variables);
return this;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/graphql/execution/ExecutionStepInfo.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package graphql.execution;

import graphql.DeprecatedAt;
import graphql.PublicApi;
import graphql.collect.ImmutableMapWithNullValues;
import graphql.schema.GraphQLFieldDefinition;
Expand Down Expand Up @@ -84,8 +83,7 @@ private ExecutionStepInfo(Builder builder) {
* @see ExecutionStepInfo#getObjectType()
* @deprecated use {@link #getObjectType()} instead as it is named better
*/
@Deprecated
@DeprecatedAt("2022-02-03")
@Deprecated(since = "2022-02-03")
public GraphQLObjectType getFieldContainer() {
return fieldContainer;
}
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/graphql/execution/TypeResolutionParameters.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package graphql.execution;

import graphql.DeprecatedAt;
import graphql.GraphQLContext;
import graphql.Internal;
import graphql.TypeResolutionEnvironment;
Expand Down Expand Up @@ -74,8 +73,7 @@ public static Builder newParameters() {
*
* @deprecated use {@link #getGraphQLContext()} instead
*/
@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
public Object getContext() {
return context;
}
Expand Down Expand Up @@ -125,8 +123,7 @@ public Builder schema(GraphQLSchema schema) {
return this;
}

@Deprecated
@DeprecatedAt("2021-07-05")
@Deprecated(since = "2021-07-05")
public Builder context(Object context) {
this.context = context;
return this;
Expand Down

0 comments on commit f6fe760

Please sign in to comment.