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

Use static factory methods for wrapper types #13

Closed
marschall opened this issue Nov 20, 2016 · 4 comments · Fixed by #84
Closed

Use static factory methods for wrapper types #13

marschall opened this issue Nov 20, 2016 · 4 comments · Fixed by #84
Assignees
Projects

Comments

@marschall
Copy link
Contributor

The driver currently instantiates wrapper types (Integer, Long, …) by directly calling the constructor using new rather than by calling the static valueOf factory methods. This is discouraged and deprecated in Java 9. To quote from the Integer constructor

It is rarely appropriate to use this constructor. The static factory valueOf(int) is generally a better choice, as it is likely to yield significantly better space and time performance.

@ajlam
Copy link
Member

ajlam commented Nov 21, 2016

Filing as follow-up for JDK9.

@ajlam ajlam added the JDK9 label Nov 21, 2016
@marschall
Copy link
Contributor Author

This is not really a JDK9 issue. Is this more a performance issue as the status valueOf methods reduce pressure on both the allocator and the heap.

@ajlam
Copy link
Member

ajlam commented Nov 21, 2016

@marschall - Understood. The tag is for following up when we schedule our work for JDK9 support.

@xiangyushawn
Copy link
Contributor

Thank you @marschall. I’m closing this issue since the PR has been merged.

lilgreenbird pushed a commit to lilgreenbird/mssql-jdbc that referenced this issue Aug 24, 2020
@lilgreenbird lilgreenbird added this to Closed Issues in MSSQL JDBC Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
MSSQL JDBC
  
Closed Issues
Development

Successfully merging a pull request may close this issue.

4 participants