2
0
mirror of synced 2025-02-23 14:58:12 +00:00
mobile/bind/testdata/keywords.objc.m.golden
Elias Naur 89b8360218 bind: remove error wrappers to preserve error instance identity
CL 24800 changed the error representation from strings to objects.
However, since native errors types are not immediately compatible
across languages, wrapper types were introduced to bridge the gap.

This CL remove those wrappers and instead special case the error
proxy types to conform to their language error protocol.

Specifically:

 - The ObjC proxy for Go errors now extends NSError and calls
   initWithDomain to store the error message.
 - The Go proxy for ObjC NSError return the localizedDescription
    property for calls to Error.
 - The Java proxy for Go errors ow extends Exception and
   overrides getMessage() to return the error message.
 - The Go proxy for Java Exceptions returns getMessage whenever
   Error is called.

The end result is that error values behave more like normal objects
across the language boundary. In particular, instance identity is
now preserved: an error passed across the boundary and back will
result in the same instance.

There are two semantic changes that followed this change:

 - The domain for wrapped Go errors is now always "go".
   The domain wasn't useful before this CL: the domains were set to
   the package name of function or method where the error happened
   to cross the language boundary.
 - If a Go method that returns an error is implemented in ObjC, the
   implementation must now both return NO _and_ set the error result
   for the calling Go code to receive a non-nil error.
   Before this CL, because errors were always wrapped, a nil ObjC
   could be represented with a non-nil wrapper.

Change-Id: Idb415b6b13ecf79ccceb60f675059942bfc48fec
Reviewed-on: https://go-review.googlesource.com/29298
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-04 09:11:42 +00:00

663 lines
15 KiB
Plaintext

// Objective-C API for talking to keywords Go package.
// gobind -lang=objc keywords
//
// File is generated by gobind. Do not edit.
#include <Foundation/Foundation.h>
#include "seq.h"
#include "_cgo_export.h"
#include "GoKeywords.h"
@implementation GoKeywordsKeywordCaller {
}
- (instancetype)initWithRef:(id)ref {
self = [super init];
if (self) { __ref = ref; }
return self;
}
- (void)abstract {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Abstract(refnum);
}
- (void)assert {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Assert(refnum);
}
- (void)boolean {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Boolean(refnum);
}
- (void)break {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Break(refnum);
}
- (void)byte {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Byte(refnum);
}
- (void)case {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Case(refnum);
}
- (void)catch {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Catch(refnum);
}
- (void)char_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Char(refnum);
}
- (void)class {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Class(refnum);
}
- (void)const_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Const(refnum);
}
- (void)continue {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Continue(refnum);
}
- (void)default {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Default(refnum);
}
- (void)do {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Do(refnum);
}
- (void)double_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Double(refnum);
}
- (void)else {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Else(refnum);
}
- (void)enum {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Enum(refnum);
}
- (void)extends {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Extends(refnum);
}
- (void)false {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_False(refnum);
}
- (void)final {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Final(refnum);
}
- (void)finally {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Finally(refnum);
}
- (void)float_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Float(refnum);
}
- (void)for {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_For(refnum);
}
- (void)goto {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Goto(refnum);
}
- (void)if {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_If(refnum);
}
- (void)implements {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Implements(refnum);
}
- (void)import {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Import(refnum);
}
- (void)instanceof {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Instanceof(refnum);
}
- (void)int_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Int(refnum);
}
- (void)interface {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Interface(refnum);
}
- (void)long_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Long(refnum);
}
- (void)native {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Native(refnum);
}
- (void)new {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_New(refnum);
}
- (void)null {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Null(refnum);
}
- (void)package {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Package(refnum);
}
- (void)private {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Private(refnum);
}
- (void)protected {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Protected(refnum);
}
- (void)public {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Public(refnum);
}
- (void)return {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Return(refnum);
}
- (void)short_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Short(refnum);
}
- (void)static {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Static(refnum);
}
- (void)strictfp {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Strictfp(refnum);
}
- (void)super_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Super(refnum);
}
- (void)switch {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Switch(refnum);
}
- (void)synchronized {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Synchronized(refnum);
}
- (void)this {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_This(refnum);
}
- (void)throw {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Throw(refnum);
}
- (void)throws {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Throws(refnum);
}
- (void)transient {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Transient(refnum);
}
- (void)true {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_True(refnum);
}
- (void)try {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Try(refnum);
}
- (void)void_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Void(refnum);
}
- (void)volatile_ {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_Volatile(refnum);
}
- (void)while {
int32_t refnum = go_seq_go_to_refnum(self._ref);
proxykeywords_KeywordCaller_While(refnum);
}
@end
void cproxykeywords_KeywordCaller_Abstract(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o abstract];
}
}
void cproxykeywords_KeywordCaller_Assert(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o assert];
}
}
void cproxykeywords_KeywordCaller_Boolean(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o boolean];
}
}
void cproxykeywords_KeywordCaller_Break(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o break];
}
}
void cproxykeywords_KeywordCaller_Byte(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o byte];
}
}
void cproxykeywords_KeywordCaller_Case(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o case];
}
}
void cproxykeywords_KeywordCaller_Catch(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o catch];
}
}
void cproxykeywords_KeywordCaller_Char(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o char_];
}
}
void cproxykeywords_KeywordCaller_Class(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o class];
}
}
void cproxykeywords_KeywordCaller_Const(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o const_];
}
}
void cproxykeywords_KeywordCaller_Continue(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o continue];
}
}
void cproxykeywords_KeywordCaller_Default(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o default];
}
}
void cproxykeywords_KeywordCaller_Do(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o do];
}
}
void cproxykeywords_KeywordCaller_Double(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o double_];
}
}
void cproxykeywords_KeywordCaller_Else(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o else];
}
}
void cproxykeywords_KeywordCaller_Enum(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o enum];
}
}
void cproxykeywords_KeywordCaller_Extends(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o extends];
}
}
void cproxykeywords_KeywordCaller_False(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o false];
}
}
void cproxykeywords_KeywordCaller_Final(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o final];
}
}
void cproxykeywords_KeywordCaller_Finally(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o finally];
}
}
void cproxykeywords_KeywordCaller_Float(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o float_];
}
}
void cproxykeywords_KeywordCaller_For(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o for];
}
}
void cproxykeywords_KeywordCaller_Goto(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o goto];
}
}
void cproxykeywords_KeywordCaller_If(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o if];
}
}
void cproxykeywords_KeywordCaller_Implements(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o implements];
}
}
void cproxykeywords_KeywordCaller_Import(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o import];
}
}
void cproxykeywords_KeywordCaller_Instanceof(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o instanceof];
}
}
void cproxykeywords_KeywordCaller_Int(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o int_];
}
}
void cproxykeywords_KeywordCaller_Interface(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o interface];
}
}
void cproxykeywords_KeywordCaller_Long(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o long_];
}
}
void cproxykeywords_KeywordCaller_Native(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o native];
}
}
void cproxykeywords_KeywordCaller_New(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o new];
}
}
void cproxykeywords_KeywordCaller_Null(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o null];
}
}
void cproxykeywords_KeywordCaller_Package(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o package];
}
}
void cproxykeywords_KeywordCaller_Private(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o private];
}
}
void cproxykeywords_KeywordCaller_Protected(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o protected];
}
}
void cproxykeywords_KeywordCaller_Public(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o public];
}
}
void cproxykeywords_KeywordCaller_Return(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o return];
}
}
void cproxykeywords_KeywordCaller_Short(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o short_];
}
}
void cproxykeywords_KeywordCaller_Static(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o static];
}
}
void cproxykeywords_KeywordCaller_Strictfp(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o strictfp];
}
}
void cproxykeywords_KeywordCaller_Super(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o super_];
}
}
void cproxykeywords_KeywordCaller_Switch(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o switch];
}
}
void cproxykeywords_KeywordCaller_Synchronized(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o synchronized];
}
}
void cproxykeywords_KeywordCaller_This(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o this];
}
}
void cproxykeywords_KeywordCaller_Throw(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o throw];
}
}
void cproxykeywords_KeywordCaller_Throws(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o throws];
}
}
void cproxykeywords_KeywordCaller_Transient(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o transient];
}
}
void cproxykeywords_KeywordCaller_True(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o true];
}
}
void cproxykeywords_KeywordCaller_Try(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o try];
}
}
void cproxykeywords_KeywordCaller_Void(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o void_];
}
}
void cproxykeywords_KeywordCaller_Volatile(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o volatile_];
}
}
void cproxykeywords_KeywordCaller_While(int32_t refnum) {
@autoreleasepool {
GoKeywordsKeywordCaller* o = go_seq_objc_from_refnum(refnum);
[o while];
}
}
__attribute__((constructor)) static void init() {
init_seq();
}