Skip to content

Commit

Permalink
Merge branch 'golang:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Jpjames1 authored Sep 5, 2024
2 parents 487319d + 7c49166 commit cbe0529
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
8 changes: 4 additions & 4 deletions bind/genclasses.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (g *ClassGen) genCMethodBody(cls *java.Class, f *java.Func, virtual bool) {
g.Printf("Nonvirtual")
}
if f.Ret != nil {
g.Printf(f.Ret.JNICallType())
g.Printf("%s", f.Ret.JNICallType())
} else {
g.Printf("Void")
}
Expand Down Expand Up @@ -430,7 +430,7 @@ func (g *ClassGen) genFuncDecl(local bool, fs *java.FuncSet) {
if i == len(fs.Params)-1 && fs.Variadic {
g.Printf("...")
}
g.Printf(g.goType(a, local))
g.Printf("%s", g.goType(a, local))
}
g.Printf(")")
if fs.Throws {
Expand Down Expand Up @@ -879,7 +879,7 @@ func (g *ClassGen) genInterface(cls *java.Class) {
if !g.isFuncSetSupported(fs) {
continue
}
g.Printf(fs.GoName)
g.Printf("%s", fs.GoName)
g.genFuncDecl(true, fs)
g.Printf("\n")
}
Expand All @@ -904,7 +904,7 @@ func flattenName(n string) string {
return strings.Replace(strings.Replace(n, ".", "_", -1), "$", "_", -1)
}

var (
const (
classesPkgHeader = gobindPreamble + `
package Java
Expand Down
2 changes: 1 addition & 1 deletion bind/gengo.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (g *goGen) genInterface(obj *types.TypeName) {
g.Printf(") ")

if res.Len() == 1 {
g.Printf(g.typeString(res.At(0).Type()))
g.Printf("%s", g.typeString(res.At(0).Type()))
} else if res.Len() == 2 {
g.Printf("(%s, error)", g.typeString(res.At(0).Type()))
}
Expand Down
18 changes: 9 additions & 9 deletions bind/genjava.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func (g *JavaGen) genConstructor(f *types.Func, n string, jcls bool) {
if i > 0 {
g.Printf(", ")
}
g.Printf(g.paramName(params, i))
g.Printf("%s", g.paramName(params, i))
}
g.Printf(");\n")
}
Expand All @@ -447,7 +447,7 @@ func (g *JavaGen) genConstructor(f *types.Func, n string, jcls bool) {
if i > 0 {
g.Printf(", ")
}
g.Printf(g.paramName(params, i))
g.Printf("%s", g.paramName(params, i))
}
g.Printf(");\n")
g.Printf("Seq.trackGoRef(refnum, this);\n")
Expand Down Expand Up @@ -757,21 +757,21 @@ func (g *JavaGen) genJNIFuncSignature(o *types.Func, sName string, jm *java.Func
g.Printf("Java_%s_", g.jniPkgName())
if sName != "" {
if proxy {
g.Printf(java.JNIMangle(g.className()))
g.Printf("%s", java.JNIMangle(g.className()))
// 0024 is the mangled form of $, for naming inner classes.
g.Printf("_00024proxy%s", sName)
} else {
g.Printf(java.JNIMangle(g.javaTypeName(sName)))
g.Printf("%s", java.JNIMangle(g.javaTypeName(sName)))
}
} else {
g.Printf(java.JNIMangle(g.className()))
g.Printf("%s", java.JNIMangle(g.className()))
}
g.Printf("_")
if jm != nil {
g.Printf(jm.JNIName)
g.Printf("%s", jm.JNIName)
} else {
oName := javaNameReplacer(lowerFirst(o.Name()))
g.Printf(java.JNIMangle(oName))
g.Printf("%s", java.JNIMangle(oName))
}
g.Printf("(JNIEnv* env, ")
if sName != "" {
Expand Down Expand Up @@ -839,9 +839,9 @@ func (g *JavaGen) genFuncSignature(o *types.Func, jm *java.Func, hasThis bool) {

g.Printf("%s ", ret)
if jm != nil {
g.Printf(jm.Name)
g.Printf("%s", jm.Name)
} else {
g.Printf(javaNameReplacer(lowerFirst(o.Name())))
g.Printf("%s", javaNameReplacer(lowerFirst(o.Name())))
}
g.Printf("(")
g.genFuncArgs(o, jm, hasThis)
Expand Down
2 changes: 1 addition & 1 deletion bind/genobjc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ func (g *ObjcGen) genStructH(obj *types.TypeName, t *types.Struct) {
if oinf != nil {
for _, sup := range oinf.supers {
if !sup.Protocol {
g.Printf(sup.Name)
g.Printf("%s", sup.Name)
} else {
prots = append(prots, sup.Name)
}
Expand Down
10 changes: 4 additions & 6 deletions bind/genobjcw.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,13 @@ func (g *ObjcWrapper) genCFuncDecl(prefix, name string, f *objc.Func) {
case ret != nil && returnsErr:
g.Printf("ret_%s", strings.Replace(g.cType(ret), " ", "_", -1))
case ret != nil:
g.Printf(g.cType(ret))
g.Printf("%s", g.cType(ret))
case returnsErr:
g.Printf("int")
default:
g.Printf("void")
}
g.Printf(" ")
g.Printf(prefix)
g.Printf(" %s", prefix)
if f.Static {
g.Printf("_s")
}
Expand Down Expand Up @@ -397,8 +396,7 @@ func (g *ObjcWrapper) genFuncBody(n *objc.Named, f *objc.Func, prefix string) {
if ret != nil || errParam != nil {
g.Printf("res := ")
}
g.Printf("C.")
g.Printf(prefix)
g.Printf("C.%s", prefix)
if f.Static {
g.Printf("_s")
}
Expand Down Expand Up @@ -575,7 +573,7 @@ func (g *ObjcWrapper) genInterface(n *objc.Named) {
if !g.isFuncSupported(f) {
continue
}
g.Printf(f.GoName)
g.Printf("%s", f.GoName)
g.genFuncDecl(true, f)
g.Printf("\n")
}
Expand Down
5 changes: 3 additions & 2 deletions internal/binres/binres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"bytes"
"encoding"
"encoding/xml"
"errors"
"fmt"
"io/ioutil"
"log"
Expand Down Expand Up @@ -103,7 +104,7 @@ func compareBytes(a, b []byte) error {
fmt.Fprint(buf, "... output truncated.\n")
}
}
return fmt.Errorf(buf.String())
return errors.New(buf.String())
}

func TestBootstrap(t *testing.T) {
Expand Down Expand Up @@ -329,7 +330,7 @@ func compareElements(have, want *XML) error {
}
}
if buf.Len() > 0 {
return fmt.Errorf(buf.String())
return errors.New(buf.String())
}
return nil
}
Expand Down

0 comments on commit cbe0529

Please sign in to comment.