-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve some code details, fix some bugs #3314
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…y are NOT inheritable
单测跑不过呢,你本地执行下mvn test试下 |
我本地是可以的。 IOUtils.toString(zipIn, "UTF-8");
// =>
IOUtils.toString(zipIn, StandardCharsets.UTF_8) 。 <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
<!-- 只加了上面这一行,不然 Windows 上执行单元测试,有两个case会因为中文字符乱码导致断言失败 -->
<includes>
<include>com/alibaba/fastjson2/**/*.java</include>
</includes>
<systemPropertyVariables>
<user.timezone>Asia/Shanghai</user.timezone>
</systemPropertyVariables>
</configuration>
</plugin> 我现在只能先尝试,先注释掉这一行,再看看效果。 |
把问题拆开成多个PR,现在这样改的文件太多,无法Review的 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it?
Summary of your change
StringBuilder
替代StringBuffer
、精简不必要的泛型声明、使用 Lambda 简化匿名类;使用Class::method
简化 Lambda、减少不必要的拆箱/装箱、使用Objects.hash
+Objects.equals
简化单元测试中的JavaBean定义 )containsKey( key ) + get( key )
简化为一次get( key )
调用( 仅限value
不为null
的场景),containsKey( key ) + remove( key )
简化为一次remove( key )
调用。String.replace()
替代String.replaceAll()
,避免不必要的正则表达式处理开销。java.nio.charset.StandardCharsets#UTF_8
常量引用,避免Charset.forName()
及 相关异常声明。com.alibaba.fastjson.util.TypeUtils#castToJavaBean(java.util.Map<java.lang.String,java.lang.Object>, java.lang.Class<T>, com.alibaba.fastjson.parser.ParserConfig)
和com.alibaba.fastjson2_demo.Int2Decoder#acceptField
。StringBuilder
类的初始化容量,避免中途循环遍历的多次扩容开销。Please indicate you've done the following: