diff options
author | Tobias Thierer <tobiast@google.com> | 2017-11-01 14:35:40 +0000 |
---|---|---|
committer | Tobias Thierer <tobiast@google.com> | 2017-11-08 18:20:43 +0000 |
commit | d430cc782689a7f6a256ef6b0ebfc7210b0c31d9 (patch) | |
tree | 54d448c2374de5dfb162458bd961cc85251fd05a /json | |
parent | 1d26864a6bcd6b810f4fbde934dd19664d357514 (diff) |
Move libcore tests to non-libcore packages.
The integration of OpenJDK 9 javac into the Android build system
requires non-libcore code to live in non-libcore packages, as
long as that code isn't considered part of the same module as
libcore at javac time.
This CL moves libcore test related classes out of such
packages; since libcore tests could already only test
public (as opposed to package private APIs), no change
other than the package name and imports is necessary.
Because many libcore tests already live below a top-level
package "libcore" (eg., the tests for java.util are in
libcore.java.util), this CL likewise prepends "libcore."
to the package names of affected classes. For classes
relating to libcore.* packages, this results in a package
name of the form "libcore.libcore.*".
Alternative considered but not pursued:
To compile the test classes without moving the out of a libcore
package, javac would need to consider them to be in the same
module as libcore. This would likely be possible via
javac --patch-module, but this has not been explored in detail
because:
- Most luni tests are already in a toplevel package libcore.*,
so this CL makes the test structure more consistent.
- Use of --patch-module would likely cause problems when running
tests under a runtime that implements the OpenJDK 9 module
system; for example, --patch-module cannot add exported
packages to the module, so any new packages added in tests
(such as the libcore.* packages of most existing luni tests)
would not be visible at test runtime.
- Having tests in different packages from code under tests makes
it more obvious (including to IDEs in which the code might be
edited as a single project) that these tests cannot access
package-private identifiers in the code under test.
Test: Treehugger
Test: "make cts" with EXPERIMENTAL_USE_OPENJDK9=true
passes with additional changes present locally
that have not yet been exported as CLs.
Test: CtsLibcoreTestCases
Bug: 68224249
Bug: 68932217 (tracks potential follow-up work)
Change-Id: Ib6b8e6f3bc87093bc219d2108e601163c6e334cd
Diffstat (limited to 'json')
-rw-r--r-- | json/src/test/java/libcore/org/json/JSONArrayTest.java (renamed from json/src/test/java/org/json/JSONArrayTest.java) | 7 | ||||
-rw-r--r-- | json/src/test/java/libcore/org/json/JSONObjectTest.java (renamed from json/src/test/java/org/json/JSONObjectTest.java) | 7 | ||||
-rw-r--r-- | json/src/test/java/libcore/org/json/JSONStringerTest.java (renamed from json/src/test/java/org/json/JSONStringerTest.java) | 7 | ||||
-rw-r--r-- | json/src/test/java/libcore/org/json/JSONTokenerTest.java (renamed from json/src/test/java/org/json/JSONTokenerTest.java) | 6 | ||||
-rw-r--r-- | json/src/test/java/libcore/org/json/ParsingTest.java (renamed from json/src/test/java/org/json/ParsingTest.java) | 7 | ||||
-rw-r--r-- | json/src/test/java/libcore/org/json/SelfUseTest.java (renamed from json/src/test/java/org/json/SelfUseTest.java) | 7 |
6 files changed, 35 insertions, 6 deletions
diff --git a/json/src/test/java/org/json/JSONArrayTest.java b/json/src/test/java/libcore/org/json/JSONArrayTest.java index 4c86b8ad13..c88108f9ae 100644 --- a/json/src/test/java/org/json/JSONArrayTest.java +++ b/json/src/test/java/libcore/org/json/JSONArrayTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.json; +package libcore.org.json; import java.util.Arrays; import java.util.Collection; @@ -22,6 +22,11 @@ import java.util.Collections; import java.util.List; import junit.framework.TestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; + /** * This black box test was written without inspecting the non-free org.json sourcecode. */ diff --git a/json/src/test/java/org/json/JSONObjectTest.java b/json/src/test/java/libcore/org/json/JSONObjectTest.java index 07d1cf6439..9dd1852869 100644 --- a/json/src/test/java/org/json/JSONObjectTest.java +++ b/json/src/test/java/libcore/org/json/JSONObjectTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.json; +package libcore.org.json; import java.math.BigDecimal; import java.math.BigInteger; @@ -32,6 +32,11 @@ import java.util.Set; import java.util.TreeMap; import junit.framework.TestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; + /** * This black box test was written without inspecting the non-free org.json sourcecode. */ diff --git a/json/src/test/java/org/json/JSONStringerTest.java b/json/src/test/java/libcore/org/json/JSONStringerTest.java index 1e4e0ecde0..39a9c81baa 100644 --- a/json/src/test/java/org/json/JSONStringerTest.java +++ b/json/src/test/java/libcore/org/json/JSONStringerTest.java @@ -14,10 +14,15 @@ * limitations under the License. */ -package org.json; +package libcore.org.json; import junit.framework.TestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONStringer; + /** * This black box test was written without inspecting the non-free org.json sourcecode. */ diff --git a/json/src/test/java/org/json/JSONTokenerTest.java b/json/src/test/java/libcore/org/json/JSONTokenerTest.java index 1152e465e5..4f4141519a 100644 --- a/json/src/test/java/org/json/JSONTokenerTest.java +++ b/json/src/test/java/libcore/org/json/JSONTokenerTest.java @@ -14,11 +14,15 @@ * limitations under the License. */ -package org.json; +package libcore.org.json; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONTokener; + /** * This black box test was written without inspecting the non-free org.json sourcecode. */ diff --git a/json/src/test/java/org/json/ParsingTest.java b/json/src/test/java/libcore/org/json/ParsingTest.java index 641f5b9828..b34dee9774 100644 --- a/json/src/test/java/org/json/ParsingTest.java +++ b/json/src/test/java/libcore/org/json/ParsingTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.json; +package libcore.org.json; import java.util.ArrayList; import java.util.Arrays; @@ -24,6 +24,11 @@ import java.util.List; import java.util.Map; import junit.framework.TestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; + public class ParsingTest extends TestCase { public void testParsingNoObjects() { diff --git a/json/src/test/java/org/json/SelfUseTest.java b/json/src/test/java/libcore/org/json/SelfUseTest.java index 15a082414c..923a5adc57 100644 --- a/json/src/test/java/org/json/SelfUseTest.java +++ b/json/src/test/java/libcore/org/json/SelfUseTest.java @@ -14,10 +14,15 @@ * limitations under the License. */ -package org.json; +package libcore.org.json; import junit.framework.TestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; + /** * These tests checks self use calls. For the most part we doesn't attempt to * cover self-use, except in those cases where our clean room implementation |