Skip to content

Commit

Permalink
Rework the backing machinery for System.getProperty to utilize our ow…
Browse files Browse the repository at this point in the history
…n registry

The existing system is brittle properties are read as global symbols when
uncompiled, but as `goog.define` flags when compiled. This is error-prone and
there's no clear linkage between the two.

To replace it, system properties now need to be explicitly registered. For now
we'll only be supporting registering properties that come from a `goog.define`
flag.

For backwards compatibility we'll fallback to `goog.getObjectByName` if a
property is not registered, but we will make this an error in the future.

PiperOrigin-RevId: 689188398
  • Loading branch information
kevinoconnor7 authored and copybara-github committed Oct 24, 2024
1 parent 856a532 commit 92d499b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions java/jsinterop/base/jsinterop.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
*/

goog.provide('jsinterop');
goog.require('jre');

// Note that disabling checking only disables it for production.

/** @define {string} */
jsinterop.checks = goog.define('jsinterop.checks', 'DISABLED');
jre.addSystemPropertyFromGoogDefine('jsinterop.checks', jsinterop.checks);

0 comments on commit 92d499b

Please sign in to comment.