Documentation
¶
Overview ¶
Package jrt hand-writes small Go stand-ins for the java.lang/java.util base types that some translated SWT classes extend (SWTException/SWTError extend RuntimeException/Error, TypedEvent extends EventObject) but that have no Java source for j2go to translate - see tooling/j2go/README.md "Manual superclass embedding". Registered via the same Manual.isManual/manual.txt mechanism as Monitor/RoundingMode.
Package jrt: java.lang.reflect subset ControlExample's Set/Get dialog needs (Tab.java's getValue/setValue/getReturnType/parameterInfo) - see tooling/j2go/README.md "Round 10 reflection". java.lang.Class itself stays reflect.Type (Manual.java); this file adds getMethod/invoke/getReturnType/isArray/getComponentType/getName on top of it.
The obvious implementation - resolve the Java method name to a Go name, then call reflect.Type.MethodByName/Method(i) - is deliberately not used: the Go linker sees any static call to those two APIs and, unable to tell which name will be looked up at runtime, keeps every exported method of every reflect-reachable type in the binary (defeats dead-code elimination program-wide). Instead j2go generates package swt/swtreflect, whose init() registers each public method of the translated widgets-package classes as a closure naming its concrete types statically. Only programs importing swtreflect keep those methods (README "Round 11"). Inherited (promoted) methods are found by walking the embedding chain at lookup time (parentOf) and dispatched through Narrow, both using only struct-field reflection (Field/ Addr/Interface), never Method/MethodByName.
Index ¶
- Constants
- Variables
- func AddSuppressed(e, s error)
- func ArgAs[T any](a any) T
- func ArraysBinarySearch[T cmp.Ordered](a []T, key T) int32
- func ArraysFill[T any](a []T, v T)
- func ArraysFillRange[T any](a []T, from, to int32, v T)
- func ArraysSortComparator[T any](a []T, c func(T, T) int32)
- func AsWriter(s OutputStream) io.Writer
- func AssertIsLegal(expr bool, msg ...string) bool
- func AssertIsNotNull(object any, msg ...string)
- func AssertIsTrue(expr bool, msg ...string) bool
- func Cast[T any](x any) T
- func CharAt(s string, i int32) uint16
- func ClassCast(t reflect.Type, o any) any
- func ClassForName(name string) reflect.Type
- func ClassIsInstance(t reflect.Type, o any) bool
- func ClassName(t reflect.Type) string
- func CollectionsMax[T any](c *List, cmp func(T, T) int32) T
- func CollectionsSort(l *List, comparator ...any)
- func CompareTo(a, b any) int32
- func ComparingInt[T any](key func(T) int32) func(T, T) int32
- func CopyOf[T any](a []T, n int32) []T
- func CurrentThread() any
- func CurrentTimeMillis() int64
- func Directionality(c rune) int8
- func DoubleCompare(a, b float64) int32
- func DoubleEquals(a float64, b any) bool
- func DoubleHashCode(d float64) int32
- func DoubleToInt(d float64) int32
- func DoubleToString(f float64) string
- func FilesCopy(src any, dst *Path, _ []any) int64
- func FilesDelete(p *Path)
- func FilesDeleteIfExists(p *Path) bool
- func FilesIsRegularFile(p *Path, _ []any) bool
- func FilesIsSymbolicLink(p *Path) bool
- func FilesReadAllBytes(p *Path) []int8
- func Fill[T any](a []T, v T)
- func Format(format string, args []any) string
- func FromChars(u []uint16) string
- func GC()
- func GetBytes(s string) []int8
- func GetChars(s string, srcBegin, srcEnd int32, dst []uint16, dstBegin int32)
- func GetInteger(key string, def int32) int32
- func GetProperty(key, def string) string
- func Getenv(name string) string
- func Goid() uint64
- func HashCodeOf(x any) int32
- func IdentityHashCode(x any) int32
- func Ignore(...any)
- func IndexFrom(s, needle string, from int32) int32
- func Interrupted() bool
- func IsAssignableFrom(to, from reflect.Type) bool
- func IsHighSurrogate(c rune) bool
- func IsNil(v any) bool
- func JavaVersionFeature(version any) int32
- func LastIndexOf(s, needle string) int32
- func LineSeparator() string
- func LocaleLanguage(locale any) string
- func Matches(s, regex string) bool
- func MessageFormatFormat(pattern string, args []any) string
- func MonitorEnter()
- func MonitorExit()
- func MonitorNotifyAll()
- func MonitorWait()
- func Narrow[T any](target any) T
- func NullToEmpty(s string) string
- func NumberDouble(n any) float64
- func ObjectsEquals(a, b any) bool
- func ObjectsHash(values ...any) int32
- func ParseDouble(s string) float64
- func ParseFloat(s string) float32
- func ParseInt(s string) int32
- func ParseIntRadix(s string, radix int32) int32
- func ParseLong(s string) int64
- func PeekBytes(s InputStream, n int) (head []byte, ok bool)
- func PrintStreamFlush(s PrintStream)
- func ReadAllBytes(s InputStream) []int8
- func RegisterClassPackage(goName, javaPackage string)
- func RegisterMethod(t reflect.Type, javaName string, paramTypes []reflect.Type, ...)
- func RegisterResources(f fs.FS)
- func RemoveTempDir(p *Path)
- func ReplaceAll(s, regex, repl string) string
- func ReplaceFirst(s, regex, repl string) string
- func SafeRunnerRun(r ISafeRunnable)
- func SetErr(s PrintStream)
- func SetOut(s PrintStream)
- func SetProperty(key, value string) string
- func Sleep(millis int64)
- func Split(s, regex string) []string
- func StringCompareTo(a, b string) int32
- func StringFromBytes(b []int8) string
- func StringHashCode(s string) int32
- func StringLength(s string) int32
- func Substring(s string, start, end int32) string
- func TakeScreenshot(testClass any, name string) string
- func ThenComparing[T any](first func(T, T) int32, next any) func(T, T) int32
- func ThreadIsAlive(t any) bool
- func ThreadJoin(t any)
- func ThreadStart(t any)
- func ToChars(s string) []uint16
- func ToLowerCase(s string) string
- func ToSlice[T any](l *List) []T
- func ToUpperCase(s string) string
- func URLDecoderDecode(s string, _ *Charset) string
- func URLEncoderEncode(s string, _ *Charset) string
- func ValidUTF8(s string) string
- func WriteBytes(o OutputStream, b []int8)
- func Yield()
- type Assert
- type AssertionFailedException
- type AtomicBoolean
- type AtomicInteger
- func (a *AtomicInteger) AddAndGet(d int32) int32
- func (a *AtomicInteger) CompareAndSet(expected, v int32) bool
- func (a *AtomicInteger) DecrementAndGet() int32
- func (a *AtomicInteger) Get() int32
- func (a *AtomicInteger) GetAndAdd(d int32) int32
- func (a *AtomicInteger) GetAndIncrement() int32
- func (a *AtomicInteger) GetAndSet(v int32) int32
- func (a *AtomicInteger) GetPlain() int32
- func (a *AtomicInteger) IncrementAndGet() int32
- func (a *AtomicInteger) IntValue() int32
- func (a *AtomicInteger) Set(v int32)
- func (a *AtomicInteger) SetPlain(v int32)
- type AtomicIntegerArray
- type AtomicLong
- func (a *AtomicLong) AddAndGet(d int64) int64
- func (a *AtomicLong) CompareAndSet(expected, v int64) bool
- func (a *AtomicLong) DecrementAndGet() int64
- func (a *AtomicLong) Get() int64
- func (a *AtomicLong) GetAndAdd(d int64) int64
- func (a *AtomicLong) GetAndIncrement() int64
- func (a *AtomicLong) GetAndSet(v int64) int64
- func (a *AtomicLong) GetPlain() int64
- func (a *AtomicLong) IncrementAndGet() int64
- func (a *AtomicLong) LongValue() int64
- func (a *AtomicLong) Set(v int64)
- func (a *AtomicLong) SetPlain(v int64)
- type AtomicReference
- type AtomicReferenceArray
- type AttributedCharacterIterator
- func (it *AttributedCharacterIterator) Current() uint16
- func (it *AttributedCharacterIterator) First() uint16
- func (it *AttributedCharacterIterator) GetAttributes() *Map
- func (it *AttributedCharacterIterator) GetRunLimit() int32
- func (it *AttributedCharacterIterator) GetRunStart() int32
- func (it *AttributedCharacterIterator) Next() uint16
- func (it *AttributedCharacterIterator) SetIndex(i int32) uint16
- type BufferedReader
- type ByteArrayInputStream
- type ByteArrayOutputStream
- func (s *ByteArrayOutputStream) Close()
- func (s *ByteArrayOutputStream) Flush()
- func (s *ByteArrayOutputStream) Size() int32
- func (s *ByteArrayOutputStream) ToByteArray() []int8
- func (s *ByteArrayOutputStream) ToString(charset ...any) string
- func (s *ByteArrayOutputStream) Write(b int32)
- func (s *ByteArrayOutputStream) WriteRange(b []int8, off, length int32)
- type Calendar
- func (c *Calendar) Clone() any
- func (c *Calendar) Get(field int32) int32
- func (c *Calendar) GetActualMaximum(field int32) int32
- func (c *Calendar) GetActualMinimum(field int32) int32
- func (c *Calendar) GetDisplayNames(field, style int32, locale any) *Map
- func (c *Calendar) GetMaximum(field int32) int32
- func (c *Calendar) GetMinimum(field int32) int32
- func (c *Calendar) GetTime() *Date
- func (c *Calendar) Roll(field, amount int32)
- func (c *Calendar) Set(a ...int32)
- func (c *Calendar) SetTime(d *Date)
- type CapturedStream
- type Charset
- type Collections
- type Collector
- type CompletableFuture
- func (f *CompletableFuture) Complete(v any) bool
- func (f *CompletableFuture) Get() any
- func (f *CompletableFuture) IsCancelled() bool
- func (f *CompletableFuture) IsCompletedExceptionally() bool
- func (f *CompletableFuture) IsDone() bool
- func (f *CompletableFuture) ThenAccept(fn func(any)) *CompletableFuture
- func (f *CompletableFuture) ThenRunAsync(r Runnable, executor any) *CompletableFuture
- type CoreException
- type CountDownLatch
- type DataInputStream
- type DataOutputStream
- type Date
- type DateFormat
- type DateFormatField
- type DateFormatSymbols
- type Duration
- type EventObject
- type Executor
- type Field
- type FieldPosition
- type File
- type FileInputStream
- type FileOutputStream
- type FileReader
- type FuncInputStream
- type IOException
- type IProgressMonitor
- type ISafeRunnable
- type IStatus
- type IllegalArgumentException
- type IndexOutOfBoundsException
- type InputStream
- type InputStreamReader
- type Instant
- type InterruptedException
- type InvocationTargetException
- type Iterator
- type JavaError
- type List
- func ArraysAsList(array any) *List
- func CollectionsEmptySet() *List
- func CollectionsSingleton(v any) *List
- func CollectionsSynchronizedList(l *List) *List
- func CollectionsSynchronizedSet(l *List) *List
- func CollectionsUnmodifiableList(l *List) *List
- func IntStreamOf(values ...int32) *List
- func IntStreamRange(from, to int32) *List
- func ListCopyOf(l *List) *List
- func ListOf(elems ...any) *List
- func NewList(arg ...any) *List
- func StringChars(s string) *List
- func (l *List) Add(a ...any) bool
- func (l *List) AddAll(other *List) bool
- func (l *List) AllMatch(pred any) bool
- func (l *List) AnyMatch(pred any) bool
- func (l *List) Clear()
- func (l *List) Collect(c *Collector) any
- func (l *List) CollectInto(supplier, accumulator any) any
- func (l *List) Contains(v any) bool
- func (l *List) Count() int64
- func (l *List) Distinct() *List
- func (l *List) Equals(o any) bool
- func (l *List) Filter(pred any) *List
- func (l *List) FlatMapToInt(fn any) *List
- func (l *List) ForEach(action any)
- func (l *List) ForEachOrdered(action any)
- func (l *List) Get(i int32) any
- func (l *List) GetFirst() any
- func (l *List) GetLast() any
- func (l *List) IndexOf(v any) int32
- func (l *List) IsEmpty() bool
- func (l *List) Iterator() *Iterator
- func (l *List) Map(fn any) *List
- func (l *List) MapToInt(fn any) *List
- func (l *List) MapToObj(fn any) *List
- func (l *List) NoneMatch(pred any) bool
- func (l *List) Peek() any
- func (l *List) Poll() any
- func (l *List) Remove(v any) bool
- func (l *List) RemoveAll(other *List) bool
- func (l *List) RemoveFirst() any
- func (l *List) RemoveIf(predicate any) bool
- func (l *List) Size() int32
- func (l *List) Skip(n int64) *List
- func (l *List) Sorted() *List
- func (l *List) Stream() *List
- func (l *List) String() string
- func (l *List) ToArray() []any
- func (l *List) ToList() *List
- type ListenerList
- type Locale
- type Map
- func (m *Map) Clear()
- func (m *Map) Compute(k any, fn any) any
- func (m *Map) ComputeIfAbsent(k any, fn any) any
- func (m *Map) ContainsKey(k any) bool
- func (m *Map) EntrySet() *List
- func (m *Map) ForEach(action any)
- func (m *Map) Get(k any) any
- func (m *Map) GetProperty(key string) string
- func (m *Map) IsEmpty() bool
- func (m *Map) KeySet() *List
- func (m *Map) Load(in InputStream)
- func (m *Map) Put(k, v any) any
- func (m *Map) Remove(k any) any
- func (m *Map) Size() int32
- func (m *Map) Store(out OutputStream, comments string)
- func (m *Map) Values() *List
- type MapEntry
- type Matcher
- type MessageFormat
- type Method
- type MethodEntry
- type MissingResourceException
- type NoSuchElementException
- type NoSuchFieldException
- type NoSuchMethodException
- type NullPointerException
- type NullProgressMonitor
- func (m *NullProgressMonitor) BeginTask(string, int32)
- func (m *NullProgressMonitor) Done()
- func (m *NullProgressMonitor) InternalWorked(float64)
- func (m *NullProgressMonitor) IsCanceled() bool
- func (m *NullProgressMonitor) SetCanceled(v bool)
- func (m *NullProgressMonitor) SetTaskName(string)
- func (m *NullProgressMonitor) SubTask(string)
- func (m *NullProgressMonitor) Worked(int32)
- type NumberFormatException
- type Optional
- type OutputStream
- type ParseException
- type Path
- type Pattern
- type PrintStream
- type ProgressMonitorWrapper
- type Random
- type Reader
- type RejectedExecutionException
- type ResourceBundle
- type Runnable
- type RunnableFunc
- type RuntimeException
- type SimpleDateFormat
- type Stack
- type Status
- type StringBuilder
- func (s *StringBuilder) Append(v any, offsetLen ...int32) *StringBuilder
- func (s *StringBuilder) CharAt(i int32) uint16
- func (s *StringBuilder) Delete(start, end int32) *StringBuilder
- func (s *StringBuilder) DeleteCharAt(i int32) *StringBuilder
- func (s *StringBuilder) GetChars(srcBegin, srcEnd int32, dst []uint16, dstBegin int32)
- func (s *StringBuilder) IndexOf(sub string) int32
- func (s *StringBuilder) Insert(at int32, v any) *StringBuilder
- func (s *StringBuilder) IsEmpty() bool
- func (s *StringBuilder) Length() int32
- func (sb *StringBuilder) Replace(start, end int32, s string) *StringBuilder
- func (s *StringBuilder) SetLength(n int32)
- func (s *StringBuilder) String() string
- func (s *StringBuilder) ToString() string
- type StringTokenizer
- type Thread
- type TimeUnit
- type TimeoutException
- type TreeSet
- type URI
- type URISyntaxException
- type WeakReference
Constants ¶
const ( CalendarERA = 0 CalendarYEAR = 1 CalendarMONTH = 2 CalendarDAY_OF_MONTH = 5 CalendarDAY_OF_WEEK = 7 CalendarAM_PM = 9 CalendarHOUR = 10 CalendarHOUR_OF_DAY = 11 CalendarMINUTE = 12 CalendarSECOND = 13 CalendarMILLISECOND = 14 CalendarAM = 0 CalendarPM = 1 CalendarSHORT = 1 CalendarLONG = 2 DateFormatFULL = 0 DateFormatLONG = 1 DateFormatMEDIUM = 2 DateFormatSHORT = 3 CharacterIteratorDONE uint16 = 0xFFFF )
const ( FileSeparator = "/" FileSeparatorChar uint16 = '/' )
java.io.File.separator / separatorChar.
const NullString = "\x00null"
NullString stands for a Java null String argument written literally in a test; the ported null-argument guards compare against it, since an ordinary "" is a legal String.
const (
StatusOK, StatusInfo, StatusWarning, StatusError, StatusCancel = 0, 1, 2, 4, 8
)
const UNKNOWN = -1
Variables ¶
var ( DateFormatFieldERA = &DateFormatField{"era", CalendarERA} DateFormatFieldYEAR = &DateFormatField{"year", CalendarYEAR} DateFormatFieldMONTH = &DateFormatField{"month", CalendarMONTH} DateFormatFieldDAY_OF_MONTH = &DateFormatField{"day of month", CalendarDAY_OF_MONTH} DateFormatFieldDAY_OF_WEEK = &DateFormatField{"day of week", CalendarDAY_OF_WEEK} DateFormatFieldHOUR_OF_DAY0 = &DateFormatField{"hour of day", CalendarHOUR_OF_DAY} DateFormatFieldHOUR_OF_DAY1 = &DateFormatField{"hour of day 1", CalendarHOUR_OF_DAY} DateFormatFieldHOUR0 = &DateFormatField{"hour", CalendarHOUR} DateFormatFieldHOUR1 = &DateFormatField{"hour 1", CalendarHOUR} DateFormatFieldMINUTE = &DateFormatField{"minute", CalendarMINUTE} DateFormatFieldSECOND = &DateFormatField{"second", CalendarSECOND} DateFormatFieldMILLISECOND = &DateFormatField{"millisecond", CalendarMILLISECOND} DateFormatFieldAM_PM = &DateFormatField{"am pm", CalendarAM_PM} DateFormatFieldTIME_ZONE = &DateFormatField{"time zone", -1} )
var LocaleENGLISH = &Locale{"en"}
var LocaleGERMAN = &Locale{"de"}
var StandardCharsetsUTF_8 = &Charset{}
var SystemProperties = func() *Map { m := NewMap() m.Put("os.name", javaOSName(runtime.GOOS)) m.Put("line.separator", LineSeparator()) return m }()
SystemProperties backs System.getProperty/setProperty/getProperties; values are strings. os.name is the running OS as a JDK names it (the shared generated files are translated once, for every OS).
Functions ¶
func AddSuppressed ¶
func AddSuppressed(e, s error)
AddSuppressed drops the suppressed error: Go errors carry no suppressed list.
func ArgAs ¶
ArgAs converts one Method.invoke argument (boxed any, nil for Java null) to the registered closure's own parameter type.
func ArraysBinarySearch ¶
ArraysBinarySearch is Arrays.binarySearch(array, key): the index, or -(insertion point)-1.
func ArraysFill ¶
func ArraysFill[T any](a []T, v T)
ArraysFill is Arrays.fill(a, v); ArraysFillRange fills [from, to).
func ArraysFillRange ¶
func ArraysSortComparator ¶
ArraysSortComparator is Arrays.sort(T[], Comparator): stable, like Java's object sort.
func AsWriter ¶
func AsWriter(s OutputStream) io.Writer
func AssertIsLegal ¶
func AssertIsNotNull ¶
func AssertIsTrue ¶
func Cast ¶
Cast is a Java reference cast of an erased generic result (Map.get, Queue.poll): nil stays the zero value instead of panicking like a bare Go type assertion would. A subclass pointer (*CTabItem held as a Widget) is walked down to the superclass embedding.
func CharAt ¶
CharAt is String.charAt(i): the i-th UTF-16 unit of s, amortized O(1) in a loop over one string. Out of range panics like the ToChars(s)[i] it replaces.
func ClassCast ¶
ClassCast is Class.cast: the object itself, or a ClassCastException-shaped RuntimeException.
func ClassForName ¶
ClassForName is Class.forName, which SWT only calls to force a class's static initializer - Go package init has already run all of them.
func ClassIsInstance ¶
ClassIsInstance is Class.isInstance: null is an instance of nothing.
func ClassName ¶
ClassName is java.lang.Class#getName(): JVM primitive names and array-descriptor syntax exactly (what the Set/Get dialog branches on), plus a best-effort "org.eclipse.swt.widgets. <Name>" guess for a pointer-to-struct type outside classPackages - wrong package for e.g. a layout type, harmless since every caller (Widget.getName(), every toString()) only keeps the tail after the last '.'. Upgrade path: a translator-emitted per-class Java-FQN registry.
func CollectionsMax ¶
func CollectionsSort ¶
CollectionsSort is Collections.sort(list) for strings and numbers, or with a comparator func(a, b T) int32.
func CompareTo ¶
CompareTo is Comparable.compareTo on a receiver held as any: its own CompareTo, else the natural order of numbers and strings.
func ComparingInt ¶
ComparingInt is Comparator.comparingInt.
func CurrentThread ¶
func CurrentThread() any
CurrentThread is Thread.currentThread() as a comparable identity: the goroutine id (the UI goroutine is locked to the main OS thread, so this is also the AppKit thread check).
func CurrentTimeMillis ¶
func CurrentTimeMillis() int64
CurrentTimeMillis is System.currentTimeMillis().
func Directionality ¶
Directionality is Character.getDirectionality for the blocks SWT's BidiUtil tells apart: Hebrew 1, Arabic 2, other letters 0, digits 3, space 12, else 13 (other neutral). Ceiling: no full UCD bidi class table; swap in golang.org/x/text/unicode/bidi if needed.
func DoubleCompare ¶
DoubleCompare is Double.compare: NaN sorts last and equals itself, -0.0 < 0.0.
func DoubleEquals ¶
DoubleEquals is Double.equals(Object): the other must be a Double with the same value.
func DoubleToInt ¶
DoubleToInt is Double.intValue(): NaN is 0, out-of-range values saturate.
func DoubleToString ¶
DoubleToString is Double.toString for the plain decimal range ("1.0", not "1").
func FilesCopy ¶
FilesCopy is copy(InputStream, Path) and copy(Path, Path); like Java it refuses to overwrite.
func FilesDelete ¶
func FilesDelete(p *Path)
func FilesDeleteIfExists ¶
func FilesIsRegularFile ¶
func FilesIsSymbolicLink ¶
func FilesReadAllBytes ¶
func Format ¶
Format is String.format(fmt, args...) for the conversions Go shares with Java (%d %s %x %02X); %n is a newline.
func FromChars ¶
FromChars is new String(char[]): a valid pair becomes one rune, a lone surrogate WTF-8 (see ToChars).
func GetChars ¶
GetChars is String.getChars: the UTF-16 units [srcBegin, srcEnd) of s copied into dst at dstBegin.
func GetInteger ¶
GetInteger is Integer.getInteger(key, def): the property parsed as a number, def when unset or not one.
func GetProperty ¶
GetProperty is System.getProperty(key, def); an unset key with no default is the port's null String, "".
func Goid ¶
func Goid() uint64
Goid is the current goroutine id without boxing, for thread checks on hot paths.
func HashCodeOf ¶
HashCodeOf is Object.hashCode() on a receiver whose static type has no Go method for it.
func IdentityHashCode ¶
IdentityHashCode is Object.hashCode: Go's heap objects don't move, so the address is stable.
func Ignore ¶
func Ignore(...any)
Ignore evaluates its arguments for their side effects only: Thread.interrupt and setDaemon, which a goroutine does not have.
func Interrupted ¶
func Interrupted() bool
Interrupted is Thread.interrupted(): nothing interrupts a goroutine.
func IsAssignableFrom ¶
IsAssignableFrom is Class.isAssignableFrom for the reflect types the translator uses as Class values.
func IsHighSurrogate ¶
IsHighSurrogate is Character.isHighSurrogate.
func IsNil ¶
IsNil is `x == null` for a Java Object held as any: a typed nil pointer inside the interface is null too.
func JavaVersionFeature ¶
JavaVersionFeature is Runtime.version().feature(): there is no JVM, so no Java version.
func LastIndexOf ¶
LastIndexOf is String.lastIndexOf(str) in UTF-16 units.
func LineSeparator ¶
func LineSeparator() string
LineSeparator is System.lineSeparator(): "\r\n" on Windows (StyledText copies text with it).
func LocaleLanguage ¶
LocaleLanguage is locale.getLanguage() for the default (only) locale: the ISO code from $LANG.
func MessageFormatFormat ¶
MessageFormatFormat is MessageFormat.format(pattern, args): {n} and {n,type,style} are replaced by fmt.Sprint(args[n]), a char (uint16) by its character, and ” is a literal quote. Not supported: the number and date formatting of type and style, quoted literal sections.
func MonitorEnter ¶
func MonitorEnter()
func MonitorExit ¶
func MonitorExit()
func MonitorNotifyAll ¶
func MonitorNotifyAll()
func MonitorWait ¶
func MonitorWait()
MonitorWait is Object.wait(): releases the monitor fully, sleeps until notified, re-acquires.
func Narrow ¶
Narrow gives a registered method's closure the *DeclaringClass pointer it needs to call itself, from whatever concrete leaf type ClassGetMethod was actually asked about (target may be *Button while the method is declared on *Control) - the address of the field-0 chain's matching link, exactly what Go's own method promotion uses. Struct-field reflection only, see the package doc.
func NullToEmpty ¶
NullToEmpty turns the NullString sentinel back into "" where a null String result is used as a plain value.
func NumberDouble ¶
NumberDouble is Number.doubleValue() on a boxed number of whatever kind the value came as.
func ObjectsEquals ¶
ObjectsEquals is Objects.equals(a, b): a typed nil pointer counts as null.
func ObjectsHash ¶
ObjectsHash is Objects.hash(values...), i.e. Arrays.hashCode of the boxed values.
func ParseInt ¶
ParseInt is Integer.parseInt: a NumberFormatException panic on bad input or int overflow.
func ParseIntRadix ¶
ParseIntRadix is Integer.parseInt(s, radix).
func PeekBytes ¶
func PeekBytes(s InputStream, n int) (head []byte, ok bool)
PeekBytes returns up to n leading bytes of a stream and rewinds it, like FileFormat's mark/reset sniffing; ok is false for a stream that cannot rewind (only files and byte arrays can).
func PrintStreamFlush ¶
func PrintStreamFlush(s PrintStream)
PrintStreamFlush is PrintStream.flush on a stream of either kind.
func ReadAllBytes ¶
func ReadAllBytes(s InputStream) []int8
ReadAllBytes is java.io.InputStream.readAllBytes(): read until EOF.
func RegisterClassPackage ¶
func RegisterClassPackage(goName, javaPackage string)
RegisterClassPackage records the Java package of a swt type outside org.eclipse.swt.widgets (generated init, ClassEmitter); ClassName falls back to widgets for the rest.
func RegisterMethod ¶
func RegisterMethod(t reflect.Type, javaName string, paramTypes []reflect.Type, returnType reflect.Type, call func(target any, args []any) any)
RegisterMethod is called from generated code - swt/swtreflect's init() (ReflectEmitter, README "Round 10 reflection").
func RegisterResources ¶
func RemoveTempDir ¶
func RemoveTempDir(p *Path)
func ReplaceAll ¶
func ReplaceFirst ¶
ReplaceFirst and ReplaceAll are String.replaceFirst/replaceAll ($1 group references as in Java).
func SafeRunnerRun ¶
func SafeRunnerRun(r ISafeRunnable)
SafeRunnerRun runs r, routing a panic that is an error to HandleException (SafeRunner.run).
func SetOut ¶
func SetOut(s PrintStream)
SetOut is System.setOut: a CapturedStream takes over os.Stdout, the original *os.File gives it back.
func SetProperty ¶
SetProperty is System.setProperty: the previous value, "" when unset.
func StringCompareTo ¶
StringCompareTo is String.compareTo: UTF-16 code units, the difference of the first mismatch or of the lengths.
func StringFromBytes ¶
StringFromBytes is new String(byte[], UTF_8).
func StringHashCode ¶
StringHashCode is String.hashCode(): h = 31*h + c over the UTF-16 code units.
func StringLength ¶
StringLength is String.length(): UTF-16 code units, so a length sizes a getChars buffer.
func Substring ¶
Substring is String.substring(start, end) over UTF-16 indices; end < 0 means to the end.
func TakeScreenshot ¶
TakeScreenshot is org.eclipse.test.Screenshots.takeScreenshot: the runner captures nothing.
func ThenComparing ¶
ThenComparing is Comparator.thenComparing(Comparator) or thenComparing(Function): next is a func(T, T) int32 or a key extractor returning an ordered value.
func ThreadIsAlive ¶
ThreadIsAlive is Thread.isAlive: started and not yet finished.
func ThreadJoin ¶
func ThreadJoin(t any)
func ThreadStart ¶
func ThreadStart(t any)
func ToChars ¶
Ceiling: a pair cut by Substring and joined with Go + is two 3-byte units, not the 4-byte rune. Length, index, hash and compareTo are right; ==, map keys and HasPrefix see different bytes. Upgrade: a jrt.Concat in the generator that re-encodes the joined units. ToChars is String.toCharArray(): the UTF-16 units of s. A lone surrogate is kept as WTF-8 (ED A0..BF xx), which Substring produces when it cuts an emoji pair; two such halves concatenated with + read back as the pair.
func ToSlice ¶
ToSlice is list.toArray(new T[0]): the snapshot as a typed slice (nil elements stay zero).
func URLDecoderDecode ¶
func URLEncoderEncode ¶
func ValidUTF8 ¶
ValidUTF8 is for text handed to the OS: surrogate pairs held as two WTF-8 halves are joined, a lone surrogate becomes U+FFFD, since Cocoa and GTK reject invalid UTF-8.
func WriteBytes ¶
func WriteBytes(o OutputStream, b []int8)
WriteBytes is OutputStream.write(byte[]).
Types ¶
type Assert ¶
type Assert struct{}
Assert mirrors org.eclipse.core.runtime.Assert; msg is Java's optional second argument.
type AssertionFailedException ¶
type AssertionFailedException struct{ RuntimeException }
AssertionFailedException is what Assert.isTrue/isNotNull throw.
type AtomicBoolean ¶
type AtomicBoolean struct {
// contains filtered or unexported fields
}
AtomicBoolean, AtomicInteger and AtomicReference are java.util.concurrent.atomic's cells; the constructors take Java's optional initial value.
func NewAtomicBoolean ¶
func NewAtomicBoolean(initial ...bool) *AtomicBoolean
func (*AtomicBoolean) CompareAndSet ¶
func (a *AtomicBoolean) CompareAndSet(expected, v bool) bool
func (*AtomicBoolean) Get ¶
func (a *AtomicBoolean) Get() bool
func (*AtomicBoolean) GetAndSet ¶
func (a *AtomicBoolean) GetAndSet(v bool) bool
func (*AtomicBoolean) GetPlain ¶
func (a *AtomicBoolean) GetPlain() bool
func (*AtomicBoolean) Set ¶
func (a *AtomicBoolean) Set(v bool)
func (*AtomicBoolean) SetPlain ¶
func (a *AtomicBoolean) SetPlain(v bool)
type AtomicInteger ¶
type AtomicInteger struct {
// contains filtered or unexported fields
}
func NewAtomicInteger ¶
func NewAtomicInteger(initial ...int32) *AtomicInteger
func (*AtomicInteger) AddAndGet ¶
func (a *AtomicInteger) AddAndGet(d int32) int32
func (*AtomicInteger) CompareAndSet ¶
func (a *AtomicInteger) CompareAndSet(expected, v int32) bool
func (*AtomicInteger) DecrementAndGet ¶
func (a *AtomicInteger) DecrementAndGet() int32
func (*AtomicInteger) Get ¶
func (a *AtomicInteger) Get() int32
func (*AtomicInteger) GetAndAdd ¶
func (a *AtomicInteger) GetAndAdd(d int32) int32
func (*AtomicInteger) GetAndIncrement ¶
func (a *AtomicInteger) GetAndIncrement() int32
func (*AtomicInteger) GetAndSet ¶
func (a *AtomicInteger) GetAndSet(v int32) int32
func (*AtomicInteger) GetPlain ¶
func (a *AtomicInteger) GetPlain() int32
func (*AtomicInteger) IncrementAndGet ¶
func (a *AtomicInteger) IncrementAndGet() int32
func (*AtomicInteger) IntValue ¶
func (a *AtomicInteger) IntValue() int32
func (*AtomicInteger) Set ¶
func (a *AtomicInteger) Set(v int32)
func (*AtomicInteger) SetPlain ¶
func (a *AtomicInteger) SetPlain(v int32)
type AtomicIntegerArray ¶
type AtomicIntegerArray struct {
// contains filtered or unexported fields
}
AtomicIntegerArray and AtomicReferenceArray are the fixed-size arrays of cells.
func NewAtomicIntegerArray ¶
func NewAtomicIntegerArray(n int32) *AtomicIntegerArray
func (*AtomicIntegerArray) Get ¶
func (a *AtomicIntegerArray) Get(i int32) int32
func (*AtomicIntegerArray) Length ¶
func (a *AtomicIntegerArray) Length() int32
func (*AtomicIntegerArray) Set ¶
func (a *AtomicIntegerArray) Set(i, x int32)
func (*AtomicIntegerArray) ToString ¶
func (a *AtomicIntegerArray) ToString() string
type AtomicLong ¶
type AtomicLong struct {
// contains filtered or unexported fields
}
func NewAtomicLong ¶
func NewAtomicLong(initial ...int64) *AtomicLong
func (*AtomicLong) AddAndGet ¶
func (a *AtomicLong) AddAndGet(d int64) int64
func (*AtomicLong) CompareAndSet ¶
func (a *AtomicLong) CompareAndSet(expected, v int64) bool
func (*AtomicLong) DecrementAndGet ¶
func (a *AtomicLong) DecrementAndGet() int64
func (*AtomicLong) Get ¶
func (a *AtomicLong) Get() int64
func (*AtomicLong) GetAndAdd ¶
func (a *AtomicLong) GetAndAdd(d int64) int64
func (*AtomicLong) GetAndIncrement ¶
func (a *AtomicLong) GetAndIncrement() int64
func (*AtomicLong) GetAndSet ¶
func (a *AtomicLong) GetAndSet(v int64) int64
func (*AtomicLong) GetPlain ¶
func (a *AtomicLong) GetPlain() int64
func (*AtomicLong) IncrementAndGet ¶
func (a *AtomicLong) IncrementAndGet() int64
func (*AtomicLong) LongValue ¶
func (a *AtomicLong) LongValue() int64
func (*AtomicLong) Set ¶
func (a *AtomicLong) Set(v int64)
func (*AtomicLong) SetPlain ¶
func (a *AtomicLong) SetPlain(v int64)
type AtomicReference ¶
type AtomicReference struct {
// contains filtered or unexported fields
}
func NewAtomicReference ¶
func NewAtomicReference(initial ...any) *AtomicReference
func (*AtomicReference) Get ¶
func (a *AtomicReference) Get() any
func (*AtomicReference) GetAndSet ¶
func (a *AtomicReference) GetAndSet(v any) any
func (*AtomicReference) GetPlain ¶
func (a *AtomicReference) GetPlain() any
func (*AtomicReference) Set ¶
func (a *AtomicReference) Set(v any)
func (*AtomicReference) SetPlain ¶
func (a *AtomicReference) SetPlain(v any)
type AtomicReferenceArray ¶
type AtomicReferenceArray struct {
// contains filtered or unexported fields
}
func NewAtomicReferenceArray ¶
func NewAtomicReferenceArray(n int32) *AtomicReferenceArray
func (*AtomicReferenceArray) Get ¶
func (a *AtomicReferenceArray) Get(i int32) any
func (*AtomicReferenceArray) Length ¶
func (a *AtomicReferenceArray) Length() int32
func (*AtomicReferenceArray) Set ¶
func (a *AtomicReferenceArray) Set(i int32, x any)
func (*AtomicReferenceArray) ToString ¶
func (a *AtomicReferenceArray) ToString() string
type AttributedCharacterIterator ¶
type AttributedCharacterIterator struct {
// contains filtered or unexported fields
}
AttributedCharacterIterator: the formatted text, one run per field or literal.
func (*AttributedCharacterIterator) Current ¶
func (it *AttributedCharacterIterator) Current() uint16
func (*AttributedCharacterIterator) First ¶
func (it *AttributedCharacterIterator) First() uint16
func (*AttributedCharacterIterator) GetAttributes ¶
func (it *AttributedCharacterIterator) GetAttributes() *Map
func (*AttributedCharacterIterator) GetRunLimit ¶
func (it *AttributedCharacterIterator) GetRunLimit() int32
func (*AttributedCharacterIterator) GetRunStart ¶
func (it *AttributedCharacterIterator) GetRunStart() int32
func (*AttributedCharacterIterator) Next ¶
func (it *AttributedCharacterIterator) Next() uint16
func (*AttributedCharacterIterator) SetIndex ¶
func (it *AttributedCharacterIterator) SetIndex(i int32) uint16
type BufferedReader ¶
type BufferedReader = Reader
The reader classes share one Go type; each constructor keeps its Java name.
type ByteArrayInputStream ¶
type ByteArrayInputStream struct {
// contains filtered or unexported fields
}
ByteArrayInputStream is java.io.ByteArrayInputStream.
func NewByteArrayInputStream ¶
func NewByteArrayInputStream(buf []int8) *ByteArrayInputStream
type ByteArrayOutputStream ¶
type ByteArrayOutputStream struct {
// contains filtered or unexported fields
}
ByteArrayOutputStream is java.io.ByteArrayOutputStream.
func NewByteArrayOutputStream ¶
func NewByteArrayOutputStream() *ByteArrayOutputStream
func (*ByteArrayOutputStream) Size ¶
func (s *ByteArrayOutputStream) Size() int32
func (*ByteArrayOutputStream) ToByteArray ¶
func (s *ByteArrayOutputStream) ToByteArray() []int8
func (*ByteArrayOutputStream) ToString ¶
func (s *ByteArrayOutputStream) ToString(charset ...any) string
ToString is toString() and toString(Charset): the bytes as UTF-8, the only charset used.
func (*ByteArrayOutputStream) WriteRange ¶
type Calendar ¶
type Calendar struct {
// contains filtered or unexported fields
}
Calendar normalizes raw fields on read, like a lenient GregorianCalendar (Jan 31 + month 1 = Mar 3).
func CalendarGetInstance ¶
func (*Calendar) GetActualMaximum ¶
func (*Calendar) GetActualMinimum ¶
func (*Calendar) GetDisplayNames ¶
GetDisplayNames: long names of a MONTH, DAY_OF_WEEK or AM_PM field (style is ignored).
func (*Calendar) GetMaximum ¶
func (*Calendar) GetMinimum ¶
func (*Calendar) Roll ¶
Roll changes one field and wraps inside its range without touching larger fields.
type CapturedStream ¶
type CapturedStream struct {
// contains filtered or unexported fields
}
CapturedStream is new PrintStream(out, ...). Made System.out/err by SetOut/SetErr, it receives what the process writes to os.Stdout/os.Stderr, on Flush: Go cannot swap an *os.File for a buffer, so the output goes to a temp file and Flush copies the new bytes into out.
func NewPrintStream ¶
func NewPrintStream(out OutputStream, _ ...any) *CapturedStream
NewPrintStream covers (out), (out, autoFlush) and (out, autoFlush, charset); the bytes are UTF-8 either way.
func (*CapturedStream) Flush ¶
func (c *CapturedStream) Flush()
type Charset ¶
type Charset struct{}
Charset stands for java.nio.charset.Charset: everything is UTF-8 here.
type Collections ¶
type Collections struct{}
Collections holds the static helpers the translated sources call: max, emptySet, singleton.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector is Collectors.joining(sep), toList() or toSet() (kind "list"/"set"; sets keep insertion order).
func CollectorsJoining ¶
func CollectorsSummingInt ¶
CollectorsSummingInt is Collectors.summingInt(ToIntFunction).
func CollectorsToList ¶
func CollectorsToList() *Collector
func CollectorsToSet ¶
func CollectorsToSet() *Collector
type CompletableFuture ¶
type CompletableFuture struct {
// contains filtered or unexported fields
}
CompletableFuture covers supplyAsync/thenRunAsync and the state queries the tests read. Ceiling: no stages beyond thenRunAsync/thenAccept, no join.
func CompletableFutureAllOf ¶
func CompletableFutureAllOf(fs ...*CompletableFuture) *CompletableFuture
CompletableFutureAllOf is CompletableFuture.allOf: done once every argument is.
func CompletableFutureCompletedFuture ¶
func CompletableFutureCompletedFuture(v any) *CompletableFuture
func CompletableFutureSupplyAsync ¶
func CompletableFutureSupplyAsync[T any](supplier func() T) *CompletableFuture
func NewCompletableFuture ¶
func NewCompletableFuture() *CompletableFuture
func (*CompletableFuture) Complete ¶
func (f *CompletableFuture) Complete(v any) bool
Complete is CompletableFuture.complete: false when the future was already done.
func (*CompletableFuture) Get ¶
func (f *CompletableFuture) Get() any
Get waits for the future and returns its value, nil for one that failed.
func (*CompletableFuture) IsCancelled ¶
func (f *CompletableFuture) IsCancelled() bool
func (*CompletableFuture) IsCompletedExceptionally ¶
func (f *CompletableFuture) IsCompletedExceptionally() bool
func (*CompletableFuture) IsDone ¶
func (f *CompletableFuture) IsDone() bool
func (*CompletableFuture) ThenAccept ¶
func (f *CompletableFuture) ThenAccept(fn func(any)) *CompletableFuture
ThenAccept runs fn with the value as soon as the future is done; the returned future is done after fn.
func (*CompletableFuture) ThenRunAsync ¶
func (f *CompletableFuture) ThenRunAsync(r Runnable, executor any) *CompletableFuture
type CoreException ¶
type CoreException struct {
RuntimeException
Status IStatus
}
CoreException wraps an IStatus like org.eclipse.core.runtime.CoreException.
func NewCoreException ¶
func NewCoreException(status IStatus) *CoreException
func (*CoreException) GetStatus ¶
func (e *CoreException) GetStatus() IStatus
type CountDownLatch ¶
type CountDownLatch struct {
// contains filtered or unexported fields
}
CountDownLatch is java.util.concurrent.CountDownLatch.
func NewCountDownLatch ¶
func NewCountDownLatch(count int32) *CountDownLatch
func (*CountDownLatch) CountDown ¶
func (l *CountDownLatch) CountDown()
type DataInputStream ¶
type DataInputStream struct{ InputStream }
DataInputStream is java.io.DataInputStream.
func NewDataInputStream ¶
func NewDataInputStream(in InputStream) *DataInputStream
func (*DataInputStream) Read ¶
func (s *DataInputStream) Read(b ...[]int8) int32
Read is read() and read(byte[]): the byte or the count read, -1 at the end.
func (*DataInputStream) ReadInt ¶
func (s *DataInputStream) ReadInt() int32
func (*DataInputStream) ReadLong ¶
func (s *DataInputStream) ReadLong() int64
type DataOutputStream ¶
type DataOutputStream struct{ OutputStream }
DataOutputStream is java.io.DataOutputStream: big-endian values over an OutputStream.
func NewDataOutputStream ¶
func NewDataOutputStream(out OutputStream) *DataOutputStream
func (*DataOutputStream) Write ¶
func (s *DataOutputStream) Write(b any)
Write is write(int) and write(byte[]).
func (*DataOutputStream) WriteInt ¶
func (s *DataOutputStream) WriteInt(v int32)
func (*DataOutputStream) WriteLong ¶
func (s *DataOutputStream) WriteLong(v int64)
type DateFormat ¶
type DateFormat struct {
// contains filtered or unexported fields
}
DateFormat is also SimpleDateFormat: every instance is pattern based.
func DateFormatGetDateInstance ¶
func DateFormatGetDateInstance(style int32, locale ...any) *DateFormat
func DateFormatGetTimeInstance ¶
func DateFormatGetTimeInstance(style int32, locale ...any) *DateFormat
func (*DateFormat) Format ¶
func (f *DateFormat) Format(d *Date) string
func (*DateFormat) FormatToCharacterIterator ¶
func (f *DateFormat) FormatToCharacterIterator(d *Date) *AttributedCharacterIterator
func (*DateFormat) GetDateFormatSymbols ¶
func (f *DateFormat) GetDateFormatSymbols() DateFormatSymbols
func (*DateFormat) Parse ¶
func (f *DateFormat) Parse(s string) *Date
Parse reads the pattern strictly (non-lenient ranges) from the start of s; trailing text is ignored like Java.
func (*DateFormat) SetLenient ¶
func (f *DateFormat) SetLenient(l bool)
type DateFormatField ¶
type DateFormatField struct {
// contains filtered or unexported fields
}
DateFormatField is DateFormat.Field, Format.Field and AttributedCharacterIterator.Attribute.
func (*DateFormatField) Equals ¶
func (f *DateFormatField) Equals(o any) bool
func (*DateFormatField) GetCalendarField ¶
func (f *DateFormatField) GetCalendarField() int32
func (*DateFormatField) String ¶
func (f *DateFormatField) String() string
type DateFormatSymbols ¶
type DateFormatSymbols struct{}
func (DateFormatSymbols) GetAmPmStrings ¶
func (DateFormatSymbols) GetAmPmStrings() []string
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
func DurationBetween ¶
func DurationOfSeconds ¶
func (*Duration) IsNegative ¶
type EventObject ¶
type EventObject struct {
Source any
}
EventObject mirrors java.util.EventObject's one field: the object that fired the event.
func NewEventObject ¶
func NewEventObject(source any) EventObject
NewEventObject rejects a null source; a typed nil pointer boxed in the any is null too.
func (*EventObject) GetSource ¶
func (e *EventObject) GetSource() any
type Executor ¶
type Executor interface{ Execute(Runnable) }
Executor is java.util.concurrent.Executor (translated Display has Execute).
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field is java.lang.reflect.Field of a translated class: a struct field found by its Java name. Struct-field reflection only, so it does not defeat dead-code elimination (see reflect.go).
func ClassGetDeclaredField ¶
ClassGetDeclaredField is Class#getDeclaredField for a pointer-to-struct type; the Go field keeps the Java name.
type FieldPosition ¶
type FieldPosition struct {
// contains filtered or unexported fields
}
FieldPosition: the field is a *DateFormatField or nil (new FieldPosition(0)).
func NewFieldPosition ¶
func NewFieldPosition(field any) *FieldPosition
func (*FieldPosition) Equals ¶
func (p *FieldPosition) Equals(o any) bool
func (*FieldPosition) GetBeginIndex ¶
func (p *FieldPosition) GetBeginIndex() int32
func (*FieldPosition) GetEndIndex ¶
func (p *FieldPosition) GetEndIndex() int32
func (*FieldPosition) GetFieldAttribute ¶
func (p *FieldPosition) GetFieldAttribute() *DateFormatField
func (*FieldPosition) SetBeginIndex ¶
func (p *FieldPosition) SetBeginIndex(i int32)
func (*FieldPosition) SetEndIndex ¶
func (p *FieldPosition) SetEndIndex(i int32)
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is java.io.File over a path.
func NewFile ¶
NewFile covers File(path) and File(parent, child); a parent may be a *File or a string.
func (*File) IsDirectory ¶
type FileInputStream ¶
type FileInputStream struct{ InputStream }
FileInputStream/FileOutputStream are their stream interface plus a name to declare variables with.
func NewFileInputStream ¶
func NewFileInputStream(file any) *FileInputStream
NewFileInputStream/NewFileOutputStream back `new FileInputStream(filename)`/`new FileOutputStream(filename)` (ImageLoader.load/save(String)) - "FileInputStream"/ "FileOutputStream" name no real Go type (see Manual), only these two constructors exist.
type FileOutputStream ¶
type FileOutputStream struct{ OutputStream }
func NewFileOutputStream ¶
func NewFileOutputStream(file any) *FileOutputStream
type FileReader ¶
type FileReader = Reader
The reader classes share one Go type; each constructor keeps its Java name.
type FuncInputStream ¶
type FuncInputStream struct{ ReadFn func() int32 }
FuncInputStream is `new InputStream() { int read() {...} }`: the other methods are InputStream's own.
func (*FuncInputStream) Close ¶
func (s *FuncInputStream) Close()
func (*FuncInputStream) Read ¶
func (s *FuncInputStream) Read() int32
type IOException ¶
type IOException struct{ Message string }
IOException is java.io.IOException: a pointer so the panic value satisfies Go's error interface (see ControlFlowEmitter's concrete-catch type assertion).
func NewIOException ¶
func NewIOException(arg ...any) *IOException
func (*IOException) Error ¶
func (e *IOException) Error() string
type IProgressMonitor ¶
type ISafeRunnable ¶
type ISafeRunnable interface {
HandleException(exception error)
Run()
}
ISafeRunnable is org.eclipse.core.runtime.ISafeRunnable.
type IStatus ¶
type IStatus interface {
GetSeverity() int32
GetMessage() string
GetPlugin() string
GetCode() int32
GetException() error
IsOK() bool
}
IStatus is org.eclipse.core.runtime.IStatus; Status below implements it.
type IllegalArgumentException ¶
func NewIllegalArgumentException ¶
func NewIllegalArgumentException(args ...any) *IllegalArgumentException
NewIllegalArgumentException covers Java's (), (String), (Throwable) and (String, Throwable).
func (*IllegalArgumentException) Error ¶
func (e *IllegalArgumentException) Error() string
func (*IllegalArgumentException) GetMessage ¶
func (e *IllegalArgumentException) GetMessage() string
func (*IllegalArgumentException) Unwrap ¶
func (e *IllegalArgumentException) Unwrap() error
type IndexOutOfBoundsException ¶
type IndexOutOfBoundsException struct{ RuntimeException }
func NewIndexOutOfBoundsException ¶
func NewIndexOutOfBoundsException(args ...any) *IndexOutOfBoundsException
type InputStream ¶
InputStream mirrors the java.io.InputStream methods ImageLoader.java's translated code uses: Read/ReadRange return -1 at end of stream, matching Java's read()/read(byte[],off,len). []int8 is this codebase's Go spelling of byte[] (see GoTypes). None of the ported code catches a per-call I/O error, so there is no error return - a real failure panics with an IOException.
func ClassGetResourceAsStream ¶
func ClassGetResourceAsStream(class any, name string) InputStream
ClassGetResourceAsStream is Class.getResourceAsStream: the class is ignored, names resolve against the one registered resource FS.
func FilesNewInputStream ¶
func FilesNewInputStream(p *Path, _ []any) InputStream
func GetResourceAsStream ¶
func GetResourceAsStream(name string) InputStream
GetResourceAsStream is Class.getResourceAsStream(name): nil if no FS was registered or name isn't in it, matching Java's own "resource not found" return.
func NewInputStream ¶
func NewInputStream(r io.Reader) InputStream
NewInputStream wraps a Go io.Reader - a file, an embedded resource, a byte slice - as the InputStream ImageLoader.java's translated code and the image codec wrapper read from.
type InputStreamReader ¶
type InputStreamReader = Reader
The reader classes share one Go type; each constructor keeps its Java name.
type Instant ¶
type Instant struct {
// contains filtered or unexported fields
}
Instant and Duration are java.time's, over time.Time and time.Duration.
func InstantNow ¶
func InstantNow() *Instant
func (*Instant) PlusMillis ¶
func (*Instant) PlusSeconds ¶
type InterruptedException ¶
type InterruptedException struct{ RuntimeException }
func NewInterruptedException ¶
func NewInterruptedException(args ...any) *InterruptedException
type InvocationTargetException ¶
type InvocationTargetException struct{ Cause error }
InvocationTargetException is java.lang.reflect.InvocationTargetException.
func (*InvocationTargetException) Error ¶
func (e *InvocationTargetException) Error() string
func (*InvocationTargetException) Unwrap ¶
func (e *InvocationTargetException) Unwrap() error
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is java.util.Iterator over a List snapshot; Remove deletes the last returned element from the list.
type JavaError ¶
Named JavaError, not Error: an embedded field literally named "Error" would shadow its own promoted Error() method, so *SWTError would silently stop satisfying Go's error interface.
func NewJavaError ¶
func (*JavaError) GetMessage ¶
func (*JavaError) PrintStackTrace ¶
func (e *JavaError) PrintStackTrace()
type List ¶
type List struct {
// contains filtered or unexported fields
}
List stands in for java.util.List/ArrayList and ConcurrentLinkedQueue. The mutex covers the queue use (Synchronizer.asyncExec may be called off the UI goroutine).
func ArraysAsList ¶
ArraysAsList is Arrays.asList(array) for any slice type.
func CollectionsEmptySet ¶
func CollectionsEmptySet() *List
func CollectionsSingleton ¶
func CollectionsUnmodifiableList ¶
The Collections wrappers return the list itself: the translated tests are single-threaded and never write through the original after wrapping, so a copy or a lock would only hide a bug.
func IntStreamRange ¶
IntStreamRange is IntStream.range(from, to).
func ListOf ¶
ListOf is List.of(e1, e2, ...). A lone array of references ([]any, []*Control, []string...) is the varargs array of Stream.of(T...) / Arrays.asList(T...), spread as Java does; a lone primitive array (int[]) stays one element, as in Java.
func NewList ¶
NewList is new ArrayList<>(), new ArrayList<>(initialCapacity) or new ArrayList<>(collection).
func StringChars ¶
StringChars is String.chars(): the UTF-16 code units.
func (*List) Collect ¶
Collect covers joining, toList and toSet; the caller asserts the Java result type.
func (*List) CollectInto ¶
CollectInto is the sequential collect(supplier, accumulator, combiner).
func (*List) FlatMapToInt ¶
func (*List) ForEach ¶
ForEach is Iterable.forEach(Consumer): the action is a Go func of the element type (or an untyped marker), called through reflect because the list itself is erased to any.
func (*List) ForEachOrdered ¶
ForEachOrdered is Stream.forEachOrdered: streams here are lists, already in order.
func (*List) MapToInt ¶
Stream stages the translated code uses beyond Map/Filter: the values stay boxed in any, the lambda's own Go types do the work.
func (*List) RemoveFirst ¶
func (*List) RemoveIf ¶
RemoveIf takes Java's Predicate as a func(any) bool; typed any because a translated method-reference argument has no Go type of its own yet.
type ListenerList ¶
type ListenerList struct {
// contains filtered or unexported fields
}
ListenerList is org.eclipse.core.runtime.ListenerList: identity-compared, copy-on-write so GetListeners can be iterated while a listener removes itself.
func NewListenerList ¶
func NewListenerList() *ListenerList
func (*ListenerList) Add ¶
func (l *ListenerList) Add(x any)
func (*ListenerList) Clear ¶
func (l *ListenerList) Clear()
func (*ListenerList) GetListeners ¶
func (l *ListenerList) GetListeners() []any
func (*ListenerList) IsEmpty ¶
func (l *ListenerList) IsEmpty() bool
func (*ListenerList) Remove ¶
func (l *ListenerList) Remove(x any)
func (*ListenerList) Size ¶
func (l *ListenerList) Size() int32
type Locale ¶
type Locale struct {
// contains filtered or unexported fields
}
Locale is java.util.Locale reduced to its toString() form; only ENGLISH is needed so far.
func LocaleDefault ¶
func LocaleDefault() *Locale
func LocaleForLanguageTag ¶
func (*Locale) GetCountry ¶
func (*Locale) GetLanguage ¶
func (*Locale) GetVariant ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map stands in for java.util.Map/HashMap: hashCode buckets with an equals scan, or plain Go equality for keys without HashCode/Equals.
func Environ ¶
func Environ() *Map
Environ is System.getenv(): a snapshot of the process environment.
func (*Map) ComputeIfAbsent ¶
ComputeIfAbsent is Map.computeIfAbsent: fn is a Go func of the key returning the value.
func (*Map) ContainsKey ¶
func (*Map) EntrySet ¶
EntrySet lists the entries by ascending int32 key: a HashMap of small Integer keys iterates in that order. Ceiling: other key types come out in an unspecified order.
func (*Map) GetProperty ¶
func (*Map) Load ¶
func (m *Map) Load(in InputStream)
Properties (a Map): key=value lines in, sorted key=value lines out.
func (*Map) Store ¶
func (m *Map) Store(out OutputStream, comments string)
type MapEntry ¶
type MapEntry struct {
// contains filtered or unexported fields
}
MapEntry is Map.Entry.
type MessageFormat ¶
type MessageFormat struct{}
MessageFormat only names the static MessageFormatFormat (java.text.MessageFormat.format).
type Method ¶
type Method struct {
// contains filtered or unexported fields
}
Method is java.lang.reflect.Method, as returned by ClassGetMethod.
func ClassGetMethod ¶
ClassGetMethod is java.lang.Class#getMethod(String, Class...): looks the Java method name up in t's own registered methods, then its ancestors' (Control, Widget, ...) by walking the same field-0 embedding chain Go itself promotes methods through (every translated class embeds its superclass at field 0 - see README "impl cascade"). Several registered entries can share javaName (Java overloads); the first whose paramTypes are all assignable from the requested ones wins - correct as long as at most one overload matches, same ceiling Java's own overload resolution would have on an ambiguous erasure.
func NewNamedMethod ¶
NewNamedMethod is a Method that only knows its name (TestInfo.getTestMethod).
func (*Method) GetReturnType ¶
GetReturnType is Method.getReturnType(); nil (a nil reflect.Type) for a void method.
type MethodEntry ¶
type MethodEntry struct {
// contains filtered or unexported fields
}
MethodEntry is one registered method: paramTypes/returnType are its own Go types (for getMethod's overload matching and Method.getReturnType), call performs the actual dispatch.
type MissingResourceException ¶
type MissingResourceException struct{ Key string }
MissingResourceException is java.util.MissingResourceException.
func (*MissingResourceException) Error ¶
func (e *MissingResourceException) Error() string
type NoSuchElementException ¶
type NoSuchElementException struct{}
NoSuchElementException is java.util.NoSuchElementException.
func (*NoSuchElementException) Error ¶
func (e *NoSuchElementException) Error() string
type NoSuchFieldException ¶
type NoSuchFieldException struct{ Message string }
NoSuchFieldException is java.lang.NoSuchFieldException.
func (*NoSuchFieldException) Error ¶
func (e *NoSuchFieldException) Error() string
type NoSuchMethodException ¶
type NoSuchMethodException struct{ Message string }
NoSuchMethodException is java.lang.NoSuchMethodException.
func (*NoSuchMethodException) Error ¶
func (e *NoSuchMethodException) Error() string
type NullPointerException ¶
type NullPointerException struct{ RuntimeException }
func NewNullPointerException ¶
func NewNullPointerException(args ...any) *NullPointerException
type NullProgressMonitor ¶
type NullProgressMonitor struct {
// contains filtered or unexported fields
}
NullProgressMonitor ignores progress but remembers cancellation.
func NewNullProgressMonitor ¶
func NewNullProgressMonitor() *NullProgressMonitor
func (*NullProgressMonitor) BeginTask ¶
func (m *NullProgressMonitor) BeginTask(string, int32)
func (*NullProgressMonitor) Done ¶
func (m *NullProgressMonitor) Done()
func (*NullProgressMonitor) InternalWorked ¶
func (m *NullProgressMonitor) InternalWorked(float64)
func (*NullProgressMonitor) IsCanceled ¶
func (m *NullProgressMonitor) IsCanceled() bool
func (*NullProgressMonitor) SetCanceled ¶
func (m *NullProgressMonitor) SetCanceled(v bool)
func (*NullProgressMonitor) SetTaskName ¶
func (m *NullProgressMonitor) SetTaskName(string)
func (*NullProgressMonitor) SubTask ¶
func (m *NullProgressMonitor) SubTask(string)
func (*NullProgressMonitor) Worked ¶
func (m *NullProgressMonitor) Worked(int32)
type NumberFormatException ¶
type NumberFormatException struct{ Input string }
NumberFormatException is java.lang.NumberFormatException.
func (*NumberFormatException) Error ¶
func (e *NumberFormatException) Error() string
type Optional ¶
type Optional struct {
// contains filtered or unexported fields
}
Optional is java.util.Optional over any: erased generics, so a caller casts Get's result.
func OptionalEmpty ¶
func OptionalEmpty() *Optional
func OptionalOf ¶
func OptionalOfNullable ¶
OptionalOfNullable: a nil interface or typed nil pointer is empty.
type OutputStream ¶
type OutputStream interface {
Write(b int32)
WriteRange(b []int8, off, length int32)
Flush()
Close()
}
OutputStream mirrors write(int)/write(byte[],off,len)/flush()/close().
func NewOutputStream ¶
func NewOutputStream(w io.Writer) OutputStream
NewOutputStream wraps a Go io.Writer as the OutputStream LEDataOutputStream/the format encoders write to.
type ParseException ¶
type ParseException struct{ Message string }
func (*ParseException) Error ¶
func (e *ParseException) Error() string
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path is java.nio.file.Path as its string form. Options arguments (LinkOption, CopyOption, FileAttribute) arrive as an ignored []any: only the default behaviour is implemented.
func CreateTempDir ¶
func CreateTempDir() *Path
CreateTempDir backs an @TempDir field; RemoveTempDir deletes it after the class.
func FilesCreateDirectories ¶
func FilesCreateTempFile ¶
FilesCreateTempFile is Files.createTempFile(prefix, suffix, attrs...).
func FilesReadSymbolicLink ¶
func (*Path) GetFileName ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern and Matcher are java.util.regex over Go's RE2 (no backreferences or lookaround).
func PatternCompile ¶
\p{Punct} (Java) is [:punct:] inside a Go class.
type PrintStream ¶
PrintStream is java.io.PrintStream where a stream is only written to: System.out and System.err are *os.File, a constructed one is a *CapturedStream.
type ProgressMonitorWrapper ¶
type ProgressMonitorWrapper struct{ IProgressMonitor }
ProgressMonitorWrapper forwards every call to the wrapped monitor.
func NewProgressMonitorWrapper ¶
func NewProgressMonitorWrapper(m IProgressMonitor) *ProgressMonitorWrapper
func (*ProgressMonitorWrapper) GetWrappedProgressMonitor ¶
func (w *ProgressMonitorWrapper) GetWrappedProgressMonitor() IProgressMonitor
type Random ¶
type Random struct {
// contains filtered or unexported fields
}
Random is java.util.Random's 48-bit LCG, so a fixed seed gives Java's sequence.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader stands for BufferedReader, InputStreamReader and FileReader alike.
func NewBufferedReader ¶
func NewFileReader ¶
func NewInputStreamReader ¶
func NewInputStreamReader(in InputStream) *Reader
type RejectedExecutionException ¶
type RejectedExecutionException struct{ RuntimeException }
func NewRejectedExecutionException ¶
func NewRejectedExecutionException(args ...any) *RejectedExecutionException
type ResourceBundle ¶
type ResourceBundle struct {
// contains filtered or unexported fields
}
ResourceBundle is java.util.ResourceBundle backed by a <name>.properties file in the registered resource FS (RegisterResources). No locale fallback chain: only the base bundle is read.
func ResourceBundleGetBundle ¶
func ResourceBundleGetBundle(name string) *ResourceBundle
Read on first GetString: a package var initializer may run before the embedding package registers its FS.
func (*ResourceBundle) GetString ¶
func (b *ResourceBundle) GetString(key string) string
type Runnable ¶
type Runnable interface {
Run()
}
Runnable is java.lang.Runnable. Lambdas and anonymous classes become *RunnableFunc: a pointer, so two runnables compare by identity (Display.timerExec looks a runnable up with ==).
type RunnableFunc ¶
type RunnableFunc struct {
Fn func()
}
func NewRunnable ¶
func NewRunnable(fn func()) *RunnableFunc
func (*RunnableFunc) Run ¶
func (r *RunnableFunc) Run()
type RuntimeException ¶
RuntimeException and JavaError carry their own Message/Cause instead of sharing an embedded Throwable - see README "Manual superclass embedding" for why, and the ceiling this leaves.
func NewRuntimeException ¶
func NewRuntimeException(message string) RuntimeException
func (*RuntimeException) Error ¶
func (e *RuntimeException) Error() string
func (*RuntimeException) GetMessage ¶
func (e *RuntimeException) GetMessage() string
func (*RuntimeException) PrintStackTrace ¶
func (e *RuntimeException) PrintStackTrace()
func (*RuntimeException) Unwrap ¶
func (e *RuntimeException) Unwrap() error
type SimpleDateFormat ¶
type SimpleDateFormat = DateFormat
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is java.util.Stack.
type Status ¶
func (*Status) GetException ¶
func (*Status) GetMessage ¶
func (*Status) GetSeverity ¶
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
StringBuilder is java.lang.StringBuilder. It holds UTF-16 units, so indices and Length match Java.
func NewStringBuilder ¶
func NewStringBuilder(init ...any) *StringBuilder
NewStringBuilder covers (), (int capacity) and (String).
func (*StringBuilder) Append ¶
func (s *StringBuilder) Append(v any, offsetLen ...int32) *StringBuilder
Append covers append(x) and append(char[], offset, len).
func (*StringBuilder) CharAt ¶
func (s *StringBuilder) CharAt(i int32) uint16
func (*StringBuilder) Delete ¶
func (s *StringBuilder) Delete(start, end int32) *StringBuilder
func (*StringBuilder) DeleteCharAt ¶
func (s *StringBuilder) DeleteCharAt(i int32) *StringBuilder
func (*StringBuilder) GetChars ¶
func (s *StringBuilder) GetChars(srcBegin, srcEnd int32, dst []uint16, dstBegin int32)
GetChars is getChars(srcBegin, srcEnd, dst, dstBegin).
func (*StringBuilder) IndexOf ¶
func (s *StringBuilder) IndexOf(sub string) int32
func (*StringBuilder) Insert ¶
func (s *StringBuilder) Insert(at int32, v any) *StringBuilder
func (*StringBuilder) IsEmpty ¶
func (s *StringBuilder) IsEmpty() bool
func (*StringBuilder) Length ¶
func (s *StringBuilder) Length() int32
func (*StringBuilder) Replace ¶
func (sb *StringBuilder) Replace(start, end int32, s string) *StringBuilder
func (*StringBuilder) SetLength ¶
func (s *StringBuilder) SetLength(n int32)
func (*StringBuilder) String ¶
func (s *StringBuilder) String() string
func (*StringBuilder) ToString ¶
func (s *StringBuilder) ToString() string
type StringTokenizer ¶
type StringTokenizer struct {
// contains filtered or unexported fields
}
StringTokenizer is java.util.StringTokenizer over a set of delimiter characters.
func NewStringTokenizer ¶
func NewStringTokenizer(s string, delim ...string) *StringTokenizer
func (*StringTokenizer) HasMoreTokens ¶
func (t *StringTokenizer) HasMoreTokens() bool
func (*StringTokenizer) NextToken ¶
func (t *StringTokenizer) NextToken() string
type Thread ¶
type Thread struct {
// contains filtered or unexported fields
}
Thread is java.lang.Thread for `new Thread(runnable)` + start/join; the port's `Thread` type itself stays a bare any (Display.thread), see Manual.
type TimeUnit ¶
type TimeUnit int32
TimeUnit is java.util.concurrent.TimeUnit; only the units below are modeled.
type TimeoutException ¶
type TimeoutException struct{ RuntimeException }
func NewTimeoutException ¶
func NewTimeoutException(args ...any) *TimeoutException
type TreeSet ¶
type TreeSet struct{ *List }
TreeSet is a sorted set of int32 or string elements (Image.ImageHandleManager's zoom set).
func NewTreeSet ¶
func (*TreeSet) Add ¶
Add keeps items sorted by binary insertion: StyledText fills a set with every line index on setText.
type URI ¶
type URI struct {
// contains filtered or unexported fields
}
URI is java.net.URI as its string form (Path.toUri().toString()).
func (*URI) GetQuery ¶
GetQuery is URI.getQuery(): the raw-decoded query, null (the empty string here) without one.
type URISyntaxException ¶
type URISyntaxException struct{ RuntimeException }
URISyntaxException is new URISyntaxException(input, reason).
func NewURISyntaxException ¶
func NewURISyntaxException(input, reason string) *URISyntaxException
type WeakReference ¶
type WeakReference struct {
// contains filtered or unexported fields
}
WeakReference is java.lang.ref.WeakReference over a pointer boxed in any.
func NewWeakReference ¶
func NewWeakReference(v any) *WeakReference
func (*WeakReference) Get ¶
func (w *WeakReference) Get() any
Get is nil once the referent is collected; the caller casts the result.