Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3389

Field Hiding Behavior Regression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.6
    • 1.6.1, 1.7-beta-1
    • None
    • None
    • Discovered running on Windows XP, JDK 1.6.0_07

    Description

      Member hiding behavior has changed between 1.5.7 and 1.6 . Previous code which caused member hiding now does not.

      class Foo {
          String bar
         
          void doIt() {
              def bar = new File('.')
             
              println bar instanceof File    // prints false (1.6), true (1.5.7)
              println bar instanceof String  // prints true (1.6), false (1.5.7)
          }
      }
      
      def foo = new Foo()
      foo.doIt()
      

      Roshan:

      """
      Looks like a bug to me because

      class Foo {
          String bar
          void doIt(File bar) {
              println bar instanceof File // returns true
          }
      }
      
      def foo = new Foo()
      foo.doIt(new File('.'))
      

      And it should be consistent in hiding behavior whethere it is a method parameter that is doing the hiding or a local, method-level variable.
      """

      Jochen:

      """
      that is clearly a bug that crept in unnoticed. Please fill an issue for it, this absolutely needs to be fixed for the next release
      """

      Attachments

        1. 3389_v16x.txt
          0.9 kB
          Roshan Dawrani

        Activity

          People

            roshandawrani Roshan Dawrani
            gyrm Haw-Bin Chai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: