github.com/likebike/go--@v0.0.0-20190911215757-0bd925d16e96/go/misc/cgo/test/test22906.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build cgo
     6  
     7  package cgotest
     8  
     9  /*
    10  
    11  // It's going to be hard to include a whole real JVM to test this.
    12  // So we'll simulate a really easy JVM using just the parts we need.
    13  
    14  // This is the relevant part of jni.h.
    15  
    16  struct _jobject;
    17  
    18  typedef struct _jobject *jobject;
    19  typedef jobject jclass;
    20  typedef jobject jthrowable;
    21  typedef jobject jstring;
    22  typedef jobject jarray;
    23  typedef jarray jbooleanArray;
    24  typedef jarray jbyteArray;
    25  typedef jarray jcharArray;
    26  typedef jarray jshortArray;
    27  typedef jarray jintArray;
    28  typedef jarray jlongArray;
    29  typedef jarray jfloatArray;
    30  typedef jarray jdoubleArray;
    31  typedef jarray jobjectArray;
    32  
    33  typedef jobject jweak;
    34  
    35  // Note: jvalue is already a non-pointer type due to it being a C union.
    36  
    37  */
    38  import "C"
    39  import (
    40  	"testing"
    41  )
    42  
    43  func test22906(t *testing.T) {
    44  	var x1 C.jobject = 0 // Note: 0, not nil. That makes sure we use uintptr for these types.
    45  	_ = x1
    46  	var x2 C.jclass = 0
    47  	_ = x2
    48  	var x3 C.jthrowable = 0
    49  	_ = x3
    50  	var x4 C.jstring = 0
    51  	_ = x4
    52  	var x5 C.jarray = 0
    53  	_ = x5
    54  	var x6 C.jbooleanArray = 0
    55  	_ = x6
    56  	var x7 C.jbyteArray = 0
    57  	_ = x7
    58  	var x8 C.jcharArray = 0
    59  	_ = x8
    60  	var x9 C.jshortArray = 0
    61  	_ = x9
    62  	var x10 C.jintArray = 0
    63  	_ = x10
    64  	var x11 C.jlongArray = 0
    65  	_ = x11
    66  	var x12 C.jfloatArray = 0
    67  	_ = x12
    68  	var x13 C.jdoubleArray = 0
    69  	_ = x13
    70  	var x14 C.jobjectArray = 0
    71  	_ = x14
    72  	var x15 C.jweak = 0
    73  	_ = x15
    74  }