aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2017-11-15 03:05:05 +0900
committerchibash <chiba@javassist.org>2017-11-15 03:05:05 +0900
commitb86c14888230d12d3844a469e3b34be11dbf4053 (patch)
tree29150acb663add9381ec1b21fc20a86085b85266
parentb7e59d4dc0222d34732c8efd87872b562501e14b (diff)
downloadjavassist-b86c14888230d12d3844a469e3b34be11dbf4053.tar.gz
javassist-b86c14888230d12d3844a469e3b34be11dbf4053.zip
changes getDefinedPackage back to getPackage when Java is < 9.
-rw-r--r--build.xml4
-rw-r--r--javassist.jarbin740722 -> 759198 bytes
-rw-r--r--src/main/javassist/Loader.java11
3 files changed, 13 insertions, 2 deletions
diff --git a/build.xml b/build.xml
index 38a2cc8d..5273c494 100644
--- a/build.xml
+++ b/build.xml
@@ -32,6 +32,7 @@
<path id="test.compile.classpath">
<pathelement location="${build.classes.dir}"/>
<pathelement location="${lib.dir}/junit.jar"/>
+ <pathelement location="${lib.dir}/hamcrest.jar"/>
</path>
<property name="test.compile.classpath" refid="test.compile.classpath"/>
@@ -39,7 +40,8 @@
<path id="test.classpath">
<pathelement location="${test.build.dir}"/>
<pathelement location="${lib.dir}/junit.jar"/>
- <pathelement location="${build.classes.dir}"/>
+ <pathelement location="${lib.dir}/hamcrest.jar"/>
+ <pathelement location="${build.classes.dir}"/>
</path>
<property name="test.classpath" refid="test.classpath"/>
diff --git a/javassist.jar b/javassist.jar
index 78328e63..823d1cc9 100644
--- a/javassist.jar
+++ b/javassist.jar
Binary files differ
diff --git a/src/main/javassist/Loader.java b/src/main/javassist/Loader.java
index cbbf09e5..8eb067c4 100644
--- a/src/main/javassist/Loader.java
+++ b/src/main/javassist/Loader.java
@@ -23,6 +23,8 @@ import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
+import javassist.bytecode.ClassFile;
+
/**
* The class loader for Javassist.
*
@@ -360,7 +362,7 @@ public class Loader extends ClassLoader {
int i = name.lastIndexOf('.');
if (i != -1) {
String pname = name.substring(0, i);
- if (getDefinedPackage(pname) == null)
+ if (isDefinedPackage(pname))
try {
definePackage(
pname, null, null, null, null, null, null, null);
@@ -376,6 +378,13 @@ public class Loader extends ClassLoader {
return defineClass(name, classfile, 0, classfile.length, domain);
}
+ private boolean isDefinedPackage(String name) {
+ if (ClassFile.MAJOR_VERSION >= ClassFile.JAVA_9)
+ return getDefinedPackage(name) == null;
+ else
+ return getPackage(name) == null;
+ }
+
protected Class<?> loadClassByDelegation(String name)
throws ClassNotFoundException
{