Remove partial exports, broken in new compiler

The old compiler would let us export a static method on a class
without exporting the whole class and its constructor.  The new
compiler silently ignores `@export` for any methods of a non-exported
class.

This means that for the latest Closure Compiler, we must export any
class with exported static methods.  In some cases, these are
non-utility classes with constructors we'd rather not export, but the
constructor is implicitly exported by exporting the class itself.

This was initially caught by the integration tests.  The error wasn't
especially helpful, so I added a try/catch to loadShaka that makes the
error more apparent:
  TypeError: Cannot read property 'registerParserByMime' of undefined

To make sure we do not make this mistake again, I've added a check to
the extern generator, which was already able to detect these types of
classes.  I don't know a compiler-based way to do it, since the
compiler silently ignores the export annotations in these cases.

Issue #2528

Change-Id: I797c75a8098b0bb3cf837588569f878253dec2cf
This commit is contained in:
Joey Parrish
2020-04-29 17:20:50 -07:00
parent 286ff17361
commit a65ef9983b
7 changed files with 57 additions and 10 deletions
+2 -1
View File
@@ -11,9 +11,10 @@ goog.require('shaka.util.Iterables');
goog.require('shaka.util.StringUtils');
// TODO: revisit this when Closure Compiler supports partially-exported classes.
/**
* @summary A set of Uint8Array utility functions.
* @exportDoc
* @export
*/
shaka.util.Uint8ArrayUtils = class {
/**