MCPcopy Create free account
hub / github.com/golang/mobile / jniCallType

Method jniCallType

bind/genjava.go:1344–1382  ·  view source on GitHub ↗
(t types.Type)

Source from the content-addressed store, hash-verified

1342}
1343
1344func (g *JavaGen) jniCallType(t types.Type) string {
1345 switch t := types.Unalias(t).(type) {
1346 case *types.Basic:
1347 switch t.Kind() {
1348 case types.Bool, types.UntypedBool:
1349 return "Boolean"
1350 case types.Int:
1351 return "Long"
1352 case types.Int8, types.Uint8: // types.Byte
1353 return "Byte"
1354 case types.Int16:
1355 return "Short"
1356 case types.Int32, types.UntypedRune: // types.Rune
1357 return "Int"
1358 case types.Int64, types.UntypedInt:
1359 return "Long"
1360 case types.Float32:
1361 return "Float"
1362 case types.Float64, types.UntypedFloat:
1363 return "Double"
1364 case types.String, types.UntypedString:
1365 return "Object"
1366 default:
1367 g.errorf("unsupported basic type: %s", t)
1368 }
1369 case *types.Slice:
1370 return "Object"
1371 case *types.Pointer:
1372 if _, ok := types.Unalias(t.Elem()).(*types.Named); ok {
1373 return g.jniCallType(t.Elem())
1374 }
1375 g.errorf("unsupported pointer to type: %s", t)
1376 case *types.Named:
1377 return "Object"
1378 default:
1379 return "Object"
1380 }
1381 return "TODO"
1382}
1383
1384func (g *JavaGen) jniClassSigPrefix(pkg *types.Package) string {
1385 return strings.Replace(g.javaPkgName(pkg), ".", "/", -1) + "/"

Callers 1

Calls 1

errorfMethod · 0.45

Tested by

no test coverage detected