[Xapian-tickets] [Xapian] #616: SWIG wraps C++ bitmask enums unhelpfully (was: Exception in thread "main" java.lang.IllegalArgumentException: No enum class org.xapian.TermGenerator$flags with value 0)

Xapian nobody at xapian.org
Tue Mar 5 09:19:30 GMT 2013


#616: SWIG wraps C++ bitmask enums unhelpfully
------------------------------------+---------------------------------------
 Reporter:  Naveen                  |       Owner:        
     Type:  defect                  |      Status:  new   
 Priority:  normal                  |   Milestone:  1.3.x 
Component:  Xapian-bindings (Java)  |     Version:  1.2.13
 Severity:  normal                  |    Keywords:        
Blockedby:                          |    Platform:  All   
 Blocking:                          |  
------------------------------------+---------------------------------------
Changes (by olly):

  * priority:  high => normal
  * severity:  critical => normal
  * milestone:  => 1.3.x


Comment:

 If you're using 1.2.13, you must be using the java-swig bindings (since
 !TermGenerator isn't wrapped at all in the JNI ones).  Or are you actually
 using trunk?

 Either way issues with the SWIG-based Java bindings aren't "critical" -
 they're marked as a work in progress in 1.2.x and on trunk haven't yet
 been in a stable release.  And please don't inflate bug priorities - it
 won't get the bug fixed any sooner.

 It looks like SWIG wraps the C++ enum in a way that only allows it to take
 the values in the enumeration, so the default second argument doesn't work
 because the value 0 isn't named in the C++ enum.

 I think we really want the !TermGenerator flags to be wrapped as an Java
 integer type, because it's really a bitmask.  We probably want to do this
 for any other C++ enums in the API which are used as bitmasks.

 This seems to be how to do that:

 http://swig.org/Doc2.0/Java.html#Java_typeunsafe_enums

-- 
Ticket URL: <http://trac.xapian.org/ticket/616#comment:3>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list