[
https://issues.apache.org/jira/browse/OFBIZ-6291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14509298#comment-14509298 ]
Gareth Carter commented on OFBIZ-6291:
--------------------------------------
"int i = foo.compareTo(baz); return i <= 0; this is an anti-pattern. Remove the use of the local variable." - Really? Creating a local variable that is useful for debugging is considered an anti pattern? Can you provide a source?
I doubt it's that much slower but will do some testing on it. See
http://stackoverflow.com/questions/103564/the-performance-impact-of-using-instanceof-in-java for some performance tests.
Personally, I think catching and swallowing any exceptions into a blackhole for this purpose is an anti pattern.
http://www.odi.ch/prog/design/newbies.php> Update code to check for types rather than throw ClassCastException
> -------------------------------------------------------------------
>
> Key: OFBIZ-6291
> URL:
https://issues.apache.org/jira/browse/OFBIZ-6291> Project: OFBiz
> Issue Type: Improvement
> Components: framework
> Affects Versions: Trunk
> Reporter: Gareth Carter
> Priority: Trivial
> Attachments: LocalizedConverters.patch, minilang_compare.patch, minilang_compare_r1675655.patch
>
>
> framework/minilang/src/org/ofbiz/minilang/method/conditional/Compare.java
> framework/base/src/org/ofbiz/base/util/ObjectType.java
> framework/minilang/src/org/ofbiz/minilang/MiniLangUtil.java
> all throw ClassCastExceptions and are ignored instead of checking types
> This caused issues in debugging when adding a ClassCastException breakpoint
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)