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

Copy annotations from service implementation to proxy (was JPA annotations expose implementation details in service interfaces)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3.6, 5.4
    • Fix Version/s: 5.4
    • Component/s: tapestry-ioc

      Description

      The commit after and persistence context annotations are required on the service interface definition thereby exposing internal implementation details (see below example from docs). Details of implementation should be hidden at the interface level, both these annotations break the rule.

      Perhaps this code could appear in the Impl classes, or be provided in configuration somehow?

      public interface UserDAO {

      @CommitAfter
      @PersistenceContext(unitName = "DemoUnit")
      void add(User user);

        Issue Links

          Activity

          Hide
          thiagohp Thiago H. de Paula Figueiredo added a comment -

          Changing the component from tapestry-jpa to tapestry-ioc as this is actually a shortcoming in Tapestry-IoC.

          Show
          thiagohp Thiago H. de Paula Figueiredo added a comment - Changing the component from tapestry-jpa to tapestry-ioc as this is actually a shortcoming in Tapestry-IoC.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4a818e35585ac0860aaffa23bc0d1799514480da in branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=4a818e3 ]

          TAP5-2029: Copy annotations from service implementation to proxy

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4a818e35585ac0860aaffa23bc0d1799514480da in branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=4a818e3 ] TAP5-2029 : Copy annotations from service implementation to proxy
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 28df9e51cbdef90f5768595cfd2992f877c244cf in branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=28df9e5 ]

          TAP5-2029: Copy annotations from service implementation to proxy

          Show
          jira-bot ASF subversion and git services added a comment - Commit 28df9e51cbdef90f5768595cfd2992f877c244cf in branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=28df9e5 ] TAP5-2029 : Copy annotations from service implementation to proxy
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8211839603d67ec19e7aecf670f79417808d17b3 in branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=8211839 ]

          TAP5-2029: fixes a ClassFormatError (Illegal exception table range)

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8211839603d67ec19e7aecf670f79417808d17b3 in branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=8211839 ] TAP5-2029 : fixes a ClassFormatError (Illegal exception table range)
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 85da163adbd1b8bd831c49d144ddcaffb16e6c63 in branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=85da163 ]

          TAP5-2029: fixing some text replacements done by mistake

          Show
          jira-bot ASF subversion and git services added a comment - Commit 85da163adbd1b8bd831c49d144ddcaffb16e6c63 in branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=85da163 ] TAP5-2029 : fixing some text replacements done by mistake
          Hide
          Charlouze Charles Capon added a comment -

          Patch that adds test cases which demonstrate an issue with generics.

          Show
          Charlouze Charles Capon added a comment - Patch that adds test cases which demonstrate an issue with generics.
          Hide
          thiagohp Thiago H. de Paula Figueiredo added a comment -

          Reopening to investigate the issue found by Charles. Thanks for the test patch!

          Show
          thiagohp Thiago H. de Paula Figueiredo added a comment - Reopening to investigate the issue found by Charles. Thanks for the test patch!
          Hide
          jkemnade Jochen Kemnade added a comment -

          I just wanted to check if this is still relevant. I applied the patch and the second test succeeds with Gradle but fails in Eclipse in line 100.

          Condition not satisfied:
          
          nonAnnotatedGenSetMethod2.getAnnotation(Advise.class) != null
          |                         |                           |
          |                         null                        false
          public java.lang.String $NonAnnotatedGenericSetServiceInterface_9473fb6e16b6.execute2(java.lang.Object)
          
          	at ioc.specs.MethodInvocationGetAnnotationSpec.MethodAdvice.getAnnotation() and getMethod() in service advice(MethodInvocationGetAnnotationSpec.groovy:100)
          
          Show
          jkemnade Jochen Kemnade added a comment - I just wanted to check if this is still relevant. I applied the patch and the second test succeeds with Gradle but fails in Eclipse in line 100. Condition not satisfied: nonAnnotatedGenSetMethod2.getAnnotation(Advise.class) != null | | | | null false public java.lang. String $NonAnnotatedGenericSetServiceInterface_9473fb6e16b6.execute2(java.lang. Object ) at ioc.specs.MethodInvocationGetAnnotationSpec.MethodAdvice.getAnnotation() and getMethod() in service advice(MethodInvocationGetAnnotationSpec.groovy:100)
          Hide
          thiagohp Thiago H. de Paula Figueiredo added a comment -

          I couldn't fix this issue yet, so I believe it's already relevant.

          Show
          thiagohp Thiago H. de Paula Figueiredo added a comment - I couldn't fix this issue yet, so I believe it's already relevant.
          Hide
          jkemnade Jochen Kemnade added a comment -

          I still wonder why it behaves differently in Eclipse and when run from the command line. Unfortunately, I haven't had the time to investigate this yet.

          Show
          jkemnade Jochen Kemnade added a comment - I still wonder why it behaves differently in Eclipse and when run from the command line. Unfortunately, I haven't had the time to investigate this yet.
          Hide
          thiagohp Thiago H. de Paula Figueiredo added a comment -

          Yeah, that's unexpected.

          Show
          thiagohp Thiago H. de Paula Figueiredo added a comment - Yeah, that's unexpected.
          Hide
          jkemnade Jochen Kemnade added a comment -

          This seems to have more unforeseen consequences: I just got an AnnotationFormatError in a Spock test:

          java.lang.annotation.AnnotationFormatError: Duplicate annotation for class: interface java.lang.Deprecated: @java.lang.Deprecated()
          	at java.beans.PropertyDescriptor.setReadMethod(PropertyDescriptor.java:260)
          	at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:159)
          	at java.beans.Introspector.getTargetPropertyInfo(Introspector.java:512)
          	at java.beans.Introspector.getBeanInfo(Introspector.java:428)
          	at java.beans.Introspector.getBeanInfo(Introspector.java:173)
          	at unit.DatabaseSpec.Load an item from the database(unit.DatabaseSpec.groovy:165)
          

          The problem is caused by a service method that has a @Deprecated annotation on both the interface and the implementation methods.

          Show
          jkemnade Jochen Kemnade added a comment - This seems to have more unforeseen consequences: I just got an AnnotationFormatError in a Spock test: java.lang.annotation.AnnotationFormatError: Duplicate annotation for class: interface java.lang.Deprecated: @java.lang.Deprecated() at java.beans.PropertyDescriptor.setReadMethod(PropertyDescriptor.java:260) at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:159) at java.beans.Introspector.getTargetPropertyInfo(Introspector.java:512) at java.beans.Introspector.getBeanInfo(Introspector.java:428) at java.beans.Introspector.getBeanInfo(Introspector.java:173) at unit.DatabaseSpec.Load an item from the database(unit.DatabaseSpec.groovy:165) The problem is caused by a service method that has a @Deprecated annotation on both the interface and the implementation methods.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 177dc5c3acc600d20796ae0bbd7d5226d76bbe21 in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=177dc5c ]

          Partial fix for TAP5-2029.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 177dc5c3acc600d20796ae0bbd7d5226d76bbe21 in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=177dc5c ] Partial fix for TAP5-2029 .
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 72334aa632d6ccade195af45014f7903fc0765fa in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=72334aa ]

          TAP5-2029: a best-effort attempt to deal with generic methods and their
          annotations in service proxies.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 72334aa632d6ccade195af45014f7903fc0765fa in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=72334aa ] TAP5-2029 : a best-effort attempt to deal with generic methods and their annotations in service proxies.
          Hide
          hudson Hudson added a comment -

          ABORTED: Integrated in tapestry-trunk-freestyle #1447 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1447/)
          Partial fix for TAP5-2029. (thiagohp: rev 177dc5c3acc600d20796ae0bbd7d5226d76bbe21)

          • plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java
            TAP5-2029: a best-effort attempt to deal with generic methods and their (thiagohp: rev 72334aa632d6ccade195af45014f7903fc0765fa)
          • plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/MethodNode.java
          • plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java
          • tapestry-ioc/src/test/groovy/ioc/specs/MethodInvocationGetAnnotationSpec.groovy
          • tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviceModule.java
          Show
          hudson Hudson added a comment - ABORTED: Integrated in tapestry-trunk-freestyle #1447 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1447/ ) Partial fix for TAP5-2029 . (thiagohp: rev 177dc5c3acc600d20796ae0bbd7d5226d76bbe21) plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java TAP5-2029 : a best-effort attempt to deal with generic methods and their (thiagohp: rev 72334aa632d6ccade195af45014f7903fc0765fa) plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/MethodNode.java plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java tapestry-ioc/src/test/groovy/ioc/specs/MethodInvocationGetAnnotationSpec.groovy tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviceModule.java
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit b65ad362e1d0bacf2f243255ee9b1e45db1c76c0 in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=b65ad36 ]

          TAP5-2029 : fixing the handling of annotations placed both on interface and implementation of a service

          Show
          jira-bot ASF subversion and git services added a comment - Commit b65ad362e1d0bacf2f243255ee9b1e45db1c76c0 in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=b65ad36 ] TAP5-2029 : fixing the handling of annotations placed both on interface and implementation of a service
          Hide
          thiagohp Thiago H. de Paula Figueiredo added a comment -

          One year and a half after starting working on this ticket, I think I've finally finished it, also finishing the Month of Tapestry. Now the implementation handles generic interfaces (in a best effort basis) and the same class, method or parameter being annotated both in the interface and in the service implementation.

          Show
          thiagohp Thiago H. de Paula Figueiredo added a comment - One year and a half after starting working on this ticket, I think I've finally finished it, also finishing the Month of Tapestry. Now the implementation handles generic interfaces (in a best effort basis) and the same class, method or parameter being annotated both in the interface and in the service implementation.
          Hide
          hudson Hudson added a comment -

          ABORTED: Integrated in tapestry-trunk-freestyle #1450 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1450/)
          TAP5-2029 : fixing the handling of annotations placed both on interface and implementation of a service (thiagohp: rev b65ad362e1d0bacf2f243255ee9b1e45db1c76c0)

          • plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/ClassNode.java
          • tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedServiceInterface.java
          • plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/AnnotationNode.java
          • plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java
          • tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedServiceInterfaceImpl.java
          • tapestry-ioc/src/test/groovy/ioc/specs/MethodInvocationGetAnnotationSpec.groovy
          Show
          hudson Hudson added a comment - ABORTED: Integrated in tapestry-trunk-freestyle #1450 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1450/ ) TAP5-2029 : fixing the handling of annotations placed both on interface and implementation of a service (thiagohp: rev b65ad362e1d0bacf2f243255ee9b1e45db1c76c0) plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/ClassNode.java tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedServiceInterface.java plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/AnnotationNode.java plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedServiceInterfaceImpl.java tapestry-ioc/src/test/groovy/ioc/specs/MethodInvocationGetAnnotationSpec.groovy
          Hide
          jkemnade Jochen Kemnade added a comment -

          Thiago H. de Paula Figueiredo, I think you may have forgotten to commit org.apache.tapestry5.ioc.internal.NonAnnotatedGenericSetServiceInterface and org.apache.tapestry5.ioc.internal.NonAnnotatedGenericSetServiceImpl.

          Show
          jkemnade Jochen Kemnade added a comment - Thiago H. de Paula Figueiredo , I think you may have forgotten to commit org.apache.tapestry5.ioc.internal.NonAnnotatedGenericSetServiceInterface and org.apache.tapestry5.ioc.internal.NonAnnotatedGenericSetServiceImpl .
          Hide
          jkemnade Jochen Kemnade added a comment -

          There are test classes missing.

          Show
          jkemnade Jochen Kemnade added a comment - There are test classes missing.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 682087df37beb5add15a102bdfb9adfd9e2ddc76 in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo
          [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=682087d ]

          Missing files for TAP5-2029

          Show
          jira-bot ASF subversion and git services added a comment - Commit 682087df37beb5add15a102bdfb9adfd9e2ddc76 in tapestry-5's branch refs/heads/master from Thiago H. de Paula Figueiredo [ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=682087d ] Missing files for TAP5-2029
          Hide
          hudson Hudson added a comment -

          ABORTED: Integrated in tapestry-trunk-freestyle #1459 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1459/)
          Missing files for TAP5-2029 (thiagohp: rev 682087df37beb5add15a102bdfb9adfd9e2ddc76)

          • tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedGenericSetServiceImpl.java
          • tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedGenericServiceInterface.java
          • tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedGenericSetServiceInterface.java
          Show
          hudson Hudson added a comment - ABORTED: Integrated in tapestry-trunk-freestyle #1459 (See https://builds.apache.org/job/tapestry-trunk-freestyle/1459/ ) Missing files for TAP5-2029 (thiagohp: rev 682087df37beb5add15a102bdfb9adfd9e2ddc76) tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedGenericSetServiceImpl.java tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedGenericServiceInterface.java tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/NonAnnotatedGenericSetServiceInterface.java

            People

            • Assignee:
              thiagohp Thiago H. de Paula Figueiredo
              Reporter:
              johncoleman John Coleman
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development