Announcement Announcement Module
Collapse
No announcement yet.
LTW + static/final Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LTW + static/final

    Hi, does anyone know of any restriction/special configuration for LTW when it comes to static/final attributes/methods/classes?

    Thnx!

  • #2
    Turns out it's got something to do with reflection. Still trying to figure it out.
    I'm getting:

    java.lang.IllegalAccessException: Field is final

    while trying to get a copy of a bean.

    Comment


    • #3
      Ok...so here's what's happening. I'm getting a list of fields in the object i'm making a copy of by calling:
      Field[] fields = myClass.getDeclaredFields();

      this is what the array looks like:
      [private java.lang.Integer ar.mycompany.cda.modelo.beans.PersistenceObject.id , private static final org.aspectj.lang.JoinPoint$StaticPart ar.mycompany.cda.modelo.beans.PersistenceObject.aj c$tjp_0, private static final org.aspectj.lang.JoinPoint$StaticPart ar.mycompany.cda.modelo.beans.PersistenceObject.aj c$tjp_1]

      The first one is OK...the other 2...not so much. As you can see the last 2 are declared "static final". Which is why the
      "java.lang.IllegalAccessException: Field is final" is being thrown.

      I guess what I need to do is to have in this particular point an "unweaved object". Is there a way to do that?

      Thnx
      Last edited by joni.loky; May 14th, 2008, 10:03 AM.

      Comment


      • #4
        Originally posted by joni.loky View Post
        Ok...so here's what's happening. I'm getting a list of fields in the object i'm making a copy of by calling:
        Field[] fields = myClass.getDeclaredFields();

        this is what the array looks like:
        [private java.lang.Integer ar.mycompany.cda.modelo.beans.PersistenceObject.id , private static final org.aspectj.lang.JoinPoint$StaticPart ar.mycompany.cda.modelo.beans.PersistenceObject.aj c$tjp_0, private static final org.aspectj.lang.JoinPoint$StaticPart ar.mycompany.cda.modelo.beans.PersistenceObject.aj c$tjp_1]

        The first one is OK...the other 2...not so much. As you can see the last 2 are declared "static final". Which is why the
        "java.lang.IllegalAccessException: Field is final" is being thrown.

        I guess what I need to do is to have in this particular point an "unweaved object". Is there a way to do that?

        Thnx

        What is it that you are actually trying to do?

        Comment


        • #5
          FIXED IT!!!!!!!!
          I ROCK!!!!!!!!
          jejejejejeje
          It's sort of a workaround....
          getDeclaredFields(); exposes all fields including the ones LTW seems to add...
          Those Fields are of type: org.aspectj.lang.JoinPoint$StaticPart
          So while iterating the Fields I check to see if the field I'm processing is one of those and I simply do a "continue;" jijijiji

          Comment

          Working...
          X