diff options
author | Andy Clement <aclement@pivotal.io> | 2020-04-20 16:24:02 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2020-04-20 16:24:02 -0700 |
commit | 4471ba76ac755b504d99e514a1cf5a375e7d02d1 (patch) | |
tree | 5f8d4f4dfb79d72f6c344294a319b0b04b01e2ae /bcel-builder/src/main/java | |
parent | 17026e35243f229c2e3c07c292f2caaac65503a4 (diff) | |
download | aspectj-4471ba76ac755b504d99e514a1cf5a375e7d02d1.tar.gz aspectj-4471ba76ac755b504d99e514a1cf5a375e7d02d1.zip |
Include JDTCore for Java14
Diffstat (limited to 'bcel-builder/src/main/java')
-rw-r--r-- | bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java | 18 | ||||
-rw-r--r-- | bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java | 51 |
2 files changed, 36 insertions, 33 deletions
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java index f80cc0f82..03fda5d89 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java @@ -90,6 +90,8 @@ public interface Constants { public final static short MINOR_12 = 0; public final static short MAJOR_13 = 57; public final static short MINOR_13 = 0; + public final static short MAJOR_14 = 58; + public final static short MINOR_14 = 0; public final static int PREVIEW_MINOR_VERSION = 65535; @@ -666,13 +668,13 @@ public interface Constants { public static final short KNOWN_ATTRIBUTES = 28; public static final String[] ATTRIBUTE_NAMES = { - "SourceFile", "ConstantValue", "Code", "Exceptions", "LineNumberTable", "LocalVariableTable", - "InnerClasses", "Synthetic", "Deprecated", "PMGClass", "Signature", "StackMap", - "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations", "RuntimeVisibleParameterAnnotations", - "RuntimeInvisibleParameterAnnotations", "LocalVariableTypeTable", "EnclosingMethod", - "AnnotationDefault","BootstrapMethods", "RuntimeVisibleTypeAnnotations", "RuntimeInvisibleTypeAnnotations", - "MethodParameters", "Module", "ModulePackages", "ModuleMainClass", "NestHost", "NestMembers" - }; + "SourceFile", "ConstantValue", "Code", "Exceptions", "LineNumberTable", "LocalVariableTable", + "InnerClasses", "Synthetic", "Deprecated", "PMGClass", "Signature", "StackMap", + "RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations", "RuntimeVisibleParameterAnnotations", + "RuntimeInvisibleParameterAnnotations", "LocalVariableTypeTable", "EnclosingMethod", + "AnnotationDefault","BootstrapMethods", "RuntimeVisibleTypeAnnotations", "RuntimeInvisibleTypeAnnotations", + "MethodParameters", "Module", "ModulePackages", "ModuleMainClass", "NestHost", "NestMembers" + }; /** * Constants used in the StackMap attribute. @@ -688,5 +690,5 @@ public interface Constants { public static final byte ITEM_NewObject = 8; public static final String[] ITEM_NAMES = { "Bogus", "Integer", "Float", "Double", "Long", "Null", "InitObject", "Object", - "NewObject" }; + "NewObject" }; } diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java index 2797df3cc..95552dd6a 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java @@ -201,8 +201,8 @@ public class ClassPath implements Serializable { ArrayList<String> dirs = new ArrayList<String>(); getPathComponents(ext_path, dirs); - for (Iterator<String> e = dirs.iterator(); e.hasNext();) { - File ext_dir = new File(e.next()); + for (String string : dirs) { + File ext_dir = new File(string); String[] extensions = ext_dir.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { @@ -212,8 +212,8 @@ public class ClassPath implements Serializable { }); if (extensions != null) - for (int i = 0; i < extensions.length; i++) - list.add(ext_dir.toString() + File.separatorChar + extensions[i]); + for (String extension : extensions) + list.add(ext_dir.toString() + File.separatorChar + extension); } StringBuffer buf = new StringBuffer(); @@ -226,13 +226,14 @@ public class ClassPath implements Serializable { } // On Java9 the sun.boot.class.path won't be set. System classes accessible through JRT filesystem - if (vm_version.startsWith("9") || vm_version.startsWith("10") - || vm_version.startsWith("11") - || vm_version.startsWith("12") - || vm_version.startsWith("13")) { - buf.insert(0, File.pathSeparatorChar); - buf.insert(0, System.getProperty("java.home") + File.separator + "lib" + File.separator + JRT_FS); - } + if (vm_version.startsWith("9") || vm_version.startsWith("10") + || vm_version.startsWith("11") + || vm_version.startsWith("12") + || vm_version.startsWith("13") + || vm_version.startsWith("14")) { + buf.insert(0, File.pathSeparatorChar); + buf.insert(0, System.getProperty("java.home") + File.separator + "lib" + File.separator + JRT_FS); + } return buf.toString().intern(); } @@ -277,10 +278,10 @@ public class ClassPath implements Serializable { * @return class file for the java class */ public ClassFile getClassFile(String name, String suffix) throws IOException { - for (int i = 0; i < paths.length; i++) { + for (PathEntry path : paths) { ClassFile cf; - if ((cf = paths[i].getClassFile(name, suffix)) != null) + if ((cf = path.getClassFile(name, suffix)) != null) return cf; } @@ -460,24 +461,24 @@ public class ClassPath implements Serializable { for (java.nio.file.Path path : roots) { try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - if (file.getNameCount() > 2 - && matcher.matches(file.getFileName())) { - Path classPath = file.subpath(2, file.getNameCount()); - fileMap.put(classPath.toString(), file); - } - - return FileVisitResult.CONTINUE; - } - }); + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.getNameCount() > 2 + && matcher.matches(file.getFileName())) { + Path classPath = file.subpath(2, file.getNameCount()); + fileMap.put(classPath.toString(), file); + } + + return FileVisitResult.CONTINUE; + } + }); } catch (IOException e) { throw new RuntimeException(e); } } return fileMap; - } + } private static class ByteBasedClassFile implements ClassFile { |