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

Function embeddedJavaClasses

bind/genjava.go:1652–1669  ·  view source on GitHub ↗

embeddedJavaClasses returns the possible empty list of Java types embedded in the given struct type.

(t *types.Struct)

Source from the content-addressed store, hash-verified

1650// embeddedJavaClasses returns the possible empty list of Java types embedded
1651// in the given struct type.
1652func embeddedJavaClasses(t *types.Struct) []string {
1653 clsSet := make(map[string]struct{})
1654 var classes []string
1655 for i := 0; i < t.NumFields(); i++ {
1656 f := t.Field(i)
1657 if !f.Exported() {
1658 continue
1659 }
1660 if t := f.Type(); isJavaType(t) {
1661 cls := classNameFor(t)
1662 if _, exists := clsSet[cls]; !exists {
1663 clsSet[cls] = struct{}{}
1664 classes = append(classes, cls)
1665 }
1666 }
1667 }
1668 return classes
1669}
1670
1671func classNameFor(t types.Type) string {
1672 obj := t.(*types.Named).Obj()

Callers 1

InitMethod · 0.85

Calls 3

isJavaTypeFunction · 0.85
classNameForFunction · 0.85
TypeMethod · 0.80

Tested by

no test coverage detected