[ 
https://issues.apache.org/jira/browse/TAP5-2582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17072830#comment-17072830
 ] 

Hendrik Noot commented on TAP5-2582:
------------------------------------

It took a bit longer than expected. Here is a patch that should fix the problem 
in tapestry-ioc. It just modifies the PropertyShadowBuilderImpl class, so only 
tapestry-ioc has to be changed if you want to do a hotfix in your build. This 
is a modified copy of the changes from Thiago in this issue on the 
PropertyShadowBuilderImpl class. 

 [^TAP5-2582_fix_duplicate_method_problem.patch] 

I would have added a second patch that moves the method “getUniqueMethods” and 
the MethodComparator out of both classes so they can share the implementation, 
but I think this is not necessary. 

getUniqueMethods in PlasticClassImpl doesn’t do anything, because the "last" 
variable is always null. So it can be removed. The MethodComparator 
implementation in PlasticClassImpl is not transitive (the last part that 
compares the hierarchy order), so this could cause several problems. There are 
two uses of this comparator besides “getUniqueMethods” and both don’t seem to 
be necessary. So I think getUniqueMethods and the MethodComparator can be 
removed. But I’m not a plastic expert, so there is a good chance that I missed 
something.

 [^TAP5-2582_removed_some_probably_dead_code_in_PlasticClassImpl.patch] 


> Service creation for Hibernate Session results in ClassFormatError: Duplicate 
> method name&signature
> ---------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-2582
>                 URL: https://issues.apache.org/jira/browse/TAP5-2582
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-ioc
>    Affects Versions: 5.4.3
>            Reporter: Thomas Mayer
>            Assignee: Thiago Henrique De Paula Figueiredo
>            Priority: Major
>              Labels: duplicate,method, hibernate, interface, ioc
>             Fix For: 5.4.5
>
>         Attachments: TAP-2482-test.patch, TAP5-2582-test.patch, 
> TAP5-2582_fix_duplicate_method_problem.patch, 
> TAP5-2582_removed_some_probably_dead_code_in_PlasticClassImpl.patch, pom.xml
>
>
> Hi, this report is for
> tapestry-ioc 5.4.3
> hibernate-core 5.2.10.Final
> openjdk version "1.8.0_121"
> OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
> OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
> I'm trying to have a Service for a hibernate Session:
> {code:java}
> public static Session buildHibernateSession(
>     ObjectLocator objectLocator
> ) {
>     return new Configuration()
>         .configure("hibernate.cfg.xml")
>         .buildSessionFactory()
>         .openSession();
> }
> {code}
> As soon as the Hibernate Session is invoked by Tapestry-IOC, I get an
> error:  java.lang.ClassFormatError: Duplicate method name&signature in
> class file $Session_350f95bde0b5



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to