Work around a art test script bug mixing up bootclasspaths.
art/test/testrunner/run_build_test_target.py -j40 art-interpreter
compiles tests against the default toolchain (eg. OpenJDK) core
libraries but runs them against libcore.
This is a bug because the default toolchain API may differ from
libcore's; specifically, before this CL, 070-nio-buffer breaks
when the default toolchain is OpenJDK 9.
This CL works around that bug specifically by avoiding use of
OpenJDK9 covariant overrides that aren't in libcore.
For example, IntBuffer#clear->IntBuffer does not exist (but
Buffer#clear->Buffer does).
After this CL, 070-nio-buffer passes when run under OpenJDK 9.
This CL can be reverted when the test runner scripts are fixed
in a future CL.
Bug: 70521453
Test: export EXPERIMENTAL_USE_OPENJDK9=1.8 && \
art/test/testrunner/run_build_test_target.py -j40 art-interpreter
Test: export EXPERIMENTAL_USE_OPENJDK9=false && \
art/test/testrunner/run_build_test_target.py -j40 art-interpreter
Change-Id: I463716906f48d1ecf6b9892f2d793dd75f2619eb
diff --git a/test/070-nio-buffer/src/Main.java b/test/070-nio-buffer/src/Main.java
index a3eeb3f..86eb553 100644
--- a/test/070-nio-buffer/src/Main.java
+++ b/test/070-nio-buffer/src/Main.java
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import java.nio.Buffer;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -50,9 +51,9 @@
1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031
};
- shortBuf.position(0);
+ ((Buffer) shortBuf).position(0);
shortBuf.put(myShorts, 0, 32); // should work
- shortBuf.position(0);
+ ((Buffer) shortBuf).position(0);
shortBuf.put(myShorts, 16, 16); // should work
shortBuf.put(myShorts, 16, 16); // advance to end
@@ -64,7 +65,7 @@
}
try {
- shortBuf.position(0);
+ ((Buffer) shortBuf).position(0);
shortBuf.put(myShorts, 0, 33); // should fail
System.out.println("ERROR: out-of-bounds put succeeded\n");
} catch (IndexOutOfBoundsException ioobe) {
@@ -72,7 +73,7 @@
}
try {
- shortBuf.position(16);
+ ((Buffer) shortBuf).position(16);
shortBuf.put(myShorts, 0, 17); // should fail
System.out.println("ERROR: out-of-bounds put succeeded\n");
} catch (BufferOverflowException boe) {
@@ -93,13 +94,13 @@
int data[] = new int[25];
//FloatBuffer int1 = direct.asFloatBuffer();
//float data[] = new float[25];
- int1.clear ();
- int1.put (data);
- int1.position (0);
+ ((Buffer) int1).clear();
+ int1.put(data);
+ ((Buffer) int1).position(0);
- int1.clear ();
+ ((Buffer) int1).clear();
int1.put (data);
- int1.position (0);
+ ((Buffer) int1).position(0);
}
/*
@@ -119,7 +120,7 @@
}
static void storeValues(ByteBuffer directBuf) {
- directBuf.position(0);
+ ((Buffer) directBuf).position(0);
ShortBuffer shortBuf = directBuf.asShortBuffer();
CharBuffer charBuf = directBuf.asCharBuffer();
IntBuffer intBuf = directBuf.asIntBuffer();
@@ -157,7 +158,7 @@
throw new RuntimeException("double get/store failed");
}
- directBuf.position(0);
+ ((Buffer) directBuf).position(0);
char[] outBuf = new char[directBuf.limit() * 2];
for (int i = 0; i < directBuf.limit(); i++) {
byte b = directBuf.get();