• Bug
  • Status: Resolved
  • 2 Major
  • Resolution: Won't Fix
  • teck
  • Reporter: teck
  • December 21, 2009
  • 2
  • Watchers: 1
  • September 06, 2013
  • September 06, 2013

Attachments

Description

In certain cases (ie. auto-lock’ing a method with synchronized access) we rename existing methods (ie. from foo() –> __tc_foo()) and make the original method name a wrapper. If the original method had an annotation on it, one effect of this rename is that the annotation is no longer on the “correct” method name.

I’m not sure what kinds of things this screws up in the real world, but it does seem wrong that the annotation “moves”

Attached is a sample program to demostrate the issue.

I think DMI might have the same problematic pattern in it

Comments

Fiona OShea 2010-01-05

How hard is this to fix?

Tim Eck 2010-01-05

probably not too hard to fix, around a day I’d think.

Wulf Rowek 2010-06-05

I’ve the same issue when trying to use terracotta for clustering a jboss seam session.

Seam heavily uses annotations on its components and when an annotated methods will be rewritten by terracotta instrumentation due to auto-locking, the annotation moves to the new private method which will be than probably called by the original (and public) method.

When now seam comes to search annotated methods, it finds the new private method instead of the original public method and that obvouisly triggers errors. i.e. seam tries to get the wrong annotated method by calling class.getMethod():

java.lang.NoSuchMethodException: org.jboss.seam.security.Identity.__tc_wrapped_create() java.lang.Class.getMethod(Class.java:1581) org.jboss.seam.Component.callComponentMethod(Component.java:2208) org.jboss.seam.Component.callCreateMethod(Component.java:2134)

Normally it should try to get public org.jboss.seam.security.Identity.create() which was original annotated, but because terracotta moved the annotation seam tries now to get the private __tc_wrapped_create(), which is not right and also fails due to no private methods are available by class.getMethod()

above is something written about a workaround. Where can i find that? How can I fix this issue?

Btw: Are there any experiences/project known with clustering seam sessions with terracotta?

Wulf Rowek 2010-06-05

there is also written that it is fixed in trunk. maybe someone can tell in which revision, so that i can try to patch my terracotta version with the changes from this revision. thanks in advance

Wulf Rowek 2010-06-07

here is a forum thread disussing this issue as well: http://forums.terracotta.org/forums/posts/list/0/3550.page

Tim Eck 2010-06-07

This issue is not yet fixed anywhere. This item is labeled to be fixed in trunk but that has not yet happened.

The only workaround is to move to block synchronization (instead of synchronized access on the method). Eg.

synchronized void foo() { // }

to

void foo() { synchronized(this) { // } }