[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3719) Javassist fails to instrument valid classes in certain cases
Paul Pogonyshev (JIRA)
noreply at atlassian.com
Mon Jan 19 05:49:38 EST 2009
Javassist fails to instrument valid classes in certain cases
------------------------------------------------------------
Key: HHH-3719
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3719
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Javassist 3.4.GA (also tested with 3.9.GA)
Reporter: Paul Pogonyshev
Priority: Minor
In certain cases Javassist fails with the following message: "duplicate method: getId in org.hibernate.proxy.HibernateProxy_$$_javassist_0".
I was able to trace the problem down to the following simple case.
public interface Identifiable <Type>
{ Type getId (); }
public interface Entity extends Identifiable <Long>
{ Long getId (); }
public class EntityImpl implements Entity
{
private Long id;
public Long getId ()
{ return id; }
void setId (Long id)
{ this.id = id; }
}
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="EntityImpl"
proxy="Entity">
<id name="id"/>
</class>
</hibernate-mapping>
Note that at least generics in definition of Identifiable interface and specifying proxy interface in the mapping seems important. Easy workaround seems to just not explicitly redefine getId() in Entity interface, i.e. just keep the one (same one) gotten from Identifiable. However, _finding_ this workaround was by no means easy.
As I know, Java compiler removes generics information from compiled code, so the two methods might indeed appear different (i.e. as Objecte getId() and Long getId() correspondingly). Maybe Javassist could just disable duplicate method checks in generated classes for the cases when _both_ methods come from the wrapped class?
I'm not sure this is the right tracker, but I couldn't find one for Javassist.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list