Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8012442

Spec issues wrt few more built-in objects such as Date, Array, Function and RegExp

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • core-libs
    • None


      Again some more tests with broken spec-compliance.

      - André



      "abc".lastIndexOf("a",-1)
      => should return 0 instead of -1

      Nashorn shell does not start with Turkish locale
      => locale dependent toLowerCase() in OptionTemplate needs to be changed to be locale independent

      "i".toUpperCase()
      => currently returns "İ", but should be "I" (with Turkish locale)

      RegExp("[")
      => StackOverflow exception

      Array.prototype.reduceRight.call({length:0xffffffff, 0xfffffffe: "index: "}, function(acc,v,i,o){print(v+i); throw "stop"}, 0)
      => should print "index: 4294967294" and then throw the exception "stop"

      Function().apply(null, Object.defineProperty([],"0",{get: function(){print("getter"); return 0}}))
      => should print "getter"

      Function().apply(null, {length: null})
      Function().apply(null, {length: 0.1})
      => should not throw an exception

      Date.parse("2012-01-10T00:00:00.000-")
      Date.parse("2012-01-01T00:00+")
      => should return NaN

      new Date(NaN).setFullYear(NaN)
      => currently throws java.lang.NullPointerException

      new Date(0).setYear(70)
      => should return 0

      new Date(0).setYear(NaN)
      => should return NaN

      new Date(NaN).setYear(70)
      => should return the new time value

      new Date(NaN).getTimezoneOffset()
      => should return NaN

      Date.prototype.setTime.call({},{valueOf:function(){throw "err"}})
      => should throw a TypeError instead of "err"

      new Date(NaN).setMilliseconds({valueOf:function(){throw "err"}})
      => should throw "err"

      Same bug with the following functions:
      Date.prototype.setUTCMilliseconds
      Date.prototype.setSeconds
      Date.prototype.setUTCSeconds
      Date.prototype.setMinutes
      Date.prototype.setUTCMinutes
      Date.prototype.setHours
      Date.prototype.setUTCHours
      Date.prototype.setDate
      Date.prototype.setUTCDate
      Date.prototype.setMonth
      Date.prototype.setUTCMonth

      Date.prototype.toJSON.call({valueOf:function(){return "foo"}, toISOString: function(){return "from-toISOString"}})
      => should return "from-toISOString"

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: