diff options
author | chibash <chiba@javassist.org> | 2017-11-15 03:05:05 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2017-11-15 03:05:05 +0900 |
commit | b86c14888230d12d3844a469e3b34be11dbf4053 (patch) | |
tree | 29150acb663add9381ec1b21fc20a86085b85266 | |
parent | b7e59d4dc0222d34732c8efd87872b562501e14b (diff) | |
download | javassist-b86c14888230d12d3844a469e3b34be11dbf4053.tar.gz javassist-b86c14888230d12d3844a469e3b34be11dbf4053.zip |
changes getDefinedPackage back to getPackage when Java is < 9.
-rw-r--r-- | build.xml | 4 | ||||
-rw-r--r-- | javassist.jar | bin | 740722 -> 759198 bytes | |||
-rw-r--r-- | src/main/javassist/Loader.java | 11 |
3 files changed, 13 insertions, 2 deletions
@@ -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 Binary files differindex 78328e63..823d1cc9 100644 --- a/javassist.jar +++ b/javassist.jar 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 { |