]> source.dussan.org Git - javassist.git/commitdiff
modifies a test case. Now all the test cases run successfully with Java 9 EA.
authorchibash <chiba@javassist.org>
Sun, 31 Jul 2016 16:40:51 +0000 (01:40 +0900)
committerchibash <chiba@javassist.org>
Sun, 31 Jul 2016 16:40:51 +0000 (01:40 +0900)
src/main/javassist/ClassPoolTail.java
src/test/javassist/JvstTest4.java

index 7e62a8614f0e992560b15efebe64a99a7a707ce9..ea1483082b0f8688831e9c9e2dd32062d3ff67ba 100644 (file)
 
 package javassist;
 
-import java.io.*;
-import java.util.jar.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Hashtable;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
 
 final class ClassPathList {
     ClassPathList next;
@@ -234,9 +240,14 @@ final class ClassPoolTail {
     }
 
     public ClassPath appendSystemPath() {
-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        appendClassPath(new LoaderClassPath(cl));
-       return appendClassPath(new ModuleClassPath());
+        if (javassist.bytecode.ClassFile.MAJOR_VERSION < javassist.bytecode.ClassFile.JAVA_9) {
+            return appendClassPath(new ClassClassPath());
+        }
+        else {
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            appendClassPath(new LoaderClassPath(cl));
+            return appendClassPath(new ModuleClassPath());
+        }
     }
 
     public ClassPath insertClassPath(String pathname)
index ac4c1e3b0e8d8b79957af3b124caf0063319c1fc..c556c846d4061e731ffefdcbcab10fa5b81f8753 100644 (file)
@@ -872,10 +872,17 @@ public class JvstTest4 extends JvstTestRoot {
         CtClass cc = sloader.get("test4.JIRA181");
         CtField field = cc.getField("aField");
         String s = field.getAnnotation(test4.JIRA181.Condition.class).toString();
-        assertEquals("@test4.JIRA181$Condition(condition=test4.JIRA181<T>.B.class)", s);
+        if (ClassFile.MAJOR_VERSION < ClassFile.JAVA_9)
+            assertEquals("@test4.JIRA181$Condition(condition=test4.JIRA181<T>.B.class)", s);
+        else
+            assertEquals("@test4.JIRA181$Condition(condition=test4.JIRA181.B.class)", s);
+
         CtField field2 = cc.getField("aField2");
         String s2 = field2.getAnnotation(test4.JIRA181.Condition2.class).toString();
-        assertEquals("@test4.JIRA181$Condition2(condition=test4.JIRA181<T>.B[].class)", s2);
+        if (ClassFile.MAJOR_VERSION < ClassFile.JAVA_9)
+            assertEquals("@test4.JIRA181$Condition2(condition=test4.JIRA181<T>.B[].class)", s2);
+        else
+            assertEquals("@test4.JIRA181$Condition2(condition=test4.JIRA181.B[].class)", s2);
     }
 
     public void testJIRA195() throws Exception {