简体   繁体   English

SWIG生成的代码未处理或引发异常

[英]SWIG-generated code not handling or throwing exception

I am using SWIG to generate Java code from C++ code. 我正在使用SWIG从C ++代码生成Java代码。 One of the generated files has the following compilation error: 生成的文件之一具有以下编译错误:

acme/src/feir/api/java/abi.java:25: error: unreported exception result; must be caught or declared to be thrown
    delete();
          ^

Why would SWIG not generate the code to either catch or throw the exception? SWIG为什么不生成捕获或引发异常的代码?

This is the generated code: 这是生成的代码:

  protected void finalize() {
    delete();
  }

  public synchronized void delete() throws result {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        csfeJNI.delete_procedure_flags(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

您需要一堆:

%nojavaexception ~classname;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM