Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2016

Scala style properties unnecessarily require a field with the same name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 5.3.6, 5.2.5
    • None
    • tapestry-ioc

    Description

      The changes introduced with TAP5-1064 allow Scala-style properties to be used from components without the need for Java-style getters and setters. The implementation currently requires a field of the same name as the property to exist on the bean, which is unfortunate.

      This works:

      var value: String = _

      <input ... t:value="value" />

      This does not:

      def value(): String = ...
      def value_=(value: String)

      { ... }

      <input ... t:value="value" />

      A class which delegates property access to a backing bean is not recognized by PropertyAccessImpl as having any valid properties; the same is the case when the field has a different name than the property.

      Possible workarounds include a dead field in the value class to satisfy the condition in PropertyAccessImpl, and adding Java-style getters and setters for the property.

      Attachments

        1. TAP5-2016.patch
          4 kB
          Henning Petersen

        Activity

          People

            Unassigned Unassigned
            henningp Henning Petersen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: