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

Improvement of CharacterEditor.setAsText() and setAsUnicode() [SPR-12386] #16994

Closed
spring-projects-issues opened this issue Oct 28, 2014 · 2 comments
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 28, 2014

Kang Baek-Kyu opened SPR-12386 and commented

The java.lang.Character.valueOf(char c) returns a Character instance representing the specified char value. If a new Character instance is not required, this method should generally be used in preference to the constructor Character(char), as this method is likely to yield significantly better space and time performance by caching frequently requested values.

This method will always cache values in the range '\u0000' to '\u007F', inclusive, and may cache other values outside of this range.

So I changed source like this

setValue(new Character(text.charAt(0)));
-> setValue(Character.valueOf(text.charAt(0)));

setValue(new Character((char)code));
-> setValue(Character.valueOf((char) code));


Affects: 4.1.1

Reference URL: #683

Referenced from: commits 1e9ab53

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 28, 2014

Juergen Hoeller commented

Good catch! I've applied this as part of a general CharacterEditor revision.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 28, 2014

Kang Baek-Kyu commented

Thanks Juergen!

@spring-projects-issues spring-projects-issues added type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.1.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants