Help us shape the future of Go! Take the 2026 Go Developer Survey

validate

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2026 License: CC0-1.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinTypes = map[string]ResolvedType{
	"void":                 &VoidType{},
	"boolean":              &PrimitiveType{Name: "boolean"},
	"byte":                 &PrimitiveType{Name: "byte"},
	"char":                 &PrimitiveType{Name: "char"},
	"int":                  &PrimitiveType{Name: "int"},
	"long":                 &PrimitiveType{Name: "long"},
	"float":                &PrimitiveType{Name: "float"},
	"double":               &PrimitiveType{Name: "double"},
	"String":               &StringType{},
	"IBinder":              &BinderType{},
	"ParcelFileDescriptor": &FileDescriptorType{},
}

BuiltinTypes maps AIDL built-in type names to their ResolvedType.

Functions

func IsBuiltin

func IsBuiltin(name string) bool

IsBuiltin returns true if the type name is a built-in AIDL type.

func Validate

func Validate(
	doc *parser.Document,
	lookupType func(qualifiedName string) bool,
) []error

Validate performs semantic validation on a parsed document. It checks that:

  • All type references can be resolved (are built-in or found by lookupType)
  • Parameter directions are valid (in/out/inout on interface methods)
  • Oneway methods return void and have only 'in' parameters
  • Enum backing types are valid primitives

Types

type ArrayType

type ArrayType struct {
	ElementType ResolvedType
}

ArrayType represents T[].

func (*ArrayType) String

func (t *ArrayType) String() string

type BinderType

type BinderType struct{}

BinderType represents IBinder.

func (*BinderType) String

func (t *BinderType) String() string

type EnumType

type EnumType struct {
	QualifiedName string
}

EnumType represents a reference to an AIDL enum.

func (*EnumType) String

func (t *EnumType) String() string

type FileDescriptorType

type FileDescriptorType struct{}

FileDescriptorType represents ParcelFileDescriptor.

func (*FileDescriptorType) String

func (t *FileDescriptorType) String() string

type InterfaceType

type InterfaceType struct {
	QualifiedName string
}

InterfaceType represents a reference to an AIDL interface.

func (*InterfaceType) String

func (t *InterfaceType) String() string

type ListType

type ListType struct {
	ElementType ResolvedType
}

ListType represents List<T>.

func (*ListType) String

func (t *ListType) String() string

type MapType

type MapType struct {
	KeyType   ResolvedType
	ValueType ResolvedType
}

MapType represents Map<K,V>.

func (*MapType) String

func (t *MapType) String() string

type NullableType

type NullableType struct {
	Inner ResolvedType
}

NullableType wraps a type to indicate @nullable.

func (*NullableType) String

func (t *NullableType) String() string

type ParcelableType

type ParcelableType struct {
	QualifiedName string
}

ParcelableType represents a reference to an AIDL parcelable.

func (*ParcelableType) String

func (t *ParcelableType) String() string

type PrimitiveType

type PrimitiveType struct {
	Name string
}

PrimitiveType represents a built-in primitive (int, long, float, double, boolean, byte, char).

func (*PrimitiveType) String

func (t *PrimitiveType) String() string

type ResolvedType

type ResolvedType interface {
	String() string
	// contains filtered or unexported methods
}

ResolvedType represents a fully resolved AIDL type.

type StringType

type StringType struct {
	UTF8 bool // true if @utf8InCpp annotated
}

StringType represents the AIDL String type (UTF-16 or UTF-8).

func (*StringType) String

func (t *StringType) String() string

type UnionType

type UnionType struct {
	QualifiedName string
}

UnionType represents a reference to an AIDL union.

func (*UnionType) String

func (t *UnionType) String() string

type ValidationError

type ValidationError struct {
	Pos     parser.Position
	Message string
}

ValidationError represents a semantic validation error.

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap returns nil — ValidationError is a leaf error with no wrapped cause.

type VoidType

type VoidType struct{}

VoidType represents the void return type.

func (*VoidType) String

func (t *VoidType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL