author | psandoz |
Thu, 24 Mar 2016 11:21:18 +0100 | |
changeset 36933 | 3e6453e2d833 |
parent 31873 | 87b015c2cd36 |
child 37913 | 3cc95b690353 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
2 |
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2 | 22 |
*/ |
23 |
||
24 |
/* Type-specific source code for unit test |
|
25 |
* |
|
26 |
* Regenerate the BasicX classes via genBasic.sh whenever this file changes. |
|
27 |
* We check in the generated source files so that the test tree can be used |
|
28 |
* independently of the rest of the source tree. |
|
29 |
*/ |
|
30 |
||
31 |
// -- This file was mechanically generated: Do not edit! -- // |
|
32 |
||
33 |
import java.nio.*; |
|
1634
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
34 |
import java.lang.reflect.Method; |
2 | 35 |
|
36 |
||
37 |
public class BasicLong |
|
38 |
extends Basic |
|
39 |
{ |
|
40 |
||
4502
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
41 |
private static final long[] VALUES = { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
42 |
Long.MIN_VALUE, |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
43 |
(long) -1, |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
44 |
(long) 0, |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
45 |
(long) 1, |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
46 |
Long.MAX_VALUE, |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
47 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
48 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
49 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
50 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
51 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
52 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
53 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
54 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
55 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
56 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
57 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
58 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
59 |
}; |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
60 |
|
2 | 61 |
private static void relGet(LongBuffer b) { |
62 |
int n = b.capacity(); |
|
63 |
long v; |
|
64 |
for (int i = 0; i < n; i++) |
|
65 |
ck(b, (long)b.get(), (long)((long)ic(i))); |
|
66 |
b.rewind(); |
|
67 |
} |
|
68 |
||
69 |
private static void relGet(LongBuffer b, int start) { |
|
70 |
int n = b.remaining(); |
|
71 |
long v; |
|
72 |
for (int i = start; i < n; i++) |
|
73 |
ck(b, (long)b.get(), (long)((long)ic(i))); |
|
74 |
b.rewind(); |
|
75 |
} |
|
76 |
||
77 |
private static void absGet(LongBuffer b) { |
|
78 |
int n = b.capacity(); |
|
79 |
long v; |
|
80 |
for (int i = 0; i < n; i++) |
|
81 |
ck(b, (long)b.get(), (long)((long)ic(i))); |
|
82 |
b.rewind(); |
|
83 |
} |
|
84 |
||
85 |
private static void bulkGet(LongBuffer b) { |
|
86 |
int n = b.capacity(); |
|
87 |
long[] a = new long[n + 7]; |
|
88 |
b.get(a, 7, n); |
|
89 |
for (int i = 0; i < n; i++) |
|
90 |
ck(b, (long)a[i + 7], (long)((long)ic(i))); |
|
91 |
} |
|
92 |
||
93 |
private static void relPut(LongBuffer b) { |
|
94 |
int n = b.capacity(); |
|
95 |
b.clear(); |
|
96 |
for (int i = 0; i < n; i++) |
|
97 |
b.put((long)ic(i)); |
|
98 |
b.flip(); |
|
99 |
} |
|
100 |
||
101 |
private static void absPut(LongBuffer b) { |
|
102 |
int n = b.capacity(); |
|
103 |
b.clear(); |
|
104 |
for (int i = 0; i < n; i++) |
|
105 |
b.put(i, (long)ic(i)); |
|
106 |
b.limit(n); |
|
107 |
b.position(0); |
|
108 |
} |
|
109 |
||
110 |
private static void bulkPutArray(LongBuffer b) { |
|
111 |
int n = b.capacity(); |
|
112 |
b.clear(); |
|
113 |
long[] a = new long[n + 7]; |
|
114 |
for (int i = 0; i < n; i++) |
|
115 |
a[i + 7] = (long)ic(i); |
|
116 |
b.put(a, 7, n); |
|
117 |
b.flip(); |
|
118 |
} |
|
119 |
||
120 |
private static void bulkPutBuffer(LongBuffer b) { |
|
121 |
int n = b.capacity(); |
|
122 |
b.clear(); |
|
123 |
LongBuffer c = LongBuffer.allocate(n + 7); |
|
124 |
c.position(7); |
|
125 |
for (int i = 0; i < n; i++) |
|
126 |
c.put((long)ic(i)); |
|
127 |
c.flip(); |
|
128 |
c.position(7); |
|
129 |
b.put(c); |
|
130 |
b.flip(); |
|
31873
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
131 |
try { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
132 |
b.put(b); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
133 |
fail("IllegalArgumentException expected for put into same buffer"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
134 |
} catch (IllegalArgumentException e) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
135 |
if (e.getMessage() == null) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
136 |
fail("Non-null IllegalArgumentException message expected from" |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
137 |
+ " put into same buffer"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
138 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
139 |
} |
2 | 140 |
} |
141 |
||
142 |
//6231529 |
|
143 |
private static void callReset(LongBuffer b) { |
|
144 |
b.position(0); |
|
145 |
b.mark(); |
|
146 |
||
147 |
b.duplicate().reset(); |
|
148 |
b.asReadOnlyBuffer().reset(); |
|
149 |
} |
|
150 |
||
151 |
||
152 |
||
153 |
// 6221101-6234263 |
|
154 |
||
155 |
private static void putBuffer() { |
|
156 |
final int cap = 10; |
|
157 |
||
158 |
LongBuffer direct1 = ByteBuffer.allocateDirect(cap).asLongBuffer(); |
|
159 |
LongBuffer nondirect1 = ByteBuffer.allocate(cap).asLongBuffer(); |
|
160 |
direct1.put(nondirect1); |
|
161 |
||
162 |
LongBuffer direct2 = ByteBuffer.allocateDirect(cap).asLongBuffer(); |
|
163 |
LongBuffer nondirect2 = ByteBuffer.allocate(cap).asLongBuffer(); |
|
164 |
nondirect2.put(direct2); |
|
165 |
||
166 |
LongBuffer direct3 = ByteBuffer.allocateDirect(cap).asLongBuffer(); |
|
167 |
LongBuffer direct4 = ByteBuffer.allocateDirect(cap).asLongBuffer(); |
|
168 |
direct3.put(direct4); |
|
169 |
||
170 |
LongBuffer nondirect3 = ByteBuffer.allocate(cap).asLongBuffer(); |
|
171 |
LongBuffer nondirect4 = ByteBuffer.allocate(cap).asLongBuffer(); |
|
172 |
nondirect3.put(nondirect4); |
|
173 |
} |
|
174 |
||
175 |
||
176 |
||
177 |
||
178 |
||
179 |
||
180 |
||
181 |
||
182 |
||
183 |
||
184 |
||
185 |
||
186 |
||
187 |
||
188 |
||
189 |
||
190 |
||
191 |
private static void checkSlice(LongBuffer b, LongBuffer slice) { |
|
192 |
ck(slice, 0, slice.position()); |
|
193 |
ck(slice, b.remaining(), slice.limit()); |
|
194 |
ck(slice, b.remaining(), slice.capacity()); |
|
195 |
if (b.isDirect() != slice.isDirect()) |
|
196 |
fail("Lost direction", slice); |
|
197 |
if (b.isReadOnly() != slice.isReadOnly()) |
|
198 |
fail("Lost read-only", slice); |
|
199 |
} |
|
200 |
||
201 |
||
202 |
||
203 |
||
204 |
||
205 |
||
206 |
||
207 |
||
208 |
||
209 |
||
210 |
||
211 |
||
212 |
||
213 |
||
214 |
||
215 |
||
216 |
||
217 |
||
218 |
||
219 |
||
220 |
||
221 |
||
222 |
||
223 |
||
224 |
||
225 |
||
226 |
||
227 |
||
228 |
||
229 |
||
230 |
||
231 |
||
232 |
||
233 |
||
234 |
||
235 |
||
236 |
||
237 |
||
238 |
||
239 |
||
240 |
||
241 |
||
242 |
||
243 |
||
244 |
||
245 |
||
246 |
||
247 |
||
248 |
||
249 |
||
250 |
||
251 |
||
252 |
||
253 |
||
254 |
||
255 |
||
256 |
||
257 |
||
258 |
||
259 |
||
260 |
||
261 |
||
262 |
||
263 |
||
264 |
||
265 |
||
266 |
||
267 |
||
268 |
||
269 |
||
270 |
||
271 |
||
272 |
||
273 |
||
274 |
||
275 |
||
276 |
||
277 |
||
278 |
||
279 |
||
280 |
||
281 |
||
282 |
||
283 |
||
284 |
||
285 |
||
286 |
||
287 |
||
288 |
||
289 |
||
290 |
||
291 |
||
292 |
||
293 |
||
294 |
||
295 |
||
296 |
||
297 |
||
298 |
||
299 |
||
300 |
||
301 |
||
302 |
||
303 |
||
304 |
||
305 |
||
306 |
||
307 |
||
308 |
||
309 |
||
310 |
||
311 |
||
312 |
||
313 |
||
314 |
||
315 |
||
1634
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
316 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
317 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
318 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
319 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
320 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
321 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
322 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
323 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
324 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
325 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
326 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
327 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
328 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
329 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
330 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
331 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
332 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
333 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
334 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
335 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
336 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
337 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
338 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
339 |
|
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
340 |
|
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
341 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
342 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
343 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
344 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
345 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
346 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
347 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
348 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
349 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
350 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
351 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
352 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
353 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
354 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
355 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
356 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
357 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
358 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
359 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
360 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
361 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
362 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
363 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
364 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
365 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
366 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
367 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
368 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
369 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
370 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
371 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
372 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
373 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
374 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
375 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
376 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
377 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
378 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
379 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
380 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
381 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
382 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
383 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
384 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
385 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
386 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
387 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
388 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
389 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
390 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
391 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
392 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
393 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
394 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
395 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
396 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
397 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
398 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
399 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
400 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
401 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
402 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
403 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
404 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
405 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
406 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
407 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
408 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
409 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
410 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
411 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
412 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
413 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
414 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
415 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
416 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
417 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
418 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
419 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
420 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
421 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
422 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
423 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
424 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
425 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
426 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
427 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
428 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
429 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
430 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
431 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
432 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
433 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
434 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
435 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
436 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
437 |
|
4502
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
438 |
private static void fail(String problem, |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
439 |
LongBuffer xb, LongBuffer yb, |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
440 |
long x, long y) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
441 |
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
442 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
443 |
|
14001
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
444 |
private static void tryCatch(Buffer b, Class<?> ex, Runnable thunk) { |
2 | 445 |
boolean caught = false; |
446 |
try { |
|
447 |
thunk.run(); |
|
448 |
} catch (Throwable x) { |
|
1634
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
449 |
if (ex.isAssignableFrom(x.getClass())) { |
2 | 450 |
caught = true; |
1634
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
451 |
} else { |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
452 |
fail(x.getMessage() + " not expected"); |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
453 |
} |
2 | 454 |
} |
455 |
if (!caught) |
|
456 |
fail(ex.getName() + " not thrown", b); |
|
457 |
} |
|
458 |
||
14001
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
459 |
private static void tryCatch(long [] t, Class<?> ex, Runnable thunk) { |
2 | 460 |
tryCatch(LongBuffer.wrap(t), ex, thunk); |
461 |
} |
|
462 |
||
463 |
public static void test(int level, final LongBuffer b, boolean direct) { |
|
464 |
||
465 |
show(level, b); |
|
466 |
||
467 |
if (direct != b.isDirect()) |
|
468 |
fail("Wrong direction", b); |
|
469 |
||
470 |
// Gets and puts |
|
471 |
||
472 |
relPut(b); |
|
473 |
relGet(b); |
|
474 |
absGet(b); |
|
475 |
bulkGet(b); |
|
476 |
||
477 |
absPut(b); |
|
478 |
relGet(b); |
|
479 |
absGet(b); |
|
480 |
bulkGet(b); |
|
481 |
||
482 |
bulkPutArray(b); |
|
483 |
relGet(b); |
|
484 |
||
485 |
bulkPutBuffer(b); |
|
486 |
relGet(b); |
|
487 |
||
488 |
||
489 |
||
490 |
||
491 |
||
492 |
||
493 |
||
494 |
||
495 |
||
496 |
||
497 |
||
498 |
||
499 |
||
500 |
||
501 |
||
502 |
||
503 |
||
504 |
||
505 |
||
506 |
||
507 |
||
508 |
||
509 |
||
2593
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1639
diff
changeset
|
510 |
|
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1639
diff
changeset
|
511 |
|
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1639
diff
changeset
|
512 |
|
13563
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
513 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
514 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
515 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
516 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
517 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
518 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
519 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
520 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
521 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
522 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
523 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
524 |
|
13c8e8f0302b
7190219: (bf) CharBuffer.put(String,int,int) modifies position even if BufferOverflowException thrown
luchsh
parents:
5506
diff
changeset
|
525 |
|
2 | 526 |
// Compact |
527 |
||
528 |
relPut(b); |
|
529 |
b.position(13); |
|
530 |
b.compact(); |
|
531 |
b.flip(); |
|
532 |
relGet(b, 13); |
|
533 |
||
534 |
// Exceptions |
|
535 |
||
536 |
relPut(b); |
|
537 |
b.limit(b.capacity() / 2); |
|
538 |
b.position(b.limit()); |
|
539 |
||
540 |
tryCatch(b, BufferUnderflowException.class, new Runnable() { |
|
541 |
public void run() { |
|
542 |
b.get(); |
|
543 |
}}); |
|
544 |
||
545 |
tryCatch(b, BufferOverflowException.class, new Runnable() { |
|
546 |
public void run() { |
|
547 |
b.put((long)42); |
|
548 |
}}); |
|
549 |
||
550 |
// The index must be non-negative and lesss than the buffer's limit. |
|
551 |
tryCatch(b, IndexOutOfBoundsException.class, new Runnable() { |
|
552 |
public void run() { |
|
553 |
b.get(b.limit()); |
|
554 |
}}); |
|
555 |
tryCatch(b, IndexOutOfBoundsException.class, new Runnable() { |
|
556 |
public void run() { |
|
557 |
b.get(-1); |
|
558 |
}}); |
|
559 |
||
560 |
tryCatch(b, IndexOutOfBoundsException.class, new Runnable() { |
|
561 |
public void run() { |
|
562 |
b.put(b.limit(), (long)42); |
|
563 |
}}); |
|
564 |
||
1634
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
565 |
tryCatch(b, InvalidMarkException.class, new Runnable() { |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
566 |
public void run() { |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
567 |
b.position(0); |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
568 |
b.mark(); |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
569 |
b.compact(); |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
570 |
b.reset(); |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
571 |
}}); |
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
2
diff
changeset
|
572 |
|
31873
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
573 |
try { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
574 |
b.position(b.limit() + 1); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
575 |
fail("IllegalArgumentException expected for position beyond limit"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
576 |
} catch (IllegalArgumentException e) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
577 |
if (e.getMessage() == null) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
578 |
fail("Non-null IllegalArgumentException message expected for" |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
579 |
+ " position beyond limit"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
580 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
581 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
582 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
583 |
try { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
584 |
b.position(-1); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
585 |
fail("IllegalArgumentException expected for negative position"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
586 |
} catch (IllegalArgumentException e) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
587 |
if (e.getMessage() == null) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
588 |
fail("Non-null IllegalArgumentException message expected for" |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
589 |
+ " negative position"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
590 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
591 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
592 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
593 |
try { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
594 |
b.limit(b.capacity() + 1); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
595 |
fail("IllegalArgumentException expected for limit beyond capacity"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
596 |
} catch (IllegalArgumentException e) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
597 |
if (e.getMessage() == null) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
598 |
fail("Non-null IllegalArgumentException message expected for" |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
599 |
+ " limit beyond capacity"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
600 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
601 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
602 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
603 |
try { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
604 |
b.limit(-1); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
605 |
fail("IllegalArgumentException expected for negative limit"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
606 |
} catch (IllegalArgumentException e) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
607 |
if (e.getMessage() == null) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
608 |
fail("Non-null IllegalArgumentException message expected for" |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
609 |
+ " negative limit"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
610 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
611 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
612 |
|
2 | 613 |
// Values |
614 |
||
615 |
b.clear(); |
|
616 |
b.put((long)0); |
|
617 |
b.put((long)-1); |
|
618 |
b.put((long)1); |
|
619 |
b.put(Long.MAX_VALUE); |
|
620 |
b.put(Long.MIN_VALUE); |
|
621 |
||
622 |
||
623 |
||
624 |
||
625 |
||
626 |
||
627 |
||
628 |
||
629 |
||
630 |
||
631 |
||
632 |
||
633 |
||
634 |
||
635 |
||
636 |
||
637 |
||
638 |
long v; |
|
639 |
b.flip(); |
|
640 |
ck(b, b.get(), 0); |
|
641 |
ck(b, b.get(), (long)-1); |
|
642 |
ck(b, b.get(), 1); |
|
643 |
ck(b, b.get(), Long.MAX_VALUE); |
|
644 |
ck(b, b.get(), Long.MIN_VALUE); |
|
645 |
||
646 |
||
647 |
||
648 |
||
649 |
||
650 |
||
651 |
||
652 |
||
653 |
||
654 |
||
655 |
||
656 |
||
657 |
||
658 |
||
659 |
||
660 |
||
661 |
||
662 |
||
663 |
||
664 |
||
665 |
||
666 |
||
31873
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
667 |
|
2 | 668 |
// Comparison |
669 |
b.rewind(); |
|
670 |
LongBuffer b2 = LongBuffer.allocate(b.capacity()); |
|
671 |
b2.put(b); |
|
672 |
b2.flip(); |
|
673 |
b.position(2); |
|
674 |
b2.position(2); |
|
675 |
if (!b.equals(b2)) { |
|
676 |
for (int i = 2; i < b.limit(); i++) { |
|
677 |
long x = b.get(i); |
|
678 |
long y = b2.get(i); |
|
679 |
if (x != y |
|
680 |
||
681 |
||
682 |
||
683 |
||
684 |
||
685 |
||
686 |
) |
|
687 |
out.println("[" + i + "] " + x + " != " + y); |
|
688 |
} |
|
689 |
fail("Identical buffers not equal", b, b2); |
|
690 |
} |
|
691 |
if (b.compareTo(b2) != 0) |
|
692 |
fail("Comparison to identical buffer != 0", b, b2); |
|
693 |
||
694 |
b.limit(b.limit() + 1); |
|
695 |
b.position(b.limit() - 1); |
|
696 |
b.put((long)99); |
|
697 |
b.rewind(); |
|
698 |
b2.rewind(); |
|
699 |
if (b.equals(b2)) |
|
700 |
fail("Non-identical buffers equal", b, b2); |
|
701 |
if (b.compareTo(b2) <= 0) |
|
702 |
fail("Comparison to shorter buffer <= 0", b, b2); |
|
703 |
b.limit(b.limit() - 1); |
|
704 |
||
705 |
b.put(2, (long)42); |
|
706 |
if (b.equals(b2)) |
|
707 |
fail("Non-identical buffers equal", b, b2); |
|
708 |
if (b.compareTo(b2) <= 0) |
|
709 |
fail("Comparison to lesser buffer <= 0", b, b2); |
|
710 |
||
4502
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
711 |
// Check equals and compareTo with interesting values |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
712 |
for (long x : VALUES) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
713 |
LongBuffer xb = LongBuffer.wrap(new long[] { x }); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
714 |
if (xb.compareTo(xb) != 0) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
715 |
fail("compareTo not reflexive", xb, xb, x, x); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
716 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
717 |
if (! xb.equals(xb)) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
718 |
fail("equals not reflexive", xb, xb, x, x); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
719 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
720 |
for (long y : VALUES) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
721 |
LongBuffer yb = LongBuffer.wrap(new long[] { y }); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
722 |
if (xb.compareTo(yb) != - yb.compareTo(xb)) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
723 |
fail("compareTo not anti-symmetric", |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
724 |
xb, yb, x, y); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
725 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
726 |
if ((xb.compareTo(yb) == 0) != xb.equals(yb)) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
727 |
fail("compareTo inconsistent with equals", |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
728 |
xb, yb, x, y); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
729 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
730 |
if (xb.compareTo(yb) != Long.compare(x, y)) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
731 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
732 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
733 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
734 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
735 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
736 |
|
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
737 |
fail("Incorrect results for LongBuffer.compareTo", |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
738 |
xb, yb, x, y); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
739 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
740 |
if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) { |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
741 |
fail("Incorrect results for LongBuffer.equals", |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
742 |
xb, yb, x, y); |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
743 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
744 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
745 |
} |
18f387917b89
6903754: (bf) Improve floating-point buffer comparison
martin
parents:
2593
diff
changeset
|
746 |
|
2 | 747 |
// Sub, dup |
748 |
||
749 |
relPut(b); |
|
750 |
relGet(b.duplicate()); |
|
751 |
b.position(13); |
|
752 |
relGet(b.duplicate(), 13); |
|
753 |
relGet(b.duplicate().slice(), 13); |
|
754 |
relGet(b.slice(), 13); |
|
755 |
relGet(b.slice().duplicate(), 13); |
|
756 |
||
757 |
// Slice |
|
758 |
||
759 |
b.position(5); |
|
760 |
LongBuffer sb = b.slice(); |
|
761 |
checkSlice(b, sb); |
|
762 |
b.position(0); |
|
763 |
LongBuffer sb2 = sb.slice(); |
|
764 |
checkSlice(sb, sb2); |
|
765 |
||
766 |
if (!sb.equals(sb2)) |
|
767 |
fail("Sliced slices do not match", sb, sb2); |
|
768 |
if ((sb.hasArray()) && (sb.arrayOffset() != sb2.arrayOffset())) |
|
769 |
fail("Array offsets do not match: " |
|
770 |
+ sb.arrayOffset() + " != " + sb2.arrayOffset(), sb, sb2); |
|
771 |
||
772 |
||
773 |
||
774 |
||
775 |
||
776 |
||
777 |
||
778 |
||
779 |
||
780 |
||
781 |
||
782 |
||
783 |
||
784 |
||
785 |
||
786 |
||
787 |
||
788 |
||
789 |
||
790 |
||
791 |
||
792 |
||
793 |
||
794 |
||
795 |
||
796 |
||
797 |
||
798 |
||
799 |
||
800 |
||
801 |
||
802 |
||
803 |
// Read-only views |
|
804 |
||
805 |
b.rewind(); |
|
806 |
final LongBuffer rb = b.asReadOnlyBuffer(); |
|
807 |
if (!b.equals(rb)) |
|
808 |
fail("Buffer not equal to read-only view", b, rb); |
|
809 |
show(level + 1, rb); |
|
810 |
||
811 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
|
812 |
public void run() { |
|
813 |
relPut(rb); |
|
814 |
}}); |
|
815 |
||
816 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
|
817 |
public void run() { |
|
818 |
absPut(rb); |
|
819 |
}}); |
|
820 |
||
821 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
|
822 |
public void run() { |
|
823 |
bulkPutArray(rb); |
|
824 |
}}); |
|
825 |
||
826 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
|
827 |
public void run() { |
|
828 |
bulkPutBuffer(rb); |
|
829 |
}}); |
|
830 |
||
14001
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
831 |
// put(LongBuffer) should not change source position |
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
832 |
final LongBuffer src = LongBuffer.allocate(1); |
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
833 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
834 |
public void run() { |
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
835 |
rb.put(src); |
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
836 |
}}); |
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
837 |
ck(src, src.position(), 0); |
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
838 |
|
2 | 839 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
840 |
public void run() { |
|
841 |
rb.compact(); |
|
842 |
}}); |
|
843 |
||
844 |
||
845 |
||
846 |
||
847 |
||
848 |
||
849 |
||
850 |
||
851 |
||
852 |
||
853 |
||
854 |
||
855 |
||
856 |
||
857 |
||
858 |
||
859 |
||
860 |
||
861 |
||
862 |
||
863 |
||
864 |
||
865 |
||
866 |
||
867 |
||
868 |
||
869 |
||
870 |
||
871 |
||
872 |
||
873 |
||
874 |
||
875 |
||
876 |
||
877 |
||
878 |
||
879 |
||
880 |
||
881 |
||
882 |
||
883 |
||
884 |
||
885 |
||
886 |
||
887 |
||
888 |
||
889 |
||
890 |
||
891 |
||
892 |
||
893 |
||
894 |
||
895 |
||
896 |
||
897 |
||
898 |
||
899 |
||
900 |
||
901 |
||
14001
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
902 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
903 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
904 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
905 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
906 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
907 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
908 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
909 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
910 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
911 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
912 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
913 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
914 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
915 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
916 |
|
e8e8413ad49a
7199551: (bf) CharBuffer.append(CharSequence) throws BufferOverflowException for read-only buffer
alanb
parents:
13563
diff
changeset
|
917 |
|
2 | 918 |
if (rb.getClass().getName().startsWith("java.nio.Heap")) { |
919 |
||
920 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
|
921 |
public void run() { |
|
922 |
rb.array(); |
|
923 |
}}); |
|
924 |
||
925 |
tryCatch(b, ReadOnlyBufferException.class, new Runnable() { |
|
926 |
public void run() { |
|
927 |
rb.arrayOffset(); |
|
928 |
}}); |
|
929 |
||
930 |
if (rb.hasArray()) |
|
931 |
fail("Read-only heap buffer's backing array is accessible", |
|
932 |
rb); |
|
933 |
||
934 |
} |
|
935 |
||
936 |
// Bulk puts from read-only buffers |
|
937 |
||
938 |
b.clear(); |
|
939 |
rb.rewind(); |
|
940 |
b.put(rb); |
|
941 |
||
942 |
||
943 |
||
944 |
||
945 |
||
946 |
||
947 |
||
948 |
||
949 |
||
950 |
||
951 |
||
952 |
relPut(b); // Required by testViews |
|
953 |
||
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
954 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
955 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
956 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
957 |
|
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
31873
diff
changeset
|
958 |
|
2 | 959 |
} |
960 |
||
961 |
||
962 |
||
963 |
||
964 |
||
965 |
||
966 |
||
967 |
||
968 |
||
969 |
||
970 |
||
971 |
||
972 |
||
973 |
||
974 |
||
975 |
||
976 |
||
977 |
||
978 |
||
979 |
||
980 |
||
981 |
||
982 |
||
983 |
||
984 |
||
985 |
||
986 |
||
987 |
||
988 |
||
989 |
||
990 |
||
991 |
||
992 |
||
993 |
||
994 |
||
995 |
||
996 |
||
997 |
||
998 |
||
999 |
||
1000 |
||
1001 |
||
1002 |
||
1003 |
||
1004 |
||
1005 |
||
1006 |
||
1007 |
||
1008 |
||
1009 |
||
1010 |
||
1011 |
||
1012 |
||
1013 |
||
1014 |
||
1015 |
||
1016 |
||
1017 |
||
1018 |
||
1019 |
||
1020 |
||
1021 |
||
1022 |
||
1023 |
||
1024 |
||
1025 |
||
1026 |
||
1027 |
||
1028 |
||
1029 |
||
1030 |
||
1031 |
||
1032 |
||
1033 |
||
1034 |
||
1035 |
||
1036 |
||
1037 |
||
1038 |
||
1039 |
||
1040 |
||
1041 |
||
1042 |
||
2593
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1639
diff
changeset
|
1043 |
|
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1639
diff
changeset
|
1044 |
|
2 | 1045 |
public static void test(final long [] ba) { |
1046 |
int offset = 47; |
|
1047 |
int length = 900; |
|
1048 |
final LongBuffer b = LongBuffer.wrap(ba, offset, length); |
|
1049 |
show(0, b); |
|
1050 |
ck(b, b.capacity(), ba.length); |
|
1051 |
ck(b, b.position(), offset); |
|
1052 |
ck(b, b.limit(), offset + length); |
|
1053 |
||
1054 |
// The offset must be non-negative and no larger than <array.length>. |
|
1055 |
tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() { |
|
1056 |
public void run() { |
|
1057 |
LongBuffer.wrap(ba, -1, ba.length); |
|
1058 |
}}); |
|
1059 |
tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() { |
|
1060 |
public void run() { |
|
1061 |
LongBuffer.wrap(ba, ba.length + 1, ba.length); |
|
1062 |
}}); |
|
1063 |
tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() { |
|
1064 |
public void run() { |
|
1065 |
LongBuffer.wrap(ba, 0, -1); |
|
1066 |
}}); |
|
1067 |
tryCatch(ba, IndexOutOfBoundsException.class, new Runnable() { |
|
1068 |
public void run() { |
|
1069 |
LongBuffer.wrap(ba, 0, ba.length + 1); |
|
1070 |
}}); |
|
1071 |
||
1072 |
// A NullPointerException will be thrown if the array is null. |
|
1073 |
tryCatch(ba, NullPointerException.class, new Runnable() { |
|
1074 |
public void run() { |
|
1075 |
LongBuffer.wrap((long []) null, 0, 5); |
|
1076 |
}}); |
|
1077 |
tryCatch(ba, NullPointerException.class, new Runnable() { |
|
1078 |
public void run() { |
|
1079 |
LongBuffer.wrap((long []) null); |
|
1080 |
}}); |
|
1081 |
} |
|
1082 |
||
1083 |
private static void testAllocate() { |
|
1084 |
// An IllegalArgumentException will be thrown for negative capacities. |
|
1085 |
tryCatch((Buffer) null, IllegalArgumentException.class, new Runnable() { |
|
1086 |
public void run() { |
|
1087 |
LongBuffer.allocate(-1); |
|
1088 |
}}); |
|
31873
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1089 |
try { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1090 |
LongBuffer.allocate(-1); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1091 |
} catch (IllegalArgumentException e) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1092 |
if (e.getMessage() == null) { |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1093 |
fail("Non-null IllegalArgumentException message expected for" |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1094 |
+ " attempt to allocate negative capacity buffer"); |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1095 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1096 |
} |
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1097 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1098 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1099 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1100 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1101 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1102 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1103 |
|
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
14342
diff
changeset
|
1104 |
|
2 | 1105 |
|
1106 |
||
1107 |
||
1108 |
||
1109 |
||
1110 |
||
1111 |
} |
|
1112 |
||
1113 |
public static void test() { |
|
1114 |
testAllocate(); |
|
1115 |
test(0, LongBuffer.allocate(7 * 1024), false); |
|
1116 |
test(0, LongBuffer.wrap(new long[7 * 1024], 0, 7 * 1024), false); |
|
1117 |
test(new long[1024]); |
|
1118 |
||
1119 |
||
1120 |
||
1121 |
||
1122 |
||
1123 |
||
1124 |
||
1125 |
||
1126 |
||
1127 |
||
1128 |
callReset(LongBuffer.allocate(10)); |
|
1129 |
||
1130 |
||
1131 |
||
1132 |
putBuffer(); |
|
1133 |
||
1134 |
} |
|
1135 |
||
1136 |
} |