Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-2315

InjectContainerWorker should use this or other local variable name than "container"

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.0.11
    • 5.0.12
    • tapestry-core
    • None
    • any

    Description

      What I did:

      @InjectContainer
      private Field container;

      Resulted in: container == null

      The InjectContainerWorker uses "container" as the name of a temporary local variable, and the assignment is done to the field name:

      builder.addln("%s = (%s) container;", fieldName, fieldType);

      This resulted in:

      container = (org.apache.tapestry.Field) container;

      Thus my instance variable was never assigned to. Should probably be

      builder.addln("this.%s = (%s) container;", fieldName, fieldType);

      or use any other name for the temporary variable - might not be so uncommon for people to name the container "container", and can be very confusing.

      Attachments

        Activity

          People

            ted Ted Steen
            wolfram Wolfram Koska
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: