Skip to content
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, fix some bugs #3320

Merged
merged 13 commits into from
Jan 25, 2025
Merged

Improve some code, fix some bugs #3320

merged 13 commits into from
Jan 25, 2025

Conversation

CodePlayer
Copy link
Contributor

What this PR does / why we need it?

Summary of your change

  1. 基于 JDK 8 现有特性对齐代码,精简部分冗余代码( 例如:使用 StringBuilder 替代 StringBuffer、使用 Class::method 简化 Lambda、减少不必要的拆箱/装箱 )
  2. 封装并复用部分方法,减少部分重复代码
  3. 改进部分 Map集合 的迭代处理,例如:将 containsKey( key ) + get( key ) 简化为一次 get( key ) 调用( 仅限 value 不为 null 的场景),containsKey( key ) + remove( key ) 简化为一次 remove( key ) 调用。
  4. 修复 BUG [BUG] 单引号的原始值boolean无法解析进对象 #3283
  5. 使用 String.replace() 替代 String.replaceAll(),避免不必要的正则表达式处理开销。
  6. 改进 部分访问修饰符的可见性与一致性
  7. 修正 潜在的条件分支错误,例如: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
  8. 改进部分 集合类 的初始化容量,避免中途循环遍历的多次扩容开销。

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@wenshao wenshao merged commit 3016e80 into alibaba:main Jan 25, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants