Buggy code:
out ) ) + "]<seq2seq4repair_space>=<seq2seq4repair_space>{<seq2seq4repair_space>NULL<seq2seq4repair_space>};" ) ) ; out . println ( "static<seq2seq4repair_space>jfieldID<seq2seq4repair_space>JavaCPP_addressFID<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( "static<seq2seq4repair_space>jfieldID<seq2seq4repair_space>JavaCPP_positionFID<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( "static<seq2seq4repair_space>jfieldID<seq2seq4repair_space>JavaCPP_limitFID<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( "static<seq2seq4repair_space>jfieldID<seq2seq4repair_space>JavaCPP_capacityFID<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( "static<seq2seq4repair_space>jmethodID<seq2seq4repair_space>JavaCPP_initMID<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( "static<seq2seq4repair_space>jmethodID<seq2seq4repair_space>JavaCPP_arrayMID<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( "static<seq2seq4repair_space>jmethodID<seq2seq4repair_space>JavaCPP_toStringMID<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( ) ; out . println ( "static<seq2seq4repair_space>inline<seq2seq4repair_space>void<seq2seq4repair_space>JavaCPP_log(const<seq2seq4repair_space>char*<seq2seq4repair_space>fmt,<seq2seq4repair_space>...)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>va_list<seq2seq4repair_space>ap;" ) ; out . println ( "<seq2seq4repair_space>va_start(ap,<seq2seq4repair_space>fmt);" ) ; out . println ( "#ifdef<seq2seq4repair_space>ANDROID" ) ; out . println ( "<seq2seq4repair_space>__android_log_vprint(ANDROID_LOG_ERROR,<seq2seq4repair_space>\"javacpp\",<seq2seq4repair_space>fmt,<seq2seq4repair_space>ap);" ) ; out . println ( "#elif<seq2seq4repair_space>defined(__APPLE__)<seq2seq4repair_space>&&<seq2seq4repair_space>defined(__OBJC__)" ) ; out . println ( "<seq2seq4repair_space>NSLogv([NSString<seq2seq4repair_space>stringWithUTF8String:fmt],<seq2seq4repair_space>ap);" ) ; out . println ( "#else" ) ; out . println ( "<seq2seq4repair_space>vfprintf(stderr,<seq2seq4repair_space>fmt,<seq2seq4repair_space>ap);" ) ; out . println ( "<seq2seq4repair_space>fprintf(stderr,<seq2seq4repair_space>\"\\n\");" ) ; out . println ( "#endif" ) ; out . println ( "<seq2seq4repair_space>va_end(ap);" ) ; out . println ( "}" ) ; out . println ( ) ; out . println ( "static<seq2seq4repair_space>JavaCPP_noinline<seq2seq4repair_space>jclass<seq2seq4repair_space>JavaCPP_getClass(JNIEnv*<seq2seq4repair_space>env,<seq2seq4repair_space>int<seq2seq4repair_space>i)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(JavaCPP_classes[i]<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>&&<seq2seq4repair_space>env->PushLocalFrame(1)<seq2seq4repair_space>==<seq2seq4repair_space>0)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>jclass<seq2seq4repair_space>cls<seq2seq4repair_space>=<seq2seq4repair_space>env->FindClass(JavaCPP_classNames[i]);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(cls<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>||<seq2seq4repair_space>env->ExceptionCheck())<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_log(\"Error<seq2seq4repair_space>loading<seq2seq4repair_space>class<seq2seq4repair_space>%s.\",<seq2seq4repair_space>JavaCPP_classNames[i]);" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_classes[i]<seq2seq4repair_space>=<seq2seq4repair_space>(jclass)env->NewWeakGlobalRef(cls);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(JavaCPP_classes[i]<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>||<seq2seq4repair_space>env->ExceptionCheck())<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_log(\"Error<seq2seq4repair_space>creating<seq2seq4repair_space>global<seq2seq4repair_space>reference<seq2seq4repair_space>of<seq2seq4repair_space>class<seq2seq4repair_space>%s.\",<seq2seq4repair_space>JavaCPP_classNames[i]);" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>env->PopLocalFrame(NULL);" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>JavaCPP_classes[i];" ) ; out . println ( "}" ) ; out . println ( ) ; out . println ( "static<seq2seq4repair_space>JavaCPP_noinline<seq2seq4repair_space>jfieldID<seq2seq4repair_space>JavaCPP_getFieldID(JNIEnv*<seq2seq4repair_space>env,<seq2seq4repair_space>int<seq2seq4repair_space>i,<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>name,<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>sig)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>jclass<seq2seq4repair_space>cls<seq2seq4repair_space>=<seq2seq4repair_space>JavaCPP_getClass(env,<seq2seq4repair_space>i);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(cls<seq2seq4repair_space>==<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>jfieldID<seq2seq4repair_space>fid<seq2seq4repair_space>=<seq2seq4repair_space>env->GetFieldID(cls,<seq2seq4repair_space>name,<seq2seq4repair_space>sig);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(fid<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>||<seq2seq4repair_space>env->ExceptionCheck())<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_log(\"Error<seq2seq4repair_space>getting<seq2seq4repair_space>field<seq2seq4repair_space>ID<seq2seq4repair_space>of<seq2seq4repair_space>%s//%s\",<seq2seq4repair_space>JavaCPP_classNames[i],<seq2seq4repair_space>name);" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>fid;" ) ; out . println ( "}" ) ; out . println ( ) ; out . println ( "static<seq2seq4repair_space>JavaCPP_noinline<seq2seq4repair_space>jmethodID<seq2seq4repair_space>JavaCPP_getMethodID(JNIEnv*<seq2seq4repair_space>env,<seq2seq4repair_space>int<seq2seq4repair_space>i,<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>name,<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>sig)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>jclass<seq2seq4repair_space>cls<seq2seq4repair_space>=<seq2seq4repair_space>JavaCPP_getClass(env,<seq2seq4repair_space>i);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(cls<seq2seq4repair_space>==<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>jmethodID<seq2seq4repair_space>mid<seq2seq4repair_space>=<seq2seq4repair_space>env->GetMethodID(cls,<seq2seq4repair_space>name,<seq2seq4repair_space>sig);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(mid<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>||<seq2seq4repair_space>env->ExceptionCheck())<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_log(\"Error<seq2seq4repair_space>getting<seq2seq4repair_space>method<seq2seq4repair_space>ID<seq2seq4repair_space>of<seq2seq4repair_space>%s//%s\",<seq2seq4repair_space>JavaCPP_classNames[i],<seq2seq4repair_space>name);" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>mid;" ) ; out . println ( "}" ) ; out . println ( ) ; out . println ( "static<seq2seq4repair_space>JavaCPP_noinline<seq2seq4repair_space>jmethodID<seq2seq4repair_space>JavaCPP_getStaticMethodID(JNIEnv*<seq2seq4repair_space>env,<seq2seq4repair_space>int<seq2seq4repair_space>i,<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>name,<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>sig)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>jclass<seq2seq4repair_space>cls<seq2seq4repair_space>=<seq2seq4repair_space>JavaCPP_getClass(env,<seq2seq4repair_space>i);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(cls<seq2seq4repair_space>==<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>jmethodID<seq2seq4repair_space>mid<seq2seq4repair_space>=<seq2seq4repair_space>env->GetStaticMethodID(cls,<seq2seq4repair_space>name,<seq2seq4repair_space>sig);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(mid<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>||<seq2seq4repair_space>env->ExceptionCheck())<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_log(\"Error<seq2seq4repair_space>getting<seq2seq4repair_space>static<seq2seq4repair_space>method<seq2seq4repair_space>ID<seq2seq4repair_space>of<seq2seq4repair_space>%s//%s\",<seq2seq4repair_space>JavaCPP_classNames[i],<seq2seq4repair_space>name);" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>mid;" ) ; out . println ( "}" ) ; out . println ( ) ; out . println ( "static<seq2seq4repair_space>JavaCPP_noinline<seq2seq4repair_space>jobject<seq2seq4repair_space>JavaCPP_createPointer(JNIEnv*<seq2seq4repair_space>env,<seq2seq4repair_space>int<seq2seq4repair_space>i,<seq2seq4repair_space>jclass<seq2seq4repair_space>cls<seq2seq4repair_space>=<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(cls<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>&&<seq2seq4repair_space>(cls<seq2seq4repair_space>=<seq2seq4repair_space>JavaCPP_getClass(env,<seq2seq4repair_space>i))<seq2seq4repair_space>==<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(JavaCPP_haveAllocObject)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>env->AllocObject(cls);" ) ; out . println ( "<seq2seq4repair_space>}<seq2seq4repair_space>else<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>jmethodID<seq2seq4repair_space>mid<seq2seq4repair_space>=<seq2seq4repair_space>env->GetMethodID(cls,<seq2seq4repair_space>\"<init>\",<seq2seq4repair_space>\"()V\");" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(mid<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>||<seq2seq4repair_space>env->ExceptionCheck())<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_log(\"Error<seq2seq4repair_space>getting<seq2seq4repair_space>default<seq2seq4repair_space>constructor<seq2seq4repair_space>of<seq2seq4repair_space>%s,<seq2seq4repair_space>while<seq2seq4repair_space>VM<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>support<seq2seq4repair_space>AllocObject()\",<seq2seq4repair_space>JavaCPP_classNames[i]);" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>env->NewObject(cls,<seq2seq4repair_space>mid);" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "}" ) ; out . println ( ) ; out . println ( "static<seq2seq4repair_space>JavaCPP_noinline<seq2seq4repair_space>void<seq2seq4repair_space>JavaCPP_initPointer(JNIEnv*<seq2seq4repair_space>env,<seq2seq4repair_space>jobject<seq2seq4repair_space>obj,<seq2seq4repair_space>const<seq2seq4repair_space>void*<seq2seq4repair_space>ptr,<seq2seq4repair_space>int<seq2seq4repair_space>size,<seq2seq4repair_space>void<seq2seq4repair_space>(*deallocator)(void*))<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(deallocator<seq2seq4repair_space>!=<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>jvalue<seq2seq4repair_space>args[3];" ) ; out . println ( "<seq2seq4repair_space>args[0].j<seq2seq4repair_space>=<seq2seq4repair_space>ptr_to_jlong(ptr);" ) ; out . println ( "<seq2seq4repair_space>args[1].i<seq2seq4repair_space>=<seq2seq4repair_space>size;" ) ; out . println ( "<seq2seq4repair_space>args[2].j<seq2seq4repair_space>=<seq2seq4repair_space>ptr_to_jlong(deallocator);" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(JavaCPP_haveNonvirtual)<seq2seq4repair_space>{" ) ; out . println ( ( ( "<seq2seq4repair_space>env->CallNonvirtualVoidMethodA(obj,<seq2seq4repair_space>JavaCPP_getClass(env,<seq2seq4repair_space>" + ( jclasses . index ( Pointer . class ) ) ) + "),<seq2seq4repair_space>JavaCPP_initMID,<seq2seq4repair_space>args);" ) ) ; out . println ( "<seq2seq4repair_space>}<seq2seq4repair_space>else<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>env->CallVoidMethodA(obj,<seq2seq4repair_space>JavaCPP_initMID,<seq2seq4repair_space>args);" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>}<seq2seq4repair_space>else<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>env->SetLongField(obj,<seq2seq4repair_space>JavaCPP_addressFID,<seq2seq4repair_space>ptr_to_jlong(ptr));" ) ; out . println ( "<seq2seq4repair_space>env->SetIntField(obj,<seq2seq4repair_space>JavaCPP_limitFID,<seq2seq4repair_space>size);" ) ; out . println ( "<seq2seq4repair_space>env->SetIntField(obj,<seq2seq4repair_space>JavaCPP_capacityFID,<seq2seq4repair_space>size);" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "}" ) ; out . println ( ) ; out . println ( "class<seq2seq4repair_space>JavaCPP_hidden<seq2seq4repair_space>JavaCPP_exception<seq2seq4repair_space>:<seq2seq4repair_space>public<seq2seq4repair_space>std::exception<seq2seq4repair_space>{" ) ; out . println ( "public:" ) ; out . println ( "<seq2seq4repair_space>JavaCPP_exception(const<seq2seq4repair_space>char*<seq2seq4repair_space>str)<seq2seq4repair_space>throw()<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(str<seq2seq4repair_space>==<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>strcpy(msg,<seq2seq4repair_space>\"Unknown<seq2seq4repair_space>exception.\");" ) ; out . println ( "<seq2seq4repair_space>}<seq2seq4repair_space>else<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>strncpy(msg,<seq2seq4repair_space>str,<seq2seq4repair_space>sizeof(msg));" ) ; out . println ( "<seq2seq4repair_space>msg[sizeof(msg)<seq2seq4repair_space>-<seq2seq4repair_space>1]<seq2seq4repair_space>=<seq2seq4repair_space>0;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>virtual<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>what()<seq2seq4repair_space>const<seq2seq4repair_space>throw()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>msg;<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>char<seq2seq4repair_space>msg[1024];" ) ; out . println ( "};" ) ; out . println ( ) ; if ( handleExceptions ) { out . println ( "static<seq2seq4repair_space>JavaCPP_noinline<seq2seq4repair_space>jthrowable<seq2seq4repair_space>JavaCPP_handleException(JNIEnv*<seq2seq4repair_space>env,<seq2seq4repair_space>int<seq2seq4repair_space>i)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>jstring<seq2seq4repair_space>str<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>try<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>throw;" ) ; out . println ( "<seq2seq4repair_space>}<seq2seq4repair_space>catch<seq2seq4repair_space>(std::exception&<seq2seq4repair_space>e)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>str<seq2seq4repair_space>=<seq2seq4repair_space>env->NewStringUTF(e.what());" ) ; out . println ( "<seq2seq4repair_space>}<seq2seq4repair_space>catch<seq2seq4repair_space>(...)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>str<seq2seq4repair_space>=<seq2seq4repair_space>env->NewStringUTF(\"Unknown<seq2seq4repair_space>exception.\");" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>jmethodID<seq2seq4repair_space>mid<seq2seq4repair_space>=<seq2seq4repair_space>JavaCPP_getMethodID(env,<seq2seq4repair_space>i,<seq2seq4repair_space>\"<init>\",<seq2seq4repair_space>\"(Ljava//lang//String;)V\");" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(mid<seq2seq4repair_space>==<seq2seq4repair_space>NULL)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>NULL;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>(jthrowable)env->NewObject(JavaCPP_getClass(env,<seq2seq4repair_space>i),<seq2seq4repair_space>mid,<seq2seq4repair_space>str);" ) ; out . println ( "}" ) ; out . println ( ) ; } if ( defineAdapters ) { out . println ( "#include<seq2seq4repair_space><vector>" ) ; out . println ( "template<typename<seq2seq4repair_space>P,<seq2seq4repair_space>typename<seq2seq4repair_space>T<seq2seq4repair_space>=<seq2seq4repair_space>P><seq2seq4repair_space>class<seq2seq4repair_space>JavaCPP_hidden<seq2seq4repair_space>VectorAdapter<seq2seq4repair_space>{" ) ; out . println ( "public:" ) ; out . println ( "<seq2seq4repair_space>VectorAdapter(const<seq2seq4repair_space>P*<seq2seq4repair_space>ptr,<seq2seq4repair_space>typename<seq2seq4repair_space>std::vector<T>::size_type<seq2seq4repair_space>size)<seq2seq4repair_space>:<seq2seq4repair_space>ptr((P*)ptr),<seq2seq4repair_space>size(size)," ) ; out . println ( "<seq2seq4repair_space>vec2(ptr<seq2seq4repair_space>?<seq2seq4repair_space>std::vector<T>((P*)ptr,<seq2seq4repair_space>(P*)ptr<seq2seq4repair_space>+<seq2seq4repair_space>size)<seq2seq4repair_space>:<seq2seq4repair_space>std::vector<T>()),<seq2seq4repair_space>vec(vec2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>VectorAdapter(const<seq2seq4repair_space>std::vector<T>&<seq2seq4repair_space>vec)<seq2seq4repair_space>:<seq2seq4repair_space>ptr(0),<seq2seq4repair_space>size(0),<seq2seq4repair_space>vec2(vec),<seq2seq4repair_space>vec(vec2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>VectorAdapter(<seq2seq4repair_space>std::vector<T>&<seq2seq4repair_space>vec)<seq2seq4repair_space>:<seq2seq4repair_space>ptr(0),<seq2seq4repair_space>size(0),<seq2seq4repair_space>vec(vec)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>void<seq2seq4repair_space>assign(P*<seq2seq4repair_space>ptr,<seq2seq4repair_space>typename<seq2seq4repair_space>std::vector<T>::size_type<seq2seq4repair_space>size)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>this->ptr<seq2seq4repair_space>=<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>this->size<seq2seq4repair_space>=<seq2seq4repair_space>size;" ) ; out . println ( "<seq2seq4repair_space>vec.assign(ptr,<seq2seq4repair_space>ptr<seq2seq4repair_space>+<seq2seq4repair_space>size);" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>static<seq2seq4repair_space>void<seq2seq4repair_space>deallocate(void*<seq2seq4repair_space>ptr)<seq2seq4repair_space>{<seq2seq4repair_space>delete[]<seq2seq4repair_space>(P*)ptr;<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>P*()<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(vec.size()<seq2seq4repair_space>><seq2seq4repair_space>size)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>ptr<seq2seq4repair_space>=<seq2seq4repair_space>new<seq2seq4repair_space>(std::nothrow)<seq2seq4repair_space>P[vec.size()];" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(ptr)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>std::copy(vec.begin(),<seq2seq4repair_space>vec.end(),<seq2seq4repair_space>ptr);" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>size<seq2seq4repair_space>=<seq2seq4repair_space>vec.size();" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>const<seq2seq4repair_space>P*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>&vec[0];<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>std::vector<T>&()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>vec;<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>std::vector<T>*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>ptr<seq2seq4repair_space>?<seq2seq4repair_space>&vec<seq2seq4repair_space>:<seq2seq4repair_space>0;<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>P*<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>typename<seq2seq4repair_space>std::vector<T>::size_type<seq2seq4repair_space>size;" ) ; out . println ( "<seq2seq4repair_space>std::vector<T><seq2seq4repair_space>vec2;" ) ; out . println ( "<seq2seq4repair_space>std::vector<T>&<seq2seq4repair_space>vec;" ) ; out . println ( "};" ) ; out . println ( ) ; out . println ( "#include<seq2seq4repair_space><string>" ) ; out . println ( "class<seq2seq4repair_space>JavaCPP_hidden<seq2seq4repair_space>StringAdapter<seq2seq4repair_space>{" ) ; out . println ( "public:" ) ; out . println ( "<seq2seq4repair_space>StringAdapter(const<seq2seq4repair_space>char*<seq2seq4repair_space>ptr,<seq2seq4repair_space>size_t<seq2seq4repair_space>size)<seq2seq4repair_space>:<seq2seq4repair_space>ptr((char*)ptr),<seq2seq4repair_space>size(size)," ) ; out . println ( "<seq2seq4repair_space>str2(ptr<seq2seq4repair_space>?<seq2seq4repair_space>(char*)ptr<seq2seq4repair_space>:<seq2seq4repair_space>\"\"),<seq2seq4repair_space>str(str2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>StringAdapter(const<seq2seq4repair_space>signed<seq2seq4repair_space>char*<seq2seq4repair_space>ptr,<seq2seq4repair_space>size_t<seq2seq4repair_space>size)<seq2seq4repair_space>:<seq2seq4repair_space>ptr((char*)ptr),<seq2seq4repair_space>size(size)," ) ; out . println ( "<seq2seq4repair_space>str2(ptr<seq2seq4repair_space>?<seq2seq4repair_space>(char*)ptr<seq2seq4repair_space>:<seq2seq4repair_space>\"\"),<seq2seq4repair_space>str(str2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>StringAdapter(const<seq2seq4repair_space>unsigned<seq2seq4repair_space>char*<seq2seq4repair_space>ptr,<seq2seq4repair_space>size_t<seq2seq4repair_space>size)<seq2seq4repair_space>:<seq2seq4repair_space>ptr((char*)ptr),<seq2seq4repair_space>size(size)," ) ; out . println ( "<seq2seq4repair_space>str2(ptr<seq2seq4repair_space>?<seq2seq4repair_space>(char*)ptr<seq2seq4repair_space>:<seq2seq4repair_space>\"\"),<seq2seq4repair_space>str(str2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>StringAdapter(const<seq2seq4repair_space>std::string&<seq2seq4repair_space>str)<seq2seq4repair_space>:<seq2seq4repair_space>ptr(0),<seq2seq4repair_space>size(0),<seq2seq4repair_space>str2(str),<seq2seq4repair_space>str(str2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>StringAdapter(<seq2seq4repair_space>std::string&<seq2seq4repair_space>str)<seq2seq4repair_space>:<seq2seq4repair_space>ptr(0),<seq2seq4repair_space>size(0),<seq2seq4repair_space>str(str)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>void<seq2seq4repair_space>assign(char*<seq2seq4repair_space>ptr,<seq2seq4repair_space>size_t<seq2seq4repair_space>size)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>this->ptr<seq2seq4repair_space>=<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>this->size<seq2seq4repair_space>=<seq2seq4repair_space>size;" ) ; out . println ( "<seq2seq4repair_space>str.assign(ptr<seq2seq4repair_space>?<seq2seq4repair_space>ptr<seq2seq4repair_space>:<seq2seq4repair_space>\"\");" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>static<seq2seq4repair_space>void<seq2seq4repair_space>deallocate(void*<seq2seq4repair_space>ptr)<seq2seq4repair_space>{<seq2seq4repair_space>free(ptr);<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>char*()<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>const<seq2seq4repair_space>char*<seq2seq4repair_space>c_str<seq2seq4repair_space>=<seq2seq4repair_space>str.c_str();" ) ; out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(ptr<seq2seq4repair_space>==<seq2seq4repair_space>NULL<seq2seq4repair_space>||<seq2seq4repair_space>strcmp(c_str,<seq2seq4repair_space>ptr)<seq2seq4repair_space>!=<seq2seq4repair_space>0)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>ptr<seq2seq4repair_space>=<seq2seq4repair_space>strdup(c_str);" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>size<seq2seq4repair_space>=<seq2seq4repair_space>strlen(c_str)<seq2seq4repair_space>+<seq2seq4repair_space>1;" ) ; out . println ( "<seq2seq4repair_space>return<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>signed<seq2seq4repair_space>char*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>(signed<seq2seq4repair_space>char*)(operator<seq2seq4repair_space>char*)();<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>unsigned<seq2seq4repair_space>char*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>(unsigned<seq2seq4repair_space>char*)(operator<seq2seq4repair_space>char*)();<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>const<seq2seq4repair_space>char*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>str.c_str();<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>const<seq2seq4repair_space>signed<seq2seq4repair_space>char*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>(signed<seq2seq4repair_space>char*)str.c_str();<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>const<seq2seq4repair_space>unsigned<seq2seq4repair_space>char*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>(unsigned<seq2seq4repair_space>char*)str.c_str();<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>std::string&()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>str;<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>std::string*()<seq2seq4repair_space>{<seq2seq4repair_space>return<seq2seq4repair_space>ptr<seq2seq4repair_space>?<seq2seq4repair_space>&str<seq2seq4repair_space>:<seq2seq4repair_space>0;<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>char*<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>size_t<seq2seq4repair_space>size;" ) ; out . println ( "<seq2seq4repair_space>std::string<seq2seq4repair_space>str2;" ) ; out . println ( "<seq2seq4repair_space>std::string&<seq2seq4repair_space>str;" ) ; out . println ( "};" ) ; out . println ( ) ; out . println ( "#ifdef<seq2seq4repair_space>SHARED_PTR_NAMESPACE" ) ; out . println ( "template<class<seq2seq4repair_space>T><seq2seq4repair_space>class<seq2seq4repair_space>SharedPtrAdapter<seq2seq4repair_space>{" ) ; out . println ( "public:" ) ; out . println ( "<seq2seq4repair_space>SharedPtrAdapter(const<seq2seq4repair_space>T*<seq2seq4repair_space>ptr,<seq2seq4repair_space>int<seq2seq4repair_space>size)<seq2seq4repair_space>:<seq2seq4repair_space>ptr((T*)ptr),<seq2seq4repair_space>size(size),<seq2seq4repair_space>sharedPtr2((T*)ptr),<seq2seq4repair_space>sharedPtr(sharedPtr2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>SharedPtrAdapter(const<seq2seq4repair_space>SHARED_PTR_NAMESPACE::shared_ptr<T>&<seq2seq4repair_space>sharedPtr)<seq2seq4repair_space>:<seq2seq4repair_space>ptr(0),<seq2seq4repair_space>size(0),<seq2seq4repair_space>sharedPtr2(sharedPtr),<seq2seq4repair_space>sharedPtr(sharedPtr2)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>SharedPtrAdapter(<seq2seq4repair_space>SHARED_PTR_NAMESPACE::shared_ptr<T>&<seq2seq4repair_space>sharedPtr)<seq2seq4repair_space>:<seq2seq4repair_space>ptr(0),<seq2seq4repair_space>size(0),<seq2seq4repair_space>sharedPtr(sharedPtr)<seq2seq4repair_space>{<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>void<seq2seq4repair_space>assign(T*<seq2seq4repair_space>ptr,<seq2seq4repair_space>int<seq2seq4repair_space>size)<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>this->ptr<seq2seq4repair_space>=<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>this->size<seq2seq4repair_space>=<seq2seq4repair_space>size;" ) ; out . println ( "<seq2seq4repair_space>this->sharedPtr<seq2seq4repair_space>=<seq2seq4repair_space>ptr;" ) ; out . println ( "<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>static<seq2seq4repair_space>void<seq2seq4repair_space>deallocate(void*<seq2seq4repair_space>ptr)<seq2seq4repair_space>{<seq2seq4repair_space>SHARED_PTR_NAMESPACE::shared_ptr<T><seq2seq4repair_space>deallocator((T*)ptr);<seq2seq4repair_space>}" ) ; out . println ( "<seq2seq4repair_space>operator<seq2seq4repair_space>T*()<seq2seq4repair_space>{" ) ; out . println ( "<seq2seq4repair_space>////<seq2seq4repair_space>take<seq2seq4repair_space>ownership,<seq2seq4repair_space>if<seq2seq4repair_space>unique" ) ; out . println ( "<seq2seq4repair_space>ptr<seq2seq4repair_space>=<seq2seq4repair_space>sharedPtr.get();" ) ; <START_BUG> out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(sharedPtr.unique())<seq2seq4repair_space>{" ) ; <END_BUG>

Fix:
out . println ( "<seq2seq4repair_space>if<seq2seq4repair_space>(sharedPtr.unique()<seq2seq4repair_space>&&<seq2seq4repair_space>&sharedPtr<seq2seq4repair_space>==<seq2seq4repair_space>&sharedPtr2)<seq2seq4repair_space>{" ) ;