embeddedJavaClasses returns the possible empty list of Java types embedded in the given struct type.
(t *types.Struct)
| 1650 | // embeddedJavaClasses returns the possible empty list of Java types embedded |
| 1651 | // in the given struct type. |
| 1652 | func 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 | |
| 1671 | func classNameFor(t types.Type) string { |
| 1672 | obj := t.(*types.Named).Obj() |
no test coverage detected