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

Error in GenericsUtils affecting property access

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.4.1
    • Fix Version/s: 5.4.5
    • Component/s: None
    • Labels:
      None

      Description

      There is an error somewhere in the GenericsUtils.resolve( TypeVariable typeVariable, Type containingType ) method.

      It resolves some type variables to their lower bound instead of the correct version.

      We have model classes that uses lots of generics and in some cases tapestry reports that a given property expression is invalid because some lower bound interface does not contain the property in the expression.

      I tried to see if I could find an easy fix, but ended up running out of time and simply replaced the bodies of the 5 resolution methods in the GenericsUtils with guava reflect code and then things started working as expected.

      The interface setup that gives the error looks like this:

      public interface NonTranslatableContentUnit<T extends ContentData> {
          T getContent();
      }
      
      public interface BinaryContentUnit<T extends BinaryContent> extends NonTranslatableContentUnit<T> {}
      
      public interface FileContentUnit extends BinaryContentUnit<FileContent> {}
      
      public interface ContentData {
          isEmpty();
          ...
      }
      
      public interface BinaryContent extends ContentData {
      
          String getMimeType();
          ...
      }   
      
      public interface FileContent extends BinaryContent {}
      

      Then we have a property expression on a FileContentUnit like: "content.mimeType" and that fails with an error that says something like ContentData does not have a property MimeType.

      As far as I can tell the resolve(TypeVariable, ..) method fails to do anything sensible if the Type of the "containing class" is not an instance of ParameterizedType

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              thiagohp Thiago Henrique De Paula Figueiredo
              Reporter:
              chrispoulsen Chris Poulsen

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment