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

[Feature] update commons-lang to commons-lang3 #1824

Closed
2 tasks done
husofskyzy opened this issue Mar 29, 2022 · 1 comment
Closed
2 tasks done

[Feature] update commons-lang to commons-lang3 #1824

husofskyzy opened this issue Mar 29, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@husofskyzy
Copy link
Contributor

husofskyzy commented Mar 29, 2022

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Problem Description

No response

Description

1.1 The general commons-lang method can be directly upgraded to the commons-lang3 method

The main modification is to convert some passed parameters from String to charSequences. Passing String parameters is feasible in most cases.

1.2 When commons-lang method is passed as String[] {"tom","lucy","bob"} commons-lang3 method is passed as charSequences

Strings, String[], charSequences, CharSequence[] in java code can be converted

In the scala code, String[] to charSequences will merge String array parameters into a string by default, which requires special declaration

val closeBrackets = Array("}", ")", "]")
commons-lang parameter method StringUtils.endsWithAny(real, openBrackets)
commons-lang3 parameter passing method StringUtils.endsWithAny(real, openBrackets: _*)

1.3 org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace replaces org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace

1.4 When the ClassUtils.getClass(className) method under commons-lang is replaced by the commons-lang3 package, you need to add a forced conversion (Class<? extends LabelBuilderFactory>) ClassUtils.getClass(className);


1.1 一般commons-lang方法可以直接升级为commons-lang3的方法

主要修改是将一些传参从String转为charSequences,在多数情况下传String参数都可行.

1.2 当commons-lang方法传参为String[] {"tom","lucy","bob"} commons-lang3方法传参为charSequences

java代码中Strings,String[],charSequences,CharSequence[]可以转换

scala代码中String[]转charSequences会默认合并String数组参数成一个字符串,需要特殊声明

val closeBrackets = Array("}", ")", "]")
commons-lang传参方法 StringUtils.endsWithAny(real, openBrackets)
commons-lang3传参方法 StringUtils.endsWithAny(real, openBrackets: _*)

1.3 org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace 替换 org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace

1.4 commons-lang下ClassUtils.getClass(className) 方法使用commons-lang3包替换时需要添加强转(Class<? extends LabelBuilderFactory>) ClassUtils.getClass(className);

Use case

No response

solutions

No response

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
@peacewong
Copy link
Contributor

This needs to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants