Skip to content

Commit

Permalink
revert-unexpected-merge (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
wongoo authored Oct 23, 2022
1 parent 868e06e commit e13beea
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 65 deletions.
4 changes: 0 additions & 4 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ func getListType(javalistname string) reflect.Type {
}

tp := tpStructInfo.typ
// if tp is enum, return nil
if tp.Implements(javaEnumType) {
return nil
}
if tp.Kind() != reflect.Ptr {
tp = reflect.New(tp).Type()
}
Expand Down
52 changes: 0 additions & 52 deletions object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"encoding/json"
"math"
"reflect"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -1062,54 +1061,3 @@ func TestDecodeSliceIntegerHasNull(t *testing.T) {
RegisterPOJO(&User{})
testDecodeFramework(t, "customReplyTypedListIntegerHasNull", &User{Id: 0, List: []int32{1, 0}})
}

func TestDecodeCustomReplyEnumVariableList(t *testing.T) {
for v := range _LocaleCategoryEnumValues {
RegisterJavaEnum(v)
}

got, err := decodeJavaResponse(`customReplyEnumVariableList`, ``, false)
assert.NoError(t, err)
t.Logf("%T %+v", got, got)
el := []interface{}{JavaEnum(0), nil, JavaEnum(1)}
assert.True(t, reflect.DeepEqual(got, el))
}

const (
LocaleCategoryEnumDisplay LocaleCategoryEnum = iota
LocaleCategoryEnumFormat
)

var (
_LocaleCategoryEnumValues = map[LocaleCategoryEnum]string{
LocaleCategoryEnumDisplay: "DISPLAY",
LocaleCategoryEnumFormat: "FORMAT",
}

_LocaleCategoryEnumEntities = map[string]LocaleCategoryEnum{
"DISPLAY": LocaleCategoryEnumDisplay,
"FORMAT": LocaleCategoryEnumFormat,
}
)

type LocaleCategoryEnum JavaEnum

func (e LocaleCategoryEnum) JavaClassName() string {
return "java.util.Locale$Category"
}

func (e LocaleCategoryEnum) String() string {
if v, ok := _LocaleCategoryEnumValues[e]; ok {
return v
}

return strconv.Itoa(int(e))
}

func (e LocaleCategoryEnum) EnumValue(s string) JavaEnum {
if v, ok := _LocaleCategoryEnumEntities[s]; ok {
return JavaEnum(v)
}

return InvalidJavaEnum
}
9 changes: 0 additions & 9 deletions test_hessian/src/main/java/test/TestCustomReply.java
Original file line number Diff line number Diff line change
Expand Up @@ -693,15 +693,6 @@ public void customReplyEnumSet() throws Exception {
output.writeObject(map);
output.flush();
}

public void customReplyEnumVariableList() throws Exception {
List<Locale.Category> enumList = new ArrayList<>();
enumList.add(Locale.Category.DISPLAY);
enumList.add(null);
enumList.add(Locale.Category.FORMAT);
output.writeObject(enumList.toArray(new Locale.Category[enumList.size()]));
output.flush();
}
}

interface Leg {
Expand Down

0 comments on commit e13beea

Please sign in to comment.