Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine.properties does not prevent non-string values #458

Open
botic opened this issue May 17, 2022 · 1 comment
Open

engine.properties does not prevent non-string values #458

botic opened this issue May 17, 2022 · 1 comment

Comments

@botic
Copy link
Member

botic commented May 17, 2022

The following code can lead to an out-of-sync Java system properties with engine.properties:

const engine = require("ringo/engine");
engine.properties.foo = "bar";
engine.properties.foo === java.lang.System.getProperty("foo"); // true
engine.properties.foo = {};
engine.properties.foo === java.lang.System.getProperty("foo"); // false
java.lang.System.getProperty("foo") === null; // true
typeof engine.properties.foo === "object"; // true
java.lang.System.clearProperty("foo"); // throws a java.lang.ClassCastException!
@botic
Copy link
Member Author

botic commented May 17, 2022

Why are there engine.properties anyway? This looks like a relict from early times, where cleaning up wasn't a priority. Ringo has …

  1. engine.properties
  2. system.properties (see Implements system.properties, fixes #456 #457 )
  3. environment (see Deprecate non-standard environment global, introduce system.properties #456 )

Ringo 4 should address this mess. 🧹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant