github.com/F4RD1N/gomobile@v1.0.1/bind/testdata/testpkg/javapkg/java.go (about) 1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package javapkg 6 7 import ( 8 "Java/java/lang/Float" 9 "Java/java/lang/Integer" 10 "Java/java/lang/System" 11 "Java/java/util/Collections" 12 "Java/java/util/jar/JarFile" 13 "fmt" 14 ) 15 16 func SystemCurrentTimeMillis() int64 { 17 return System.CurrentTimeMillis() 18 } 19 20 func FloatMin() float32 { 21 return Float.MIN_VALUE 22 } 23 24 func ManifestName() string { 25 return JarFile.MANIFEST_NAME 26 } 27 28 func IntegerBytes() int { 29 return Integer.SIZE 30 } 31 32 func IntegerValueOf(v int32) int32 { 33 i, _ := Integer.ValueOf(v) 34 return i.IntValue() 35 } 36 37 func IntegerDecode(v string) (int32, error) { 38 i, err := Integer.Decode(v) 39 if err != nil { 40 return 0, fmt.Errorf("wrapped error: %v", err) 41 } 42 // Call methods from super class 43 i.HashCode() 44 return i.IntValue(), nil 45 } 46 47 func IntegerParseInt(v string, radix int32) (int32, error) { 48 return Integer.ParseInt(v, radix) 49 } 50 51 func ProvokeRuntimeException() (err error) { 52 defer func() { 53 err = recover().(error) 54 }() 55 Collections.Copy(nil, nil) 56 return 57 }