Main.hx 294 B

12345678910111213141516
  1. class Main {
  2. @:readOnly
  3. public var a:Int = 10;
  4. static function main() {
  5. var m = new Main();
  6. try Reflect.setProperty(m, 'a', 999)
  7. catch(e:cs.system.MemberAccessException) {}
  8. if(m.a != 10) {
  9. throw "Main.a should not be writable via reflection";
  10. }
  11. }
  12. public function new() {}
  13. }