diff --git a/Contributing.md b/Contributing.md
index 8e8ca5da..e8bf3ecd 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -12,3 +12,4 @@ If you contributed but cannot find your ID here, please submit PR and add your G
- walkertest
- woodwind
- XenoAmess
+- yukkiball
diff --git a/core/src/main/java/com/qq/tars/protocol/util/EncodingUtils.java b/core/src/main/java/com/qq/tars/protocol/util/EncodingUtils.java
deleted file mode 100644
index ccdf038e..00000000
--- a/core/src/main/java/com/qq/tars/protocol/util/EncodingUtils.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Tencent is pleased to support the open source community by making Tars available.
- *
- * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
- *
- * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * https://opensource.org/licenses/BSD-3-Clause
- *
- * Unless required by applicable law or agreed to in writing, software distributed
- * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-package com.qq.tars.protocol.util;
-
-public class EncodingUtils {
- public EncodingUtils() {
- }
-
- public static final boolean testBit(byte v, int position) {
- return testBit((int)v, position);
- }
-
- public static final boolean testBit(short v, int position) {
- return testBit((int)v, position);
- }
-
- public static final boolean testBit(int v, int position) {
- return (v & 1 << position) != 0;
- }
-
- public static final boolean testBit(long v, int position) {
- return (v & 1L << position) != 0L;
- }
-
- public static final byte clearBit(byte v, int position) {
- return (byte)clearBit((int)v, position);
- }
-
- public static final short clearBit(short v, int position) {
- return (short)clearBit((int)v, position);
- }
-
- public static final int clearBit(int v, int position) {
- return v & ~(1 << position);
- }
-
- public static final long clearBit(long v, int position) {
- return v & ~(1L << position);
- }
-
- public static final byte setBit(byte v, int position, boolean value) {
- return (byte)setBit((int)v, position, value);
- }
-
- public static final short setBit(short v, int position, boolean value) {
- return (short)setBit((int)v, position, value);
- }
-
- public static final int setBit(int v, int position, boolean value) {
- return value ? v | 1 << position : clearBit(v, position);
- }
-
- public static final long setBit(long v, int position, boolean value) {
- return value ? v | 1L << position : clearBit(v, position);
- }
-}
diff --git a/docs-en/tars-http-server.md b/docs-en/tars-http-server.md
index 42126f46..2f20d492 100644
--- a/docs-en/tars-http-server.md
+++ b/docs-en/tars-http-server.md
@@ -56,7 +56,7 @@ The following configuration needs to be added in pom.xml:
com.tencent.tars
tars-spring-boot-starter
- 1.7.2
+ 1.7.0
```
diff --git a/tools/tars-maven-plugin/src/main/java/com/qq/tars/maven/gensrc/Tars2JavaMojo.java b/tools/tars-maven-plugin/src/main/java/com/qq/tars/maven/gensrc/Tars2JavaMojo.java
index 508c6bbb..fbb7db9c 100644
--- a/tools/tars-maven-plugin/src/main/java/com/qq/tars/maven/gensrc/Tars2JavaMojo.java
+++ b/tools/tars-maven-plugin/src/main/java/com/qq/tars/maven/gensrc/Tars2JavaMojo.java
@@ -61,8 +61,6 @@ public class Tars2JavaMojo extends AbstractMojo {
private AtomicInteger var = new AtomicInteger(0);
- enum IsSetType {ISSET_NONE, ISSET_PRIMITIVE, ISSET_BITSET}
-
public void execute() throws MojoExecutionException, MojoFailureException {
// 1. check configurations
if (!tars2JavaConfig.packagePrefixName.endsWith(".")) {
@@ -291,27 +289,6 @@ private void genStruct(String dirPath, String packageName, String namespace, Tar
}
out.println();
- // isset data
- int optionals = 0;
- for (TarsStructMember m : struct.memberList()) {
- if (!typeCanBeNull(m.memberType(), nsMap)) {
- out.println("\tprivate static final int __" + m.memberName().toUpperCase() + "_ISSET_ID = " + optionals + ";");
- optionals++;
- }
- }
- StringBuilder outprimitiveType = new StringBuilder("");
- IsSetType isSetType = needIsSet(struct, outprimitiveType, nsMap);
- switch (isSetType){
- case ISSET_NONE:
- break;
- case ISSET_PRIMITIVE:
- out.println("\tprivate " + outprimitiveType.toString() + " __isset_bitfield = 0;");
- break;
- case ISSET_BITSET:
- out.println("\tprivate java.util.BitSet __isset_bit_vector = new java.util.BitSet(" + optionals + ");");
- }
- out.println();
-
// 生成 getter setter
for (TarsStructMember m : struct.memberList()) {
out.println("\tpublic " + type(m.memberType(), nsMap) + " " + fieldGetter(m.memberName(), m.memberType()) + "() {");
@@ -321,36 +298,6 @@ private void genStruct(String dirPath, String packageName, String namespace, Tar
out.println("\tpublic void " + fieldSetter(m.memberName(), m.memberType()) + "(" + type(m.memberType(), nsMap) + " " + m.memberName() + ") {");
out.println("\t\tthis." + m.memberName() + " = " + m.memberName() + ";");
- if (!typeCanBeNull(m.memberType(), nsMap)) {
- out.println("\t\tset" + firstUpStr(m.memberName()) + "IsSet(true);");
- }
- out.println("\t}");
- out.println();
-
- // isSet method
- out.println("\t/** Returns true if field " + m.memberName() + " is set (has been assigned a value) and false otherwise */");
- out.println("\tpublic boolean isSet" + firstUpStr(m.memberName()) + "() {");
- if (typeCanBeNull(m.memberType(), nsMap)) {
- out.println("\t\treturn this." + m.memberName() + " != null;");
- } else if (isSetType == IsSetType.ISSET_PRIMITIVE) {
- out.println("\t\treturn EncodingUtils.testBit(__isset_bitfield, __" + m.memberName().toUpperCase() + "_ISSET_ID);");
- } else {
- out.println("\t\treturn __isset_bit_vector.get(__" + m.memberName().toUpperCase() + "_ISSET_ID);");
- }
- out.println("\t}");
- out.println();
-
- // setFieldIsSet method
- out.println("\tpublic void set" + firstUpStr(m.memberName()) + "IsSet(boolean value) {");
- if (typeCanBeNull(m.memberType(), nsMap)) {
- out.println("\t\tif (!value) {");
- out.println("\t\t\tthis." + m.memberName() + " = null;");
- out.println("\t\t}");
- } else if (isSetType == IsSetType.ISSET_PRIMITIVE) {
- out.println("\t\t__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __" + m.memberName().toUpperCase() + "_ISSET_ID, value);");
- } else {
- out.println("\t\t__isset_bit_vector.set(__" + m.memberName().toUpperCase() + "_ISSET_ID, value);");
- }
out.println("\t}");
out.println();
}
@@ -451,40 +398,22 @@ private void genStruct(String dirPath, String packageName, String namespace, Tar
out.println("\t@Override");
out.println("\tpublic String toString() {");
out.println("\t\tStringBuilder sb = new StringBuilder(\"" + struct.structName() + "(\");");
- out.println("\t\tboolean first = true;");
- out.println();
boolean first = true;
for (TarsStructMember m : struct.memberList()) {
- boolean couldBeUnSet = !m.isRequire();
- if (couldBeUnSet){
- out.println("\t\tif (isSet" + firstUpStr(m.memberName()) + "()) {");
- }
if (!first) {
- if (couldBeUnSet) out.print("\t");
- out.println("\t\tif (!first) sb.append(\", \");");
+ out.println("\t\tsb.append(\", \");");
}
- if (couldBeUnSet) out.print("\t");
out.println("\t\tsb.append(\"" + m.memberName() + ":\");");
boolean canBeNull = typeCanBeNull(m.memberType(), nsMap);
if (canBeNull) {
- if (couldBeUnSet) out.print("\t");
out.println("\t\tif (this." + m.memberName() + " == null) {");
- if (couldBeUnSet) out.print("\t");
out.println("\t\t\tsb.append(\"null\");");
- if (couldBeUnSet) out.print("\t");
out.println("\t\t} else {");
out.print("\t");
}
- if (couldBeUnSet) out.print("\t");
out.println("\t\tsb.append(this." + m.memberName() + ");");
if (canBeNull) {
- if (couldBeUnSet) out.print("\t");
- out.println("\t\t}");
- }
- if (couldBeUnSet) out.print("\t");
- out.println("\t\tfirst = false;");
- if (couldBeUnSet) {
out.println("\t\t}");
}
first = false;
@@ -862,33 +791,6 @@ private boolean typeCanBeNull(TarsType jt, Map> nsMa
return canBeNull;
}
- private IsSetType needIsSet(TarsStruct struct, StringBuilder outPrimitiveType, Map> nsMap) {
- int count = 0;
- for (TarsStructMember m : struct.memberList()) {
- if (!typeCanBeNull(m.memberType(), nsMap)) {
- count++;
- }
- }
- if (count == 0) {
- return IsSetType.ISSET_NONE;
- } else if (count <= 64){
- if (outPrimitiveType != null) {
- if (count <= 8) {
- outPrimitiveType.append("byte");
- } else if (count <= 16) {
- outPrimitiveType.append("short");
- } else if (count <= 32) {
- outPrimitiveType.append("int");
- } else if (count <= 64) {
- outPrimitiveType.append("long");
- }
- }
- return IsSetType.ISSET_PRIMITIVE;
- } else {
- return IsSetType.ISSET_BITSET;
- }
- }
-
private String typeInit(TarsType jt, Map> nsMap, boolean useDefault) {
if (!useDefault) {
if (jt.isPrimitive()) {