Skip to content

Commit

Permalink
modifies a test case. Now all the test cases run successfully with Ja…
Browse files Browse the repository at this point in the history
…va 9 EA.
  • Loading branch information
chibash committed Jul 31, 2016
1 parent 8b4d1e6 commit 4ed22b0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
23 changes: 17 additions & 6 deletions src/main/javassist/ClassPoolTail.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@

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;
Expand Down Expand Up @@ -234,9 +240,14 @@ public synchronized void removeClassPath(ClassPath cp) {
}

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)
Expand Down
11 changes: 9 additions & 2 deletions src/test/javassist/JvstTest4.java
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,17 @@ public void testAnnotationWithGenerics() throws Exception {
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 {
Expand Down

0 comments on commit 4ed22b0

Please sign in to comment.