Generating a library script that does not export a single class is probably a bit silly. Throw an exception.
1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Wed Nov 26 16:44:12 2014 +0100
1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Thu Nov 27 20:23:35 2014 +0100
1.3 @@ -35,6 +35,7 @@
1.4 private final ExportedSymbols exportedSymbols;
1.5 private final StringArray invokerMethods;
1.6 private final StringArray asBinary;
1.7 + int exportedCount;
1.8
1.9 private VM(
1.10 Appendable out, Bck2Brwsr.Resources resources,
1.11 @@ -160,6 +161,7 @@
1.12 .append("'] = ")
1.13 .append(accessClass(mangledName))
1.14 .append(";\n");
1.15 + exportedCount++;
1.16 }
1.17 }
1.18
1.19 @@ -721,7 +723,7 @@
1.20 private Extension(Appendable out, Bck2Brwsr.Resources resources,
1.21 String[] extClassesArray, StringArray explicitlyExported,
1.22 StringArray asBinary, StringArray classpath
1.23 - ) {
1.24 + ) throws IOException {
1.25 super(out, resources, explicitlyExported, asBinary);
1.26 this.extensionClasses = StringArray.asList(extClassesArray);
1.27 this.classpath = classpath;
1.28 @@ -766,6 +768,9 @@
1.29 @Override
1.30 protected void generateEpilogue() throws IOException {
1.31 append("});");
1.32 + if (exportedCount == 0) {
1.33 + throw new IOException("Creating library without any exported symbols is useless!");
1.34 + }
1.35 }
1.36
1.37 @Override