aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2015-08-01 08:32:08 -0700
committerAndy Clement <aclement@pivotal.io>2015-08-01 08:32:08 -0700
commitcfe754597f1d872497a84ef9a14200936f858e57 (patch)
tree663ee2a9b2f141f9ebcf9fc46fd813e1ecc18d34 /weaver
parentc4d7b61ef3f9e5b54f3216b049a106f2523a60a4 (diff)
downloadaspectj-cfe754597f1d872497a84ef9a14200936f858e57.tar.gz
aspectj-cfe754597f1d872497a84ef9a14200936f858e57.zip
Cope with Java9 b74 changes
The jimage file format changed slightly, introducing an extra level of nesting. These changes support that new structure (b74).
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java24
-rw-r--r--weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java2
2 files changed, 17 insertions, 9 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
index 8d9bed883..9c2af9137 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
+++ b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
@@ -20,11 +20,15 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.DirectoryStream;
+import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.FileVisitor;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
+import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
@@ -79,6 +83,7 @@ public class ClassPathManager {
private static URI JRT_URI = URI.create("jrt:/"); //$NON-NLS-1$
+ private static String MODULES_PATH = "modules"; //$NON-NLS-1$
private static String JAVA_BASE_PATH = "java.base"; //$NON-NLS-1$
public void addPath(String name, IMessageHandler handler) {
@@ -330,7 +335,8 @@ public class ClassPathManager {
public ClassFile find(String name) throws IOException {
String fileName = name.replace('.', '/') + ".class";
try {
- Path p = fs.getPath(JAVA_BASE_PATH,fileName);
+ // /modules/java.base/java/lang/Object.class (jdk9 b74)
+ Path p = fs.getPath(MODULES_PATH,JAVA_BASE_PATH,fileName);
byte[] bs = Files.readAllBytes(p);
return new ByteBasedClassFile(bs, fileName);
} catch (NoSuchFileException nsfe) {
@@ -340,12 +346,16 @@ public class ClassPathManager {
DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(path);
try {
for (java.nio.file.Path module: stream) {
- try {
- Path p = fs.getPath(module.toString(),fileName);
- byte[] bs = Files.readAllBytes(p);
- return new ByteBasedClassFile(bs, fileName);
- } catch (NoSuchFileException nsfe2) {
- }
+ // module will be something like /packages or /modules
+ for (java.nio.file.Path submodule: Files.newDirectoryStream(module)) {
+ // submodule will be /modules/java.base or somesuch
+ try {
+ Path p = fs.getPath(submodule.toString(), fileName);
+ byte[] bs = Files.readAllBytes(p);
+ return new ByteBasedClassFile(bs, fileName);
+ } catch (NoSuchFileException nsfe2) {
+ }
+ }
}
} finally {
stream.close();
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java
index 111d7e54d..4ac46ad33 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java
@@ -13,8 +13,6 @@
package org.aspectj.weaver.bcel;
import java.lang.reflect.Modifier;
-import java.util.Objects;
-import java.util.function.Consumer;
import org.aspectj.weaver.Advice;
import org.aspectj.weaver.BcweaverTests;