Details

    • Type: Sub-task Sub-task
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 2.4.0-beta-4
    • Component/s: groovy-runtime
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      The String setter in the attached example is never called. Instead, the int setter is called when I assign a String with size() == 1. If the size is bigger, I get a GroovyClassCastException

        Issue Links

          Activity

          Hide
          Aaron Digulla added a comment -

          A possible solution for this might be an annotation which defines one or more converters:

          File   getMyprop()
          @Converters(ToFile.class)
          void   setMyprop( File )
          

          where ToFile implements "File convert (String)"

          Show
          Aaron Digulla added a comment - A possible solution for this might be an annotation which defines one or more converters: File getMyprop() @Converters(ToFile.class) void setMyprop( File ) where ToFile implements "File convert (String)"
          Hide
          blackdrag blackdrag added a comment -

          as for the timeline... we have not decided yet. Groovy 2.0 will probably bring some fundamental changes to the metaprogramming stuff so it will take a while to work them all out. The next Groovy version will be 1.7 and after that 2.0 is planed.

          As for the Annotation solution... the current problem is not so much that we are unable to detect multiple getters. The problem is more that we need to change the MOP to support that. And not only the resloving part. Since you can get a MetaProperty from the MetaClass and that class has only one setter, a change to the API is needed and one that might not work well with what we already have...

          But looking at it again I was wrong...nice... so I schedule it for 1.7 then

          Show
          blackdrag blackdrag added a comment - as for the timeline... we have not decided yet. Groovy 2.0 will probably bring some fundamental changes to the metaprogramming stuff so it will take a while to work them all out. The next Groovy version will be 1.7 and after that 2.0 is planed. As for the Annotation solution... the current problem is not so much that we are unable to detect multiple getters. The problem is more that we need to change the MOP to support that. And not only the resloving part. Since you can get a MetaProperty from the MetaClass and that class has only one setter, a change to the API is needed and one that might not work well with what we already have... But looking at it again I was wrong...nice... so I schedule it for 1.7 then
          Hide
          Jon Cox added a comment -

          Jochen,

          In your last stament, did you mean that groovy 1.7
          might support setter overloads?

          If so, would special annotations be required, or does
          the idea you've got in mind allow settter overloads without
          having to resort to special annotations?

          It would be really great if they could just work
          without any extra fiddling with annotations.

          Cheers,
          -Jon

          Show
          Jon Cox added a comment - Jochen, In your last stament, did you mean that groovy 1.7 might support setter overloads? If so, would special annotations be required, or does the idea you've got in mind allow settter overloads without having to resort to special annotations? It would be really great if they could just work without any extra fiddling with annotations. Cheers, -Jon
          Hide
          blackdrag blackdrag added a comment -

          I thought about supporting them without any annotation. I think it is doable for 1.7, but 1.7 is a bit away

          Show
          blackdrag blackdrag added a comment - I thought about supporting them without any annotation. I think it is doable for 1.7, but 1.7 is a bit away
          Hide
          Jon Cox added a comment -

          Awesome.
          Thanks for the update.

          -Jon

          Show
          Jon Cox added a comment - Awesome. Thanks for the update. -Jon

            People

            • Assignee:
              CÚdric Champeau
              Reporter:
              Aaron Digulla
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: