bind: use 0 instead of nil for the jclass zero value

Go 1.10 was supposed to change the jclass JNI type to map to Go
uintptr, but failed to map the Android NDK definition until
recently.

There was a single instance in the reverse binding generator that
compared jclass values to nil. Change it to use 0 and cast the
jclass value to uintptr to ensure compatibility with older Go
releases.

Change-Id: Ifa22ed2db556220b7dfd0076b004bd8930219e08
Reviewed-on: https://go-review.googlesource.com/124915
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/bind/genclasses.go b/bind/genclasses.go
index a606f10..a9bfa82 100644
--- a/bind/genclasses.go
+++ b/bind/genclasses.go
@@ -539,7 +539,8 @@
 	g.Printf("cls := C.CString(%q)\n", strings.Replace(cls.FindName, ".", "/", -1))
 	g.Printf("clazz := C.go_seq_find_class(cls)\n")
 	g.Printf("C.free(unsafe.Pointer(cls))\n")
-	g.Printf("if clazz == nil {\n")
+	// Before Go 1.11 clazz was a pointer value, an uintptr after.
+	g.Printf("if uintptr(clazz) == 0 {\n")
 	g.Printf("	return\n")
 	g.Printf("}\n")
 	g.Printf("class_%s = clazz\n", cls.JNIName)
diff --git a/bind/testdata/classes.go.golden b/bind/testdata/classes.go.golden
index c90663d..8324924 100644
--- a/bind/testdata/classes.go.golden
+++ b/bind/testdata/classes.go.golden
@@ -624,7 +624,7 @@
 	cls := C.CString("java/lang/Runnable")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Runnable = clazz
@@ -663,7 +663,7 @@
 	cls := C.CString("java/io/InputStream")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_io_InputStream = clazz
@@ -761,7 +761,7 @@
 	cls := C.CString("java/util/concurrent/Future")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_concurrent_Future = clazz
@@ -843,7 +843,7 @@
 	cls := C.CString("java/lang/Object")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Object = clazz
@@ -884,7 +884,7 @@
 	cls := C.CString("java/util/concurrent/TimeUnit")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_concurrent_TimeUnit = clazz
@@ -925,7 +925,7 @@
 	cls := C.CString("java/util/Spliterators")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_Spliterators = clazz
@@ -1087,7 +1087,7 @@
 	cls := C.CString("java/lang/System")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_System = clazz
@@ -1152,7 +1152,7 @@
 	cls := C.CString("java/Future")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_Future = clazz
@@ -1302,7 +1302,7 @@
 	cls := C.CString("java/InputStream")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_InputStream = clazz
@@ -1484,7 +1484,7 @@
 	cls := C.CString("java/Object")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_Object = clazz
@@ -1552,7 +1552,7 @@
 	cls := C.CString("java/Runnable")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_Runnable = clazz
@@ -1616,7 +1616,7 @@
 	cls := C.CString("java/util/Iterator")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_Iterator = clazz
@@ -1641,7 +1641,7 @@
 	cls := C.CString("java/util/Spliterator")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_Spliterator = clazz
@@ -1666,7 +1666,7 @@
 	cls := C.CString("java/util/PrimitiveIterator$OfInt")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_PrimitiveIterator_OfInt = clazz
@@ -1691,7 +1691,7 @@
 	cls := C.CString("java/util/Spliterator$OfInt")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_Spliterator_OfInt = clazz
@@ -1716,7 +1716,7 @@
 	cls := C.CString("java/util/PrimitiveIterator$OfLong")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_PrimitiveIterator_OfLong = clazz
@@ -1741,7 +1741,7 @@
 	cls := C.CString("java/util/Spliterator$OfLong")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_Spliterator_OfLong = clazz
@@ -1766,7 +1766,7 @@
 	cls := C.CString("java/util/PrimitiveIterator$OfDouble")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_PrimitiveIterator_OfDouble = clazz
@@ -1791,7 +1791,7 @@
 	cls := C.CString("java/util/Spliterator$OfDouble")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_util_Spliterator_OfDouble = clazz
@@ -1816,7 +1816,7 @@
 	cls := C.CString("java/io/Console")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_io_Console = clazz
diff --git a/bind/testdata/java.go.golden b/bind/testdata/java.go.golden
index 1bcd9a8..9271eaf 100644
--- a/bind/testdata/java.go.golden
+++ b/bind/testdata/java.go.golden
@@ -271,7 +271,7 @@
 	cls := C.CString("java/lang/Float")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Float = clazz
@@ -312,7 +312,7 @@
 	cls := C.CString("java/lang/Long")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Long = clazz
@@ -353,7 +353,7 @@
 	cls := C.CString("java/lang/Object")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Object = clazz
@@ -394,7 +394,7 @@
 	cls := C.CString("java/lang/Runnable")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Runnable = clazz
@@ -419,7 +419,7 @@
 	cls := C.CString("java/lang/Character")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Character = clazz
@@ -460,7 +460,7 @@
 	cls := C.CString("java/lang/Character$Subset")
 	clazz := C.go_seq_find_class(cls)
 	C.free(unsafe.Pointer(cls))
-	if clazz == nil {
+	if uintptr(clazz) == 0 {
 		return
 	}
 	class_java_lang_Character_Subset = clazz