Results 1 to 5 of 5

Thread: LTW + static/final

  1. #1
    Join Date
    May 2008
    Posts
    16

    Default 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. #2
    Join Date
    May 2008
    Posts
    16

    Default

    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.

  3. #3
    Join Date
    May 2008
    Posts
    16

    Default

    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 at 10:03 AM.

  4. #4
    Join Date
    Nov 2007
    Posts
    420

    Default

    Quote 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?

  5. #5
    Join Date
    May 2008
    Posts
    16

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •