{"action":"created","issue":{"url":"https://api.github.com/repos/google/j2cl/issues/1","repository_url":"https://api.github.com/repos/google/j2cl","labels_url":"https://api.github.com/repos/google/j2cl/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/google/j2cl/issues/1/comments","events_url":"https://api.github.com/repos/google/j2cl/issues/1/events","html_url":"https://github.com/google/j2cl/issues/1","id":333845691,"node_id":"MDU6SXNzdWUzMzM4NDU2OTE=","number":1,"title":"System.getProperty doesn't emit goog.require","user":{"login":"niloc132","id":241630,"node_id":"MDQ6VXNlcjI0MTYzMA==","avatar_url":"https://avatars0.githubusercontent.com/u/241630?v=4","gravatar_id":"","url":"https://api.github.com/users/niloc132","html_url":"https://github.com/niloc132","followers_url":"https://api.github.com/users/niloc132/followers","following_url":"https://api.github.com/users/niloc132/following{/other_user}","gists_url":"https://api.github.com/users/niloc132/gists{/gist_id}","starred_url":"https://api.github.com/users/niloc132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niloc132/subscriptions","organizations_url":"https://api.github.com/users/niloc132/orgs","repos_url":"https://api.github.com/users/niloc132/repos","events_url":"https://api.github.com/users/niloc132/events{/privacy}","received_events_url":"https://api.github.com/users/niloc132/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-06-19T21:28:20Z","updated_at":"2018-11-16T03:14:35Z","closed_at":null,"author_association":"NONE","body":"Observed in jsinterop-base, where jsinterop.js contains the following:\r\n```\r\n/**\r\n * This file provides the @defines for jsinterop configuration options.\r\n * See InternalPreconditions.java for details.\r\n */\r\n\r\ngoog.provide('jsinterop');\r\n\r\n// Note that disabling checking only disables it for production.\r\n\r\n/** @define {string} */\r\ngoog.define('jsinterop.checks', 'DISABLED');\r\n```\r\n\r\nThen, InternalPreconditions.java uses this:\r\n```\r\nprivate static final boolean IS_TYPE_CHECKED = \r\n                getProperty(\"jsinterop.checks\").equals(\"ENABLED\");\r\n```\r\n\r\nCurrently, System.getProperty is implemented with JsMethod for J2CL (and a magic method for gwt2):\r\n```\r\n  @JsMethod(name = \"$getDefine\", namespace = \"nativebootstrap.Util\")\r\n  public static native String getProperty(String key);\r\n```\r\n\r\nThe Util.$getDefine method only calls `goog.getObjectByName` with the parameter, not a compiletime string, and closure-compiler doesn't seem to be able to detect this anyway. \r\n\r\nThe result is a runtime NPE in both BUNDLE and ADVANCED compilation modes, unless jsinterop.js is manually added as an `--entry_point`, or a new define is added to the build directly (and in that case, `--define` isn't used by BUNDLE, by design).\r\n\r\nHistorically, it looks like J2CL used to have a pass which would examine System.getProperty calls and do something with them - perhaps the same idea could be used again to emit `goog.require` calls to correctly require that non-native.js files are loaded. \r\n\r\nThis might be worth generalizing, so that non-native.js files can be depended on in general? It would add an extra step to use a system property which isn't ideal, but does prevent the need for j2cl to recognize specific pieces of code to be transpiled.\r\n\r\nThis would also allow `jre.js` to keep working if classMetadata and checkedMode were moved - while there is a `goog.provide('jre.checks')` in that file, nothing actually ever depends on jre.checks, so could stop working if the file were split into one file per `provide`. "},"comment":{"url":"https://api.github.com/repos/google/j2cl/issues/comments/439268347","html_url":"https://github.com/google/j2cl/issues/1#issuecomment-439268347","issue_url":"https://api.github.com/repos/google/j2cl/issues/1","id":439268347,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTI2ODM0Nw==","user":{"login":"gkdn","id":4112632,"node_id":"MDQ6VXNlcjQxMTI2MzI=","avatar_url":"https://avatars1.githubusercontent.com/u/4112632?v=4","gravatar_id":"","url":"https://api.github.com/users/gkdn","html_url":"https://github.com/gkdn","followers_url":"https://api.github.com/users/gkdn/followers","following_url":"https://api.github.com/users/gkdn/following{/other_user}","gists_url":"https://api.github.com/users/gkdn/gists{/gist_id}","starred_url":"https://api.github.com/users/gkdn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkdn/subscriptions","organizations_url":"https://api.github.com/users/gkdn/orgs","repos_url":"https://api.github.com/users/gkdn/repos","events_url":"https://api.github.com/users/gkdn/events{/privacy}","received_events_url":"https://api.github.com/users/gkdn/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T03:14:35Z","updated_at":"2018-11-16T03:14:35Z","author_association":"MEMBER","body":"This doesn't need an update, could stay as a known issue."}}
{"actor":{"display_login":"gkdn"}}