You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Bob Morley (JIRA)" <ji...@apache.org> on 2009/10/28 20:54:59 UTC

[jira] Created: (OFBIZ-3102) framework - base

framework - base
----------------

                 Key: OFBIZ-3102
                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
             Project: OFBiz
          Issue Type: Sub-task
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Bob Morley




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (OFBIZ-3102) framework - base

Posted by "Adrian Crum (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum closed OFBIZ-3102.
------------------------------

    Resolution: Fixed

Patch committed with changes, rev 831550. Thanks Marc!


> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>            Assignee: Adrian Crum
>         Attachments: OFBIZ-3102 base warning.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-3102) framework - base

Posted by "Marc Morin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771529#action_12771529 ] 

Marc Morin commented on OFBIZ-3102:
-----------------------------------

Generally, we should strive to have no @SuppressWarnings("unchecked") in the code at all.  Ideally, only in 1 or two spots in UtilGenerics where you just can't get around Java generics issues like the following:

List<MyClass> mymethod(List<Input> list) {

    return (List<MyClass>) list;
}

The compiler cannot check the generic type at compile time and will not check at run-time. It will generate a compiler warning.  To now have it show up, you can @SuppressWarnings("unchecked") on the method.

For the normal case in the code, we want to encourage the proper use of generics. An example, which is the bulk of the type of code we're modifying is a hold over of pre-Java 1.5 (I think that's when Generics were introduced).

Map myMethod(Map values) {

    Map newMap = new FastMap(values);
   newMap.put("this", "that");
   return newMap;
}

This will result in warnings related to the generics.  You can make them go away with a big old @SuppressWarnings("unchecked")  on the method, but that isn't as desirable as

Map<String, String> myMethod(Map<String, String> values) {
    Map<String, String> newMap = new FastMap<String, String)(values);
   newMap.put("this", "that");
   return newMap;
}

> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3102 base warning.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-3102) framework - base

Posted by "Adrian Crum (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771478#action_12771478 ] 

Adrian Crum commented on OFBIZ-3102:
------------------------------------

I looked through the patch quickly to get an understanding of the scope of work.

I'm puzzled about one change - if you remove the @SuppressWarnings("unchecked") compiler directive in UelUtil.java, you add a compiler warning instead of remove one.

A small suggestion - when creating templates for Java interfaces, try to use the same template the Java interface uses (for consistency):

public static <X> String getMessage(String resource, String name, List<X> arguments, Locale locale) {

would be better as

public static <E> String getMessage(String resource, String name, List<E> arguments, Locale locale) {

http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html



> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3102 base warning.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OFBIZ-3102) framework - base

Posted by "Marc Morin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marc Morin updated OFBIZ-3102:
------------------------------

    Attachment: OFBIZ-3102 base warning.patch

Patch to remove warnings in framework/base

> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3102 base warning.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-3102) framework - base

Posted by "Marc Morin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771212#action_12771212 ] 

Marc Morin commented on OFBIZ-3102:
-----------------------------------

I'll tackle this an put the patch up

> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-3102) framework - base

Posted by "Adrian Crum (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771535#action_12771535 ] 

Adrian Crum commented on OFBIZ-3102:
------------------------------------

I agree that the @SuppressWarnings("unchecked") compiler directive should be avoided. But by removing it and doing nothing else with the code, you end up with an additional warning. Isn't that counter-productive?



> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3102 base warning.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OFBIZ-3102) framework - base

Posted by "Adrian Crum (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum reassigned OFBIZ-3102:
----------------------------------

    Assignee: Adrian Crum

> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>            Assignee: Adrian Crum
>         Attachments: OFBIZ-3102 base warning.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-3102) framework - base

Posted by "Marc Morin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12771530#action_12771530 ] 

Marc Morin commented on OFBIZ-3102:
-----------------------------------

Agree that the choice of the generic placeholder (X, E, T, ....) should be closest to what the user of the class/function would expect.

In java.util, you see a lot of E, since Collections, Lists, etc.... work on elements.  E being a good choice for that.

I was sloppy and just picked X, which I have historically used for "I don't know what this is" placeholder.

I'll improve the choice going forward on a case by case basis.

> framework - base
> ----------------
>
>                 Key: OFBIZ-3102
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3102
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3102 base warning.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.