@@ -94,38 +94,19 @@ public final void sort(Comparator<? super T> c) {
94
94
}
95
95
96
96
public static final class Longs extends ScriptDocValues <Long > {
97
- protected static final DeprecationLogger deprecationLogger = new DeprecationLogger (ESLoggerFactory .getLogger (Longs .class ));
98
-
99
97
private final SortedNumericDocValues in ;
100
- /**
101
- * Callback for deprecated fields. In production this should always point to
102
- * {@link #deprecationLogger} but tests will override it so they can test that
103
- * we use the required permissions when calling it.
104
- */
105
- private final Consumer <String > deprecationCallback ;
106
98
private long [] values = new long [0 ];
107
99
private int count ;
108
- private Dates dates ;
109
- private int docId = -1 ;
110
100
111
101
/**
112
102
* Standard constructor.
113
103
*/
114
104
public Longs (SortedNumericDocValues in ) {
115
- this (in , deprecationLogger ::deprecated );
116
- }
117
-
118
- /**
119
- * Constructor for testing the deprecation callback.
120
- */
121
- Longs (SortedNumericDocValues in , Consumer <String > deprecationCallback ) {
122
105
this .in = in ;
123
- this .deprecationCallback = deprecationCallback ;
124
106
}
125
107
126
108
@ Override
127
109
public void setNextDocId (int docId ) throws IOException {
128
- this .docId = docId ;
129
110
if (in .advanceExact (docId )) {
130
111
resize (in .docValueCount ());
131
112
for (int i = 0 ; i < count ; i ++) {
@@ -134,9 +115,6 @@ public void setNextDocId(int docId) throws IOException {
134
115
} else {
135
116
resize (0 );
136
117
}
137
- if (dates != null ) {
138
- dates .setNextDocId (docId );
139
- }
140
118
}
141
119
142
120
/**
@@ -148,37 +126,13 @@ protected void resize(int newSize) {
148
126
values = ArrayUtil .grow (values , count );
149
127
}
150
128
151
- public SortedNumericDocValues getInternalValues () {
152
- return this .in ;
153
- }
154
-
155
129
public long getValue () {
156
130
if (count == 0 ) {
157
131
return 0L ;
158
132
}
159
133
return values [0 ];
160
134
}
161
135
162
- @ Deprecated
163
- public ReadableDateTime getDate () throws IOException {
164
- deprecated ("getDate on numeric fields is deprecated. Use a date field to get dates." );
165
- if (dates == null ) {
166
- dates = new Dates (in );
167
- dates .setNextDocId (docId );
168
- }
169
- return dates .getValue ();
170
- }
171
-
172
- @ Deprecated
173
- public List <ReadableDateTime > getDates () throws IOException {
174
- deprecated ("getDates on numeric fields is deprecated. Use a date field to get dates." );
175
- if (dates == null ) {
176
- dates = new Dates (in );
177
- dates .setNextDocId (docId );
178
- }
179
- return dates ;
180
- }
181
-
182
136
@ Override
183
137
public Long get (int index ) {
184
138
return values [index ];
@@ -188,22 +142,6 @@ public Long get(int index) {
188
142
public int size () {
189
143
return count ;
190
144
}
191
-
192
- /**
193
- * Log a deprecation log, with the server's permissions, not the permissions of the
194
- * script calling this method. We need to do this to prevent errors when rolling
195
- * the log file.
196
- */
197
- private void deprecated (String message ) {
198
- // Intentionally not calling SpecialPermission.check because this is supposed to be called by scripts
199
- AccessController .doPrivileged (new PrivilegedAction <Void >() {
200
- @ Override
201
- public Void run () {
202
- deprecationCallback .accept (message );
203
- return null ;
204
- }
205
- });
206
- }
207
145
}
208
146
209
147
public static final class Dates extends ScriptDocValues <ReadableDateTime > {
@@ -212,12 +150,6 @@ public static final class Dates extends ScriptDocValues<ReadableDateTime> {
212
150
private static final ReadableDateTime EPOCH = new DateTime (0 , DateTimeZone .UTC );
213
151
214
152
private final SortedNumericDocValues in ;
215
- /**
216
- * Callback for deprecated fields. In production this should always point to
217
- * {@link #deprecationLogger} but tests will override it so they can test that
218
- * we use the required permissions when calling it.
219
- */
220
- private final Consumer <String > deprecationCallback ;
221
153
/**
222
154
* Values wrapped in {@link MutableDateTime}. Null by default an allocated on first usage so we allocate a reasonably size. We keep
223
155
* this array so we don't have allocate new {@link MutableDateTime}s on every usage. Instead we reuse them for every document.
@@ -229,15 +161,7 @@ public static final class Dates extends ScriptDocValues<ReadableDateTime> {
229
161
* Standard constructor.
230
162
*/
231
163
public Dates (SortedNumericDocValues in ) {
232
- this (in , deprecationLogger ::deprecated );
233
- }
234
-
235
- /**
236
- * Constructor for testing deprecation logging.
237
- */
238
- Dates (SortedNumericDocValues in , Consumer <String > deprecationCallback ) {
239
164
this .in = in ;
240
- this .deprecationCallback = deprecationCallback ;
241
165
}
242
166
243
167
/**
@@ -251,24 +175,6 @@ public ReadableDateTime getValue() {
251
175
return get (0 );
252
176
}
253
177
254
- /**
255
- * Fetch the first value. Added for backwards compatibility with 5.x when date fields were {@link Longs}.
256
- */
257
- @ Deprecated
258
- public ReadableDateTime getDate () {
259
- deprecated ("getDate is no longer necessary on date fields as the value is now a date." );
260
- return getValue ();
261
- }
262
-
263
- /**
264
- * Fetch all the values. Added for backwards compatibility with 5.x when date fields were {@link Longs}.
265
- */
266
- @ Deprecated
267
- public List <ReadableDateTime > getDates () {
268
- deprecated ("getDates is no longer necessary on date fields as the values are now dates." );
269
- return this ;
270
- }
271
-
272
178
@ Override
273
179
public ReadableDateTime get (int index ) {
274
180
if (index >= count ) {
@@ -326,22 +232,6 @@ void refreshArray() throws IOException {
326
232
dates [i ] = new MutableDateTime (in .nextValue (), DateTimeZone .UTC );
327
233
}
328
234
}
329
-
330
- /**
331
- * Log a deprecation log, with the server's permissions, not the permissions of the
332
- * script calling this method. We need to do this to prevent errors when rolling
333
- * the log file.
334
- */
335
- private void deprecated (String message ) {
336
- // Intentionally not calling SpecialPermission.check because this is supposed to be called by scripts
337
- AccessController .doPrivileged (new PrivilegedAction <Void >() {
338
- @ Override
339
- public Void run () {
340
- deprecationCallback .accept (message );
341
- return null ;
342
- }
343
- });
344
- }
345
235
}
346
236
347
237
public static final class Doubles extends ScriptDocValues <Double > {
0 commit comments