[jboss-jira] [JBoss JIRA] Created: (JASSIST-135) Inconsistent interpretation of $0

Thomas Mauch (JIRA) jira-events at lists.jboss.org
Tue Nov 16 02:46:45 EST 2010


Inconsistent interpretation of $0
---------------------------------

                 Key: JASSIST-135
                 URL: https://jira.jboss.org/browse/JASSIST-135
             Project: Javassist
          Issue Type: Bug
    Affects Versions: 3.13.0.GA
            Reporter: Thomas Mauch
            Assignee: Shigeru Chiba


The interpretation of the variable $0 if a static method is involved is inconsistent in my opinion:

Section "4.1 Inserting source text at the beginning/end of a method body" states: "If the method is static, $0 is not available."
So you will get "javassist.CannotCompileException: [source error] no such field: $0" if try to use $0 for a static method.
This forces you to use if/then/else and to write two source code statements if you need to process instance and static methods in a uniform way.

But there is also a more relaxed interpretation of $0 which makes life easier:
Section "4.2 Altering a method body" states: "$0 is null if the method is static.".

So I would prefer to have $0 always available with a value of null if a static method is involved.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list