go jnitype 源码

  • 2022-07-15
  • 浏览 (899)

golang jnitype 代码

文件路径:/src/cmd/fix/jnitype.go

// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"go/ast"
)

func init() {
	register(jniFix)
}

var jniFix = fix{
	name:     "jni",
	date:     "2017-12-04",
	f:        jnifix,
	desc:     `Fixes initializers of JNI's jobject and subtypes`,
	disabled: false,
}

// Old state:
//
//	type jobject *_jobject
//
// New state:
//
//	type jobject uintptr
//
// and similar for subtypes of jobject.
// This fix finds nils initializing these types and replaces the nils with 0s.
func jnifix(f *ast.File) bool {
	return typefix(f, func(s string) bool {
		switch s {
		case "C.jobject":
			return true
		case "C.jclass":
			return true
		case "C.jthrowable":
			return true
		case "C.jstring":
			return true
		case "C.jarray":
			return true
		case "C.jbooleanArray":
			return true
		case "C.jbyteArray":
			return true
		case "C.jcharArray":
			return true
		case "C.jshortArray":
			return true
		case "C.jintArray":
			return true
		case "C.jlongArray":
			return true
		case "C.jfloatArray":
			return true
		case "C.jdoubleArray":
			return true
		case "C.jobjectArray":
			return true
		case "C.jweak":
			return true
		}
		return false
	})
}

相关信息

go 源码目录

相关文章

go buildtag 源码

go buildtag_test 源码

go cftype 源码

go cftype_test 源码

go context 源码

go context_test 源码

go doc 源码

go egltype 源码

go egltype_test 源码

go fix 源码

0  赞