[jboss-jira] [JBoss JIRA] Created: (JASSIST-133) The classpool cache overrides the search order which is expected based on ClassPath objects order

Mooky Grand (JIRA) jira-events at lists.jboss.org
Thu Oct 21 12:51:54 EDT 2010


The classpool cache overrides the search order which is expected based on ClassPath objects order
-------------------------------------------------------------------------------------------------

                 Key: JASSIST-133
                 URL: https://jira.jboss.org/browse/JASSIST-133
             Project: Javassist
          Issue Type: Bug
    Affects Versions: 3.13.0.GA
         Environment: Reproduced on Windows XP (32) + Java 1.6.0_16.
            Reporter: Mooky Grand
            Assignee: Shigeru Chiba


1. create a class pool that contains a class path from which you can get CtClass for class "A".
2. use the class pool to get the CtClass of class "B" which depends on class "A" (e.g. one of the return values of a method in class "B" is "A").
3. insert a new class path to the beginning of the class pool (ClassPoll.insertClassPath) that also contains the byte array for class "A"
4. Call ClassPool.get in order to get class "A"

Expected:
1. A CtClass will be returned.
2. The returned CtClass will be based on the byte array from the ClassPath object which was added in step 3 above.

Actual:
1. A CtClass will be returned.
2. The returned CtClass will be based on the byte array from the ClassPath object which was added in step 1 above.


Reason:
The cache used by ClassPool instances has no concept of ClassPath order. Once a CtClass is added to this cache, it will override the expected search order among ClassPath objects.

Suggested Work Around:
1. using classPool.getAndRename(<className>, <className>).
2. using makeClass with ByteArrayInputstream for the byte array you wish to use.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list