Need to skip URI and System references, as they are not part of minimal API profile
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 05 Oct 2013 07:23:48 +0200
changeset 1344bb1e59f5cff3
parent 1343 802e5d2da9f6
child 1345 0546c3f2a96a
Need to skip URI and System references, as they are not part of minimal API profile
rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java
rt/vm/src/test/java/org/apidesign/vm4brwsr/TestVM.java
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java	Fri Oct 04 15:02:17 2013 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java	Sat Oct 05 07:23:48 2013 +0200
     1.3 @@ -61,11 +61,15 @@
     1.4          out.append("(function VM(global) {var fillInVMSkeleton = function(vm) {");
     1.5          StringArray processed = new StringArray();
     1.6          StringArray initCode = new StringArray();
     1.7 +        StringArray skipClass = new StringArray();
     1.8          for (String baseClass : names.toArray()) {
     1.9              references.add(baseClass);
    1.10              for (;;) {
    1.11                  String name = null;
    1.12                  for (String n : references.toArray()) {
    1.13 +                    if (skipClass.contains(n)) {
    1.14 +                        continue;
    1.15 +                    }
    1.16                      if (processed.contains(n)) {
    1.17                          continue;
    1.18                      }
    1.19 @@ -76,7 +80,8 @@
    1.20                  }
    1.21                  InputStream is = loadClass(l, name);
    1.22                  if (is == null) {
    1.23 -                    throw new IOException("Can't find class " + name); 
    1.24 +                    skipClass.add(name);
    1.25 +                    continue;
    1.26                  }
    1.27                  try {
    1.28                      String ic = compile(is);
     2.1 --- a/rt/vm/src/test/java/org/apidesign/vm4brwsr/TestVM.java	Fri Oct 04 15:02:17 2013 +0200
     2.2 +++ b/rt/vm/src/test/java/org/apidesign/vm4brwsr/TestVM.java	Sat Oct 05 07:23:48 2013 +0200
     2.3 @@ -153,6 +153,14 @@
     2.4      private static class EmulationResources implements Bck2Brwsr.Resources {
     2.5          @Override
     2.6          public InputStream get(String name) throws IOException {
     2.7 +            if ("java/net/URI.class".equals(name)) {
     2.8 +                // skip
     2.9 +                return null;
    2.10 +            }
    2.11 +            if ("java/lang/System.class".equals(name)) {
    2.12 +                // skip
    2.13 +                return null;
    2.14 +            }
    2.15              Enumeration<URL> en = StaticMethodTest.class.getClassLoader().getResources(name);
    2.16              URL u = null;
    2.17              while (en.hasMoreElements()) {