[jboss-jira] [JBoss JIRA] Created: (JBRULES-737) Filter out <clinit> method when inspecting classes

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Wed Mar 14 17:38:32 EDT 2007


Filter out <clinit> method when inspecting classes
--------------------------------------------------

                 Key: JBRULES-737
                 URL: http://jira.jboss.com/jira/browse/JBRULES-737
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Reteoo
    Affects Versions: 3.1-m1
            Reporter: Edson Tirelli
         Assigned To: Edson Tirelli
             Fix For: 3.1-m2


FROM TERRY LAURENZO:
-------------------------------------------------
The attached diff (against 3.0.5 sources) adds a condition to the  ClassFieldInspector to not analyze methods named <clinit>.  For some  reason, the Groovy compiler is outputing classes that were causing  this check to choke and throw an IllegalArgumentException because of  a <clinit> method with ACC_PUBLIC access code.

Applying this patch allows Drools to operate correctly with compiled  Groovy Fact classes.

This seems like a pretty innocuous change that someone should apply  to SVN.  Unfortunately, it is rather difficult to create a test case  for it.

Terry Laurenzo 

--------------
Index: src/main/java/org/drools/util/asm/ClassFieldInspector.java
===================================================================
*** src/main/java/org/drools/util/asm/ClassFieldInspector.java	Wed Mar 14 08:58:24 2007
--- src/main/java/org/drools/util/asm/ClassFieldInspector.java	Mon Mar 12 11:21:23 2007
*************** public class ClassFieldInspector {
*** 241,247 ****
              //only want public methods that start with 'get' or 'is'
              //and have no args, and return a value
              if ( (access & Opcodes.ACC_PUBLIC) > 0 ) {
!                 if ( desc.startsWith( "()" ) && !(name.equals( "<init>" )) ) {// && ( name.startsWith("get") || name.startsWith("is") ) ) {
                      try {
                          final Method method = this.clazz.getMethod( name,
                                                                      (Class[]) null );
--- 241,247 ----
              //only want public methods that start with 'get' or 'is'
              //and have no args, and return a value
              if ( (access & Opcodes.ACC_PUBLIC) > 0 ) {
!                 if ( desc.startsWith( "()" ) && !(name.equals( "<init>" )) && !(name.equals( "<clinit>" )) ) {// && ( name.startsWith("get") || name.startsWith("is") ) ) {
                      try {
                          final Method method = this.clazz.getMethod( name,
                                                                      (Class[]) null );


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

        



More information about the jboss-jira mailing list