From 7c2a51459ffa94ff0a0f0a1067779c9772221a97 Mon Sep 17 00:00:00 2001 From: Henri Tremblay Date: Thu, 4 Mar 2021 21:23:34 -0500 Subject: [PATCH] Move ClassDefinitionUtils and ClassUtils where they are used (close #79) --- .../objenesis/instantiator/exotic/MagicInstantiator.java | 6 +++--- .../instantiator/exotic/NewInstanceInstantiator.java | 2 +- .../objenesis/instantiator/exotic/ProxyingInstantiator.java | 6 +++--- .../instantiator/exotic}/util/ClassDefinitionUtils.java | 2 +- .../org/objenesis/instantiator/exotic}/util/ClassUtils.java | 2 +- .../instantiator/exotic}/util/DefineClassHelper.java | 3 ++- .../org/objenesis/instantiator/exotic}/ClassReader.java | 6 +++--- .../instantiator/exotic}/util/ClassDefinitionUtilsTest.java | 2 +- .../objenesis/instantiator/exotic}/util/ClassUtilsTest.java | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) rename {main/src/main/java/org/objenesis/instantiator => exotic/src/main/java/org/objenesis/instantiator/exotic}/util/ClassDefinitionUtils.java (99%) rename {main/src/main/java/org/objenesis/instantiator => exotic/src/main/java/org/objenesis/instantiator/exotic}/util/ClassUtils.java (98%) rename {main/src/main/java/org/objenesis/instantiator => exotic/src/main/java/org/objenesis/instantiator/exotic}/util/DefineClassHelper.java (98%) rename {main/src/test/java/org/objenesis => exotic/src/test/java/org/objenesis/instantiator/exotic}/ClassReader.java (98%) rename {main/src/test/java/org/objenesis/instantiator => exotic/src/test/java/org/objenesis/instantiator/exotic}/util/ClassDefinitionUtilsTest.java (95%) rename {main/src/test/java/org/objenesis/instantiator => exotic/src/test/java/org/objenesis/instantiator/exotic}/util/ClassUtilsTest.java (97%) diff --git a/exotic/src/main/java/org/objenesis/instantiator/exotic/MagicInstantiator.java b/exotic/src/main/java/org/objenesis/instantiator/exotic/MagicInstantiator.java index cf0e6607e..972c1547f 100644 --- a/exotic/src/main/java/org/objenesis/instantiator/exotic/MagicInstantiator.java +++ b/exotic/src/main/java/org/objenesis/instantiator/exotic/MagicInstantiator.java @@ -23,10 +23,10 @@ import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; -import org.objenesis.instantiator.util.ClassDefinitionUtils; -import org.objenesis.instantiator.util.ClassUtils; +import org.objenesis.instantiator.exotic.util.ClassDefinitionUtils; +import org.objenesis.instantiator.exotic.util.ClassUtils; -import static org.objenesis.instantiator.util.ClassDefinitionUtils.*; +import static org.objenesis.instantiator.exotic.util.ClassDefinitionUtils.*; /** * This instantiator will correctly bypass the constructors by instantiating the class using the default diff --git a/exotic/src/main/java/org/objenesis/instantiator/exotic/NewInstanceInstantiator.java b/exotic/src/main/java/org/objenesis/instantiator/exotic/NewInstanceInstantiator.java index 3c02b304c..464b0b680 100644 --- a/exotic/src/main/java/org/objenesis/instantiator/exotic/NewInstanceInstantiator.java +++ b/exotic/src/main/java/org/objenesis/instantiator/exotic/NewInstanceInstantiator.java @@ -18,7 +18,7 @@ import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; -import org.objenesis.instantiator.util.ClassUtils; +import org.objenesis.instantiator.exotic.util.ClassUtils; /** * The simplest instantiator - simply calls Class.newInstance(). This can deal with default public diff --git a/exotic/src/main/java/org/objenesis/instantiator/exotic/ProxyingInstantiator.java b/exotic/src/main/java/org/objenesis/instantiator/exotic/ProxyingInstantiator.java index 0c5a68202..44e78521c 100644 --- a/exotic/src/main/java/org/objenesis/instantiator/exotic/ProxyingInstantiator.java +++ b/exotic/src/main/java/org/objenesis/instantiator/exotic/ProxyingInstantiator.java @@ -23,10 +23,10 @@ import org.objenesis.instantiator.ObjectInstantiator; import org.objenesis.instantiator.annotations.Instantiator; import org.objenesis.instantiator.annotations.Typology; -import org.objenesis.instantiator.util.ClassDefinitionUtils; -import org.objenesis.instantiator.util.ClassUtils; +import org.objenesis.instantiator.exotic.util.ClassDefinitionUtils; +import org.objenesis.instantiator.exotic.util.ClassUtils; -import static org.objenesis.instantiator.util.ClassDefinitionUtils.*; +import static org.objenesis.instantiator.exotic.util.ClassDefinitionUtils.*; /** * This instantiator creates a class by dynamically extending it. It will skip the call to the parent constructor diff --git a/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java b/exotic/src/main/java/org/objenesis/instantiator/exotic/util/ClassDefinitionUtils.java similarity index 99% rename from main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java rename to exotic/src/main/java/org/objenesis/instantiator/exotic/util/ClassDefinitionUtils.java index aaee6e766..3bd4fc994 100644 --- a/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java +++ b/exotic/src/main/java/org/objenesis/instantiator/exotic/util/ClassDefinitionUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.objenesis.instantiator.util; +package org.objenesis.instantiator.exotic.util; import java.io.BufferedOutputStream; import java.io.FileOutputStream; diff --git a/main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java b/exotic/src/main/java/org/objenesis/instantiator/exotic/util/ClassUtils.java similarity index 98% rename from main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java rename to exotic/src/main/java/org/objenesis/instantiator/exotic/util/ClassUtils.java index 241b77daf..baca07f28 100644 --- a/main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java +++ b/exotic/src/main/java/org/objenesis/instantiator/exotic/util/ClassUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.objenesis.instantiator.util; +package org.objenesis.instantiator.exotic.util; import org.objenesis.ObjenesisException; diff --git a/main/src/main/java/org/objenesis/instantiator/util/DefineClassHelper.java b/exotic/src/main/java/org/objenesis/instantiator/exotic/util/DefineClassHelper.java similarity index 98% rename from main/src/main/java/org/objenesis/instantiator/util/DefineClassHelper.java rename to exotic/src/main/java/org/objenesis/instantiator/exotic/util/DefineClassHelper.java index 54de5c38d..40ecbeebd 100644 --- a/main/src/main/java/org/objenesis/instantiator/util/DefineClassHelper.java +++ b/exotic/src/main/java/org/objenesis/instantiator/exotic/util/DefineClassHelper.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.objenesis.instantiator.util; +package org.objenesis.instantiator.exotic.util; +import org.objenesis.instantiator.util.UnsafeUtils; import sun.misc.Unsafe; import org.objenesis.ObjenesisException; import org.objenesis.strategy.PlatformDescription; diff --git a/main/src/test/java/org/objenesis/ClassReader.java b/exotic/src/test/java/org/objenesis/instantiator/exotic/ClassReader.java similarity index 98% rename from main/src/test/java/org/objenesis/ClassReader.java rename to exotic/src/test/java/org/objenesis/instantiator/exotic/ClassReader.java index fbd74fe81..6a4e0ff6f 100644 --- a/main/src/test/java/org/objenesis/ClassReader.java +++ b/exotic/src/test/java/org/objenesis/instantiator/exotic/ClassReader.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.objenesis; +package org.objenesis.instantiator.exotic; -import org.objenesis.instantiator.util.ClassUtils; +import org.objenesis.instantiator.exotic.util.ClassUtils; import java.io.DataInputStream; import java.io.FileInputStream; @@ -24,7 +24,7 @@ import java.util.Arrays; import static org.junit.Assert.*; -import static org.objenesis.instantiator.util.ClassDefinitionUtils.*; +import static org.objenesis.instantiator.exotic.util.ClassDefinitionUtils.*; /** * @author Henri Tremblay diff --git a/main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java b/exotic/src/test/java/org/objenesis/instantiator/exotic/util/ClassDefinitionUtilsTest.java similarity index 95% rename from main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java rename to exotic/src/test/java/org/objenesis/instantiator/exotic/util/ClassDefinitionUtilsTest.java index aa8dfb59b..83a52a8ed 100644 --- a/main/src/test/java/org/objenesis/instantiator/util/ClassDefinitionUtilsTest.java +++ b/exotic/src/test/java/org/objenesis/instantiator/exotic/util/ClassDefinitionUtilsTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.objenesis.instantiator.util; +package org.objenesis.instantiator.exotic.util; import org.junit.Test; import org.objenesis.Objenesis; diff --git a/main/src/test/java/org/objenesis/instantiator/util/ClassUtilsTest.java b/exotic/src/test/java/org/objenesis/instantiator/exotic/util/ClassUtilsTest.java similarity index 97% rename from main/src/test/java/org/objenesis/instantiator/util/ClassUtilsTest.java rename to exotic/src/test/java/org/objenesis/instantiator/exotic/util/ClassUtilsTest.java index 9a9435974..fed3972a6 100644 --- a/main/src/test/java/org/objenesis/instantiator/util/ClassUtilsTest.java +++ b/exotic/src/test/java/org/objenesis/instantiator/exotic/util/ClassUtilsTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.objenesis.instantiator.util; +package org.objenesis.instantiator.exotic.util; import org.junit.Test; import org.objenesis.ObjenesisException;