You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/06/20 15:26:37 UTC

[GitHub] [commons-lang] garydgregory commented on pull request #773: Object Casting

garydgregory commented on pull request #773:
URL: https://github.com/apache/commons-lang/pull/773#issuecomment-864571151


   There is a mismatch here between the code, the Javadoc, and the PR description. Where is the actual intent expressed? Specifically, the description and Javadoc do not state that class cast exceptions are effectively escaped into null returned values. This is quite unexpected since the PR and Javadoc only talk about the method as a null-safe shorthand utility. 
   
   If the method is to only be a null-safe shorthand wrapper then 'cast' is fine as the method name, but if the internet is to add logic to return null values for illegal casts, then the name needs to be different in order to allow for a method that only does the null safe check but allows for CCE.
   
   In the end, the real value of such a low-level shorthand method is better evaluated if Commons Lang itself is made to use it internally.  Are there sites within Lang that can make use of this utility?
   
   I'll sprinkle comments in the code as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org