missed files
This commit is contained in:
parent
cc8831ebcf
commit
c5d5ce7fe2
|
@ -0,0 +1,14 @@
|
|||
var document = { URL: "whatever",
|
||||
write: function Document_prototype_write(x) { } };
|
||||
var id = function _id(x) { return x; };
|
||||
function Id() { this.id = id; }
|
||||
function SubId() { }; SubId.prototype = new Id();
|
||||
|
||||
if (Math.random.call(null) > 0) {
|
||||
var id1 = new Id();
|
||||
var text = id1.id.call(document, document.URL);
|
||||
} else {
|
||||
var id2 = new SubId();
|
||||
var text = id2.id("not a url");
|
||||
}
|
||||
document.write(text);
|
|
@ -0,0 +1,9 @@
|
|||
package com.ibm.wala.util.io;
|
||||
|
||||
public class JavaHome {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.err.println(System.getProperty("java.home"));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.ibm.wala.util.io;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import com.ibm.wala.util.PlatformUtil;
|
||||
import com.ibm.wala.util.Predicate;
|
||||
import com.ibm.wala.util.collections.ArrayIterator;
|
||||
import com.ibm.wala.util.collections.FilterIterator;
|
||||
import com.ibm.wala.util.collections.MapIterator;
|
||||
import com.ibm.wala.util.functions.Function;
|
||||
|
||||
public class RtJar {
|
||||
|
||||
public static JarFile getRtJar(Iterator<JarFile> x) {
|
||||
while (x.hasNext()) {
|
||||
JarFile JF = x.next();
|
||||
if (JF.getName().endsWith(File.separator + "rt.jar")) {
|
||||
return JF;
|
||||
}
|
||||
if (JF.getName().endsWith(File.separator + "core.jar")) {
|
||||
return JF;
|
||||
}
|
||||
// hack for Mac
|
||||
if (PlatformUtil.onMacOSX() && JF.getName().endsWith(File.separator + "classes.jar")) {
|
||||
return JF;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
@SuppressWarnings("resource")
|
||||
JarFile rt = getRtJar(new MapIterator<>(
|
||||
new FilterIterator<String>(
|
||||
new ArrayIterator<>(System.getProperty("sun.boot.class.path").split(File.pathSeparator)),
|
||||
new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String t) {
|
||||
return t.endsWith(".jar");
|
||||
} }),
|
||||
new Function<String,JarFile>() {
|
||||
@Override
|
||||
public JarFile apply(String object) {
|
||||
try {
|
||||
return new JarFile(object);
|
||||
} catch (IOException e) {
|
||||
assert false : e.toString();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
System.err.println(rt.getName());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue