diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/src/org/aspectj/util/FileUtil.java | 26 | ||||
-rw-r--r-- | util/src/org/aspectj/util/LangUtil.java | 22 |
2 files changed, 34 insertions, 14 deletions
diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java index ccf54831f..8745750c5 100644 --- a/util/src/org/aspectj/util/FileUtil.java +++ b/util/src/org/aspectj/util/FileUtil.java @@ -64,6 +64,11 @@ public class FileUtil { && file.getName().toLowerCase().endsWith(".class")))); } }; + private static final boolean PERMIT_CVS; + static { + String name = FileUtil.class.getName() + ".PERMIT_CVS"; + PERMIT_CVS = LangUtil.getBoolean(name, false); + } /** @return true if file path has a zip/jar suffix */ public static boolean hasZipSuffix(File file) { @@ -1216,24 +1221,19 @@ public class FileUtil { return LangUtil.sleepUntil(++delayUntil); } -// /** map name to result, removing any fromSuffix and adding any toSuffix */ -// private static String map(String name, String fromSuffix, String toSuffix) { -// if (null != name) { -// if (null != fromSuffix) { -// name = name.substring(0, name.length()-fromSuffix.length()); -// } -// if (null != toSuffix) { -// name = name + toSuffix; -// } -// } -// return name; -// } - private static void listFiles(final File baseDir, ArrayList result, FileFilter filter) { File[] files = baseDir.listFiles(); + // hack https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650 + final boolean skipCVS = (! PERMIT_CVS && (filter == aspectjSourceFileFilter)); for (int i = 0; i < files.length; i++) { File f = files[i]; if (f.isDirectory()) { + if (skipCVS) { + String name = f.getName().toLowerCase(); + if ("cvs".equals(name) || "sccs".equals(name)) { + continue; + } + } listFiles(f, result, filter); } else { if (filter.accept(f)) result.add(f); diff --git a/util/src/org/aspectj/util/LangUtil.java b/util/src/org/aspectj/util/LangUtil.java index dacce5408..ce339e0a1 100644 --- a/util/src/org/aspectj/util/LangUtil.java +++ b/util/src/org/aspectj/util/LangUtil.java @@ -62,6 +62,7 @@ public class LangUtil { map.put("1.2", "java.lang.ref.Reference"); map.put("1.3", "java.lang.reflect.Proxy"); map.put("1.4", "java.nio.Buffer"); + map.put("1.5", "java.lang.annotation.Annotation"); VM_CLASSES = Collections.unmodifiableMap(map); } @@ -218,7 +219,26 @@ public class LangUtil { } return (String[]) result.toArray(new String[0]); } - + + /** + * Get System property as boolean, + * but use default value where the system property is not set. + * @return true if value is set to true, false otherwise + */ + public static boolean getBoolean(String propertyName, boolean defaultValue) { + if (null != propertyName) { + try { + String value = System.getProperty(propertyName); + if (null != value) { + return Boolean.valueOf(value).booleanValue(); + } + } catch (Throwable t) { + // default below + } + } + return defaultValue; + } + /** * Splits <code>input</code>, removing delimiter and * trimming any white space. |