Skip to content

Commit ba39be3

Browse files
authored
Remove deprecated public constructors (#2279)
public constructors on the main graphql objects have been deprecated in favour of builders since 12.0. So it is time to remove them finally.
1 parent 1a10708 commit ba39be3

30 files changed

Lines changed: 146 additions & 510 deletions

src/main/java/graphql/schema/GraphQLDirectiveContainer.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
package graphql.schema;
22

3-
4-
import com.google.common.collect.ImmutableList;
5-
import com.google.common.collect.ImmutableMap;
63
import graphql.PublicApi;
74

85
import java.util.List;
96
import java.util.Map;
107

11-
import static graphql.DirectivesUtil.allDirectivesByName;
12-
import static graphql.DirectivesUtil.nonRepeatableDirectivesByName;
13-
import static graphql.DirectivesUtil.nonRepeatedDirectiveByNameWithAssert;
148
import static java.util.Collections.emptyList;
159

1610
/**

src/main/java/graphql/schema/GraphQLEnumType.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,7 @@ public class GraphQLEnumType implements GraphQLNamedInputType, GraphQLNamedOutpu
4848
public static final String CHILD_VALUES = "values";
4949
public static final String CHILD_DIRECTIVES = "directives";
5050

51-
52-
/**
53-
* @param name the name
54-
* @param description the description
55-
* @param values the values
56-
*
57-
* @deprecated use the {@link #newEnum()} builder pattern instead, as this constructor will be made private in a future version.
58-
*/
59-
@Internal
60-
@Deprecated
61-
public GraphQLEnumType(String name, String description, List<GraphQLEnumValueDefinition> values) {
62-
this(name, description, values, emptyList(), null);
63-
}
64-
65-
/**
66-
* @param name the name
67-
* @param description the description
68-
* @param values the values
69-
* @param directives the directives on this type element
70-
* @param definition the AST definition
71-
*
72-
* @deprecated use the {@link #newEnum()} builder pattern instead, as this constructor will be made private in a future version.
73-
*/
7451
@Internal
75-
@Deprecated
76-
public GraphQLEnumType(String name, String description, List<GraphQLEnumValueDefinition> values, List<GraphQLDirective> directives, EnumTypeDefinition definition) {
77-
this(name, description, values, directives, definition, emptyList());
78-
}
79-
8052
private GraphQLEnumType(String name, String description, List<GraphQLEnumValueDefinition> values, List<GraphQLDirective> directives, EnumTypeDefinition definition, List<EnumTypeExtensionDefinition> extensionDefinitions) {
8153
assertValidName(name);
8254
assertNotNull(directives, () -> "directives cannot be null");

src/main/java/graphql/schema/GraphQLEnumValueDefinition.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import static graphql.Assert.assertNotNull;
1818
import static graphql.Assert.assertValidName;
19-
import static java.util.Collections.emptyList;
2019

2120
/**
2221
* A graphql enumeration type has a limited set of values and this defines one of those unique values
@@ -37,48 +36,7 @@ public class GraphQLEnumValueDefinition implements GraphQLNamedSchemaElement, Gr
3736

3837
public static final String CHILD_DIRECTIVES = "directives";
3938

40-
/**
41-
* @param name the name
42-
* @param description the description
43-
* @param value the value
44-
*
45-
* @deprecated use the {@link #newEnumValueDefinition()} builder pattern instead, as this constructor will be made private in a future version.
46-
*/
47-
@Internal
48-
@Deprecated
49-
public GraphQLEnumValueDefinition(String name, String description, Object value) {
50-
this(name, description, value, null, emptyList());
51-
}
52-
53-
/**
54-
* @param name the name
55-
* @param description the description
56-
* @param value the value
57-
* @param deprecationReason the deprecation reasons
58-
*
59-
* @deprecated use the {@link #newEnumValueDefinition()} builder pattern instead, as this constructor will be made private in a future version.
60-
*/
6139
@Internal
62-
@Deprecated
63-
public GraphQLEnumValueDefinition(String name, String description, Object value, String deprecationReason) {
64-
this(name, description, value, deprecationReason, emptyList());
65-
}
66-
67-
/**
68-
* @param name the name
69-
* @param description the description
70-
* @param value the value
71-
* @param deprecationReason the deprecation reasons
72-
* @param directives the directives on this type element
73-
*
74-
* @deprecated use the {@link #newEnumValueDefinition()} builder pattern instead, as this constructor will be made private in a future version.
75-
*/
76-
@Internal
77-
@Deprecated
78-
public GraphQLEnumValueDefinition(String name, String description, Object value, String deprecationReason, List<GraphQLDirective> directives) {
79-
this(name, description, value, deprecationReason, directives, null);
80-
}
81-
8240
private GraphQLEnumValueDefinition(String name, String description, Object value, String deprecationReason, List<GraphQLDirective> directives, EnumValueDefinition definition) {
8341
assertValidName(name);
8442
assertNotNull(directives, () -> "directives cannot be null");

src/main/java/graphql/schema/GraphQLFieldDefinition.java

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import graphql.util.TraverserContext;
1111

1212
import java.util.ArrayList;
13-
import java.util.Collections;
1413
import java.util.LinkedHashMap;
1514
import java.util.List;
1615
import java.util.Map;
@@ -50,38 +49,8 @@ public class GraphQLFieldDefinition implements GraphQLNamedSchemaElement, GraphQ
5049
public static final String CHILD_DIRECTIVES = "directives";
5150
public static final String CHILD_TYPE = "type";
5251

53-
54-
/**
55-
* @param name the name
56-
* @param description the description
57-
* @param type the field type
58-
* @param dataFetcher the field data fetcher
59-
* @param arguments the field arguments
60-
* @param deprecationReason the deprecation reason
61-
*
62-
* @deprecated use the {@link #newFieldDefinition()} builder pattern instead, as this constructor will be made private in a future version.
63-
*/
64-
@Internal
65-
@Deprecated
66-
public GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcher<?> dataFetcher, List<GraphQLArgument> arguments, String deprecationReason) {
67-
this(name, description, type, DataFetcherFactories.useDataFetcher(dataFetcher), arguments, deprecationReason, Collections.emptyList(), null);
68-
}
69-
70-
/**
71-
* @param name the name
72-
* @param description the description
73-
* @param type the field type
74-
* @param dataFetcherFactory the field data fetcher factory
75-
* @param arguments the field arguments
76-
* @param deprecationReason the deprecation reason
77-
* @param directives the directives on this type element
78-
* @param definition the AST definition
79-
*
80-
* @deprecated use the {@link #newFieldDefinition()} builder pattern instead, as this constructor will be made private in a future version.
81-
*/
8252
@Internal
83-
@Deprecated
84-
public GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcherFactory dataFetcherFactory, List<GraphQLArgument> arguments, String deprecationReason, List<GraphQLDirective> directives, FieldDefinition definition) {
53+
private GraphQLFieldDefinition(String name, String description, GraphQLOutputType type, DataFetcherFactory dataFetcherFactory, List<GraphQLArgument> arguments, String deprecationReason, List<GraphQLDirective> directives, FieldDefinition definition) {
8554
assertValidName(name);
8655
assertNotNull(type, () -> "type can't be null");
8756
assertNotNull(arguments, () -> "arguments can't be null");

src/main/java/graphql/schema/GraphQLInputObjectType.java

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,8 @@ public class GraphQLInputObjectType implements GraphQLNamedInputType, GraphQLUnm
4343
public static final String CHILD_FIELD_DEFINITIONS = "fieldDefinitions";
4444
public static final String CHILD_DIRECTIVES = "directives";
4545

46-
/**
47-
* @param name the name
48-
* @param description the description
49-
* @param fields the fields
50-
*
51-
* @deprecated use the {@link #newInputObject()} builder pattern instead, as this constructor will be made private in a future version.
52-
*/
5346
@Internal
54-
@Deprecated
55-
public GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields) {
56-
this(name, description, fields, emptyList(), null);
57-
}
58-
59-
/**
60-
* @param name the name
61-
* @param description the description
62-
* @param fields the fields
63-
* @param directives the directives on this type element
64-
* @param definition the AST definition
65-
*
66-
* @deprecated use the {@link #newInputObject()} builder pattern instead, as this constructor will be made private in a future version.
67-
*/
68-
@Internal
69-
@Deprecated
70-
public GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields, List<GraphQLDirective> directives, InputObjectTypeDefinition definition) {
71-
this(name, description, fields, directives, definition, emptyList());
72-
}
73-
74-
public GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields, List<GraphQLDirective> directives, InputObjectTypeDefinition definition, List<InputObjectTypeExtensionDefinition> extensionDefinitions) {
47+
private GraphQLInputObjectType(String name, String description, List<GraphQLInputObjectField> fields, List<GraphQLDirective> directives, InputObjectTypeDefinition definition, List<InputObjectTypeExtensionDefinition> extensionDefinitions) {
7548
assertValidName(name);
7649
assertNotNull(fields, () -> "fields can't be null");
7750
assertNotNull(directives, () -> "directives cannot be null");

src/main/java/graphql/schema/GraphQLInterfaceType.java

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,40 +56,8 @@ public class GraphQLInterfaceType implements GraphQLNamedType, GraphQLCompositeT
5656
public static final String CHILD_DIRECTIVES = "directives";
5757
public static final String CHILD_INTERFACES = "interfaces";
5858

59-
60-
/**
61-
* @param name the name
62-
* @param description the description
63-
* @param fieldDefinitions the fields
64-
* @param typeResolver the type resolver function
65-
*
66-
* @deprecated use the {@link #newInterface()} builder pattern instead, as this constructor will be made private in a future version.
67-
*/
68-
@Internal
69-
@Deprecated
70-
public GraphQLInterfaceType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions, TypeResolver typeResolver) {
71-
this(name, description, fieldDefinitions, typeResolver, emptyList(), null);
72-
}
73-
74-
/**
75-
* @param name the name
76-
* @param description the description
77-
* @param fieldDefinitions the fields
78-
* @param typeResolver the type resolver function
79-
* @param directives the directives on this type element
80-
* @param definition the AST definition
81-
*
82-
* @deprecated use the {@link #newInterface()} builder pattern instead, as this constructor will be made private in a future version.
83-
*/
84-
@Internal
85-
@Deprecated
86-
public GraphQLInterfaceType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions, TypeResolver typeResolver, List<GraphQLDirective> directives, InterfaceTypeDefinition definition) {
87-
this(name, description, fieldDefinitions, typeResolver, directives, definition, emptyList(), emptyList(), asIsOrder());
88-
}
89-
9059
@Internal
91-
@Deprecated
92-
public GraphQLInterfaceType(String name,
60+
private GraphQLInterfaceType(String name,
9361
String description,
9462
List<GraphQLFieldDefinition> fieldDefinitions,
9563
TypeResolver typeResolver, List<GraphQLDirective> directives,

src/main/java/graphql/schema/GraphQLObjectType.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static graphql.Assert.assertNotNull;
2424
import static graphql.Assert.assertShouldNeverHappen;
2525
import static graphql.Assert.assertValidName;
26-
import static graphql.schema.GraphqlTypeComparators.asIsOrder;
2726
import static graphql.schema.GraphqlTypeComparators.sortTypes;
2827
import static graphql.util.FpKit.getByName;
2928
import static graphql.util.FpKit.valuesToList;
@@ -57,40 +56,7 @@ public class GraphQLObjectType implements GraphQLNamedOutputType, GraphQLComposi
5756
public static final String CHILD_DIRECTIVES = "directives";
5857
public static final String CHILD_FIELD_DEFINITIONS = "fieldDefinitions";
5958

60-
61-
/**
62-
* @param name the name
63-
* @param description the description
64-
* @param fieldDefinitions the fields
65-
* @param interfaces the possible interfaces
66-
*
67-
* @deprecated use the {@link #newObject()} builder pattern instead, as this constructor will be made private in a future version.
68-
*/
6959
@Internal
70-
@Deprecated
71-
public GraphQLObjectType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions,
72-
List<GraphQLNamedOutputType> interfaces) {
73-
this(name, description, fieldDefinitions, interfaces, emptyList(), null);
74-
}
75-
76-
/**
77-
* @param name the name
78-
* @param description the description
79-
* @param fieldDefinitions the fields
80-
* @param interfaces the possible interfaces
81-
* @param directives the directives on this type element
82-
* @param definition the AST definition
83-
*
84-
* @deprecated use the {@link #newObject()} builder pattern instead, as this constructor will be made private in a future version.
85-
*/
86-
@Internal
87-
@Deprecated
88-
public GraphQLObjectType(String name, String description, List<GraphQLFieldDefinition> fieldDefinitions,
89-
List<GraphQLNamedOutputType> interfaces, List<GraphQLDirective> directives, ObjectTypeDefinition definition) {
90-
this(name, description, fieldDefinitions, interfaces, directives, definition, emptyList(), asIsOrder());
91-
}
92-
93-
9460
private GraphQLObjectType(String name,
9561
String description,
9662
List<GraphQLFieldDefinition> fieldDefinitions,

src/main/java/graphql/schema/GraphQLScalarType.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,7 @@ public class GraphQLScalarType implements GraphQLNamedInputType, GraphQLNamedOut
4848

4949
public static final String CHILD_DIRECTIVES = "directives";
5050

51-
52-
/**
53-
* @param name the name
54-
* @param description the description
55-
* @param coercing the coercing function
56-
*
57-
* @deprecated use the {@link #newScalar()} builder pattern instead, as this constructor will be made private in a future version.
58-
*/
59-
@Internal
60-
@Deprecated
61-
public GraphQLScalarType(String name, String description, Coercing coercing) {
62-
this(name, description, coercing, emptyList(), null);
63-
}
64-
65-
/**
66-
* @param name the name
67-
* @param description the description
68-
* @param coercing the coercing function
69-
* @param directives the directives on this type element
70-
* @param definition the AST definition
71-
*
72-
* @deprecated use the {@link #newScalar()} builder pattern instead, as this constructor will be made private in a future version.
73-
*/
7451
@Internal
75-
@Deprecated
76-
public GraphQLScalarType(String name, String description, Coercing coercing, List<GraphQLDirective> directives, ScalarTypeDefinition definition) {
77-
this(name, description, coercing, directives, definition, emptyList(), null);
78-
}
79-
8052
private GraphQLScalarType(String name,
8153
String description,
8254
Coercing coercing,

src/main/java/graphql/schema/GraphQLSchema.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import java.util.ArrayList;
2222
import java.util.Collection;
23-
import java.util.Collections;
2423
import java.util.LinkedHashSet;
2524
import java.util.List;
2625
import java.util.Map;
@@ -69,44 +68,6 @@ public class GraphQLSchema {
6968

7069
private final String description;
7170

72-
/**
73-
* @param queryType the query type
74-
*
75-
* @deprecated use the {@link #newSchema()} builder pattern instead, as this constructor will be made private in a future version.
76-
*/
77-
@Internal
78-
@Deprecated
79-
public GraphQLSchema(GraphQLObjectType queryType) {
80-
this(queryType, null, Collections.emptySet());
81-
}
82-
83-
/**
84-
* @param queryType the query type
85-
* @param mutationType the mutation type
86-
* @param additionalTypes additional types
87-
*
88-
* @deprecated use the {@link #newSchema()} builder pattern instead, as this constructor will be made private in a future version.
89-
*/
90-
@Internal
91-
@Deprecated
92-
public GraphQLSchema(GraphQLObjectType queryType, GraphQLObjectType mutationType, Set<GraphQLType> additionalTypes) {
93-
this(queryType, mutationType, null, additionalTypes);
94-
}
95-
96-
/**
97-
* @param queryType the query type
98-
* @param mutationType the mutation type
99-
* @param subscriptionType the subscription type
100-
* @param additionalTypes additional types
101-
*
102-
* @deprecated use the {@link #newSchema()} builder pattern instead, as this constructor will be made private in a future version.
103-
*/
104-
@Internal
105-
@Deprecated
106-
public GraphQLSchema(GraphQLObjectType queryType, GraphQLObjectType mutationType, GraphQLObjectType subscriptionType, Set<GraphQLType> additionalTypes) {
107-
this(newSchema().query(queryType).mutation(mutationType).subscription(subscriptionType).additionalTypes(additionalTypes), false);
108-
}
109-
11071
@Internal
11172
private GraphQLSchema(Builder builder, boolean afterTransform) {
11273
assertNotNull(builder.additionalTypes, () -> "additionalTypes can't be null");

0 commit comments

Comments
 (0)