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

Method jniSigType

bind/genjava.go:1388–1432  ·  view source on GitHub ↗
(T types.Type)

Source from the content-addressed store, hash-verified

1386}
1387
1388func (g *JavaGen) jniSigType(T types.Type) string {
1389 if isErrorType(T) {
1390 return "Ljava/lang/Exception;"
1391 }
1392 switch T := types.Unalias(T).(type) {
1393 case *types.Basic:
1394 switch T.Kind() {
1395 case types.Bool, types.UntypedBool:
1396 return "Z"
1397 case types.Int:
1398 return "J"
1399 case types.Int8:
1400 return "B"
1401 case types.Int16:
1402 return "S"
1403 case types.Int32, types.UntypedRune: // types.Rune
1404 return "I"
1405 case types.Int64, types.UntypedInt:
1406 return "J"
1407 case types.Uint8: // types.Byte
1408 return "B"
1409 case types.Float32:
1410 return "F"
1411 case types.Float64, types.UntypedFloat:
1412 return "D"
1413 case types.String, types.UntypedString:
1414 return "Ljava/lang/String;"
1415 default:
1416 g.errorf("unsupported basic type: %s", T)
1417 return "TODO"
1418 }
1419 case *types.Slice:
1420 return "[" + g.jniSigType(T.Elem())
1421 case *types.Pointer:
1422 if _, ok := types.Unalias(T.Elem()).(*types.Named); ok {
1423 return g.jniSigType(T.Elem())
1424 }
1425 g.errorf("unsupported pointer to type: %s", T)
1426 case *types.Named:
1427 return "L" + g.jniClassSigPrefix(T.Obj().Pkg()) + g.javaTypeName(T.Obj().Name()) + ";"
1428 default:
1429 g.errorf("unsupported jniType: %#+v, %s\n", T, T)
1430 }
1431 return "TODO"
1432}
1433
1434func (g *JavaGen) GenC() error {
1435 var pkgName, pkgPath string

Callers 1

GenCMethod · 0.95

Calls 4

jniClassSigPrefixMethod · 0.95
javaTypeNameMethod · 0.95
isErrorTypeFunction · 0.85
errorfMethod · 0.45

Tested by

no test coverage detected