You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/02/20 23:53:18 UTC

svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Author: lektran
Date: Sat Feb 20 22:53:18 2010
New Revision: 912245

URL: http://svn.apache.org/viewvc?rev=912245&view=rev
Log:
- Added @SuppressWarnings("hiding") to field module (hides ModelInfo.module)
- Comment typo fix
- Removed a couple of unnecessary casts

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=912245&r1=912244&r2=912245&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
@@ -59,9 +59,10 @@
 @SuppressWarnings("serial")
 public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
 
+    @SuppressWarnings("hiding")
     public static final String module = ModelEntity.class.getName();
 
-    /** The name of the time stamp field for locking/syncronization */
+    /** The name of the time stamp field for locking/synchronization */
     public static final String STAMP_FIELD = "lastUpdatedStamp";
     public static final String STAMP_TX_FIELD = "lastUpdatedTxStamp";
     public static final String CREATE_STAMP_FIELD = "createdStamp";
@@ -1116,7 +1117,7 @@
                 returnString.append(ModelUtil.upperFirstChar(keyMap.fieldName));
                 returnString.append("() + \"&\" + ");
             } else {
-                Debug.logWarning("-- -- ENTITYGEN ERROR:httpRelationArgList: Related Key in Key Map not found for name: " + ((ModelField) flds.get(i)).name + " related entity: " + relation.relEntityName + " main entity: " + relation.mainEntity.entityName + " type: " + relation.type, module);
+                Debug.logWarning("-- -- ENTITYGEN ERROR:httpRelationArgList: Related Key in Key Map not found for name: " + flds.get(i).name + " related entity: " + relation.relEntityName + " main entity: " + relation.mainEntity.entityName + " type: " + relation.type, module);
             }
         }
         ModelKeyMap keyMap = relation.findKeyMapByRelated(flds.get(i).name);
@@ -1132,7 +1133,7 @@
             returnString.append(ModelUtil.upperFirstChar(keyMap.fieldName));
             returnString.append("()");
         } else {
-            Debug.logWarning("-- -- ENTITYGEN ERROR:httpRelationArgList: Related Key in Key Map not found for name: " + ((ModelField) flds.get(i)).name + " related entity: " + relation.relEntityName + " main entity: " + relation.mainEntity.entityName + " type: " + relation.type, module);
+            Debug.logWarning("-- -- ENTITYGEN ERROR:httpRelationArgList: Related Key in Key Map not found for name: " + flds.get(i).name + " related entity: " + relation.relEntityName + " main entity: " + relation.mainEntity.entityName + " type: " + relation.type, module);
         }
         return returnString.toString();
     }



Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 20/02/2010, at 4:44 PM, Adam Heath wrote:

> Scott Gray wrote:
>> On 20/02/2010, at 4:34 PM, Adam Heath wrote:
>> 
>>> Scott Gray wrote:
>>>> On 20/02/2010, at 4:24 PM, Adam Heath wrote:
>>>> 
>>>>> Scott Gray wrote:
>>>>>> On 20/02/2010, at 4:18 PM, Adam Heath wrote:
>>>>>> 
>>>>>>>> ==============================================================================
>>>>>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>>>>>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
>>>>>>>> @@ -59,9 +59,10 @@
>>>>>>>> @SuppressWarnings("serial")
>>>>>>>> public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>>>>>>>> 
>>>>>>>> +    @SuppressWarnings("hiding")
>>>>>>>>  public static final String module = ModelEntity.class.getName();
>>>>>>> Huh?
>>>>>> I dunno ask Eclipse, it warned me that ModelEntity.module was hiding ModelInfo.module and offered me the opportunity to hide this warning.  I took that opportunity.
>>>>> That's wrong.  module is used everywhere.  Is eclipse so stupid that
>>>>> it can't allow same-named *static* variables in classes?
>>>> Eclipse allows it, it's just warning me in case a field is being hidden unintentionally.  I have three options:
>>>> 1.  Change my settings to not warn me about these ever
>>>> 2.  Add the suppress warnings annotation wherever a field is intentionally being hidden
>>>> 3.  Put up with the false positives
>>>> 
>>>> I went for #2 but if it bothers you I can change that approach to something else, I'm not really too worried about it.
>>> 4. Extend eclipse to allow per-project exclusion patterns to be
>>> registered.
>>> 
>>> Is there a way to do 4 already?  I don't use eclipse.
>>> 
>>> It seems to me that if eclipse only has this as a global flag, that it
>>> is severely broken, as each project has it's own policies and
>>> patterns, and eclipse shouldn't force *all* code to follow the same rules.
>> 
>> It allows per project exclusions, I was listing my options for this project.  I like being warned where there is a potential for problems but I can do without this one if it bothers you.
> 
> Actually, having such a configuration file checked in to the project
> would be ok with me.
> 
> Ofbiz uses this module variable pattern all over the project.  Adding
> this suppression just for eclipse users means the rest of us that use
> other tools have this extra line we have to ignore.
> 
> I don't think that this hidding warning is actually a problem in
> ofbiz, because this pattern is so prevalent thru out the code.
> 
> Does eclipse support projectconfig file inclusion?

I don't have all of the possible warnings switched on, some aren't that good and others just don't make sense for OFBiz.  Point is everyone has their own preferences and I don't think we need to force my preferences on them (I'm not even sure if it's possible to just include a file).

I understand that module is used everywhere but it isn't hidden that often, there's probably about 50 instances of it currently.

I agree that hidden module fields aren't a problem, but other hidden fields could be and that's why I'd prefer not to switch it off.

Regards
Scott


Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> On 20/02/2010, at 4:34 PM, Adam Heath wrote:
> 
>> Scott Gray wrote:
>>> On 20/02/2010, at 4:24 PM, Adam Heath wrote:
>>>
>>>> Scott Gray wrote:
>>>>> On 20/02/2010, at 4:18 PM, Adam Heath wrote:
>>>>>
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>>>>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
>>>>>>> @@ -59,9 +59,10 @@
>>>>>>> @SuppressWarnings("serial")
>>>>>>> public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>>>>>>>
>>>>>>> +    @SuppressWarnings("hiding")
>>>>>>>   public static final String module = ModelEntity.class.getName();
>>>>>> Huh?
>>>>> I dunno ask Eclipse, it warned me that ModelEntity.module was hiding ModelInfo.module and offered me the opportunity to hide this warning.  I took that opportunity.
>>>> That's wrong.  module is used everywhere.  Is eclipse so stupid that
>>>> it can't allow same-named *static* variables in classes?
>>> Eclipse allows it, it's just warning me in case a field is being hidden unintentionally.  I have three options:
>>> 1.  Change my settings to not warn me about these ever
>>> 2.  Add the suppress warnings annotation wherever a field is intentionally being hidden
>>> 3.  Put up with the false positives
>>>
>>> I went for #2 but if it bothers you I can change that approach to something else, I'm not really too worried about it.
>> 4. Extend eclipse to allow per-project exclusion patterns to be
>> registered.
>>
>> Is there a way to do 4 already?  I don't use eclipse.
>>
>> It seems to me that if eclipse only has this as a global flag, that it
>> is severely broken, as each project has it's own policies and
>> patterns, and eclipse shouldn't force *all* code to follow the same rules.
> 
> It allows per project exclusions, I was listing my options for this project.  I like being warned where there is a potential for problems but I can do without this one if it bothers you.

Actually, having such a configuration file checked in to the project
would be ok with me.

Ofbiz uses this module variable pattern all over the project.  Adding
this suppression just for eclipse users means the rest of us that use
other tools have this extra line we have to ignore.

I don't think that this hidding warning is actually a problem in
ofbiz, because this pattern is so prevalent thru out the code.

Does eclipse support projectconfig file inclusion?


Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 20/02/2010, at 4:34 PM, Adam Heath wrote:

> Scott Gray wrote:
>> On 20/02/2010, at 4:24 PM, Adam Heath wrote:
>> 
>>> Scott Gray wrote:
>>>> On 20/02/2010, at 4:18 PM, Adam Heath wrote:
>>>> 
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>>>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
>>>>>> @@ -59,9 +59,10 @@
>>>>>> @SuppressWarnings("serial")
>>>>>> public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>>>>>> 
>>>>>> +    @SuppressWarnings("hiding")
>>>>>>   public static final String module = ModelEntity.class.getName();
>>>>> Huh?
>>>> I dunno ask Eclipse, it warned me that ModelEntity.module was hiding ModelInfo.module and offered me the opportunity to hide this warning.  I took that opportunity.
>>> That's wrong.  module is used everywhere.  Is eclipse so stupid that
>>> it can't allow same-named *static* variables in classes?
>> 
>> Eclipse allows it, it's just warning me in case a field is being hidden unintentionally.  I have three options:
>> 1.  Change my settings to not warn me about these ever
>> 2.  Add the suppress warnings annotation wherever a field is intentionally being hidden
>> 3.  Put up with the false positives
>> 
>> I went for #2 but if it bothers you I can change that approach to something else, I'm not really too worried about it.
> 
> 4. Extend eclipse to allow per-project exclusion patterns to be
> registered.
> 
> Is there a way to do 4 already?  I don't use eclipse.
> 
> It seems to me that if eclipse only has this as a global flag, that it
> is severely broken, as each project has it's own policies and
> patterns, and eclipse shouldn't force *all* code to follow the same rules.

It allows per project exclusions, I was listing my options for this project.  I like being warned where there is a potential for problems but I can do without this one if it bothers you.

Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> On 20/02/2010, at 4:24 PM, Adam Heath wrote:
> 
>> Scott Gray wrote:
>>> On 20/02/2010, at 4:18 PM, Adam Heath wrote:
>>>
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
>>>>> @@ -59,9 +59,10 @@
>>>>> @SuppressWarnings("serial")
>>>>> public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>>>>>
>>>>> +    @SuppressWarnings("hiding")
>>>>>    public static final String module = ModelEntity.class.getName();
>>>> Huh?
>>> I dunno ask Eclipse, it warned me that ModelEntity.module was hiding ModelInfo.module and offered me the opportunity to hide this warning.  I took that opportunity.
>> That's wrong.  module is used everywhere.  Is eclipse so stupid that
>> it can't allow same-named *static* variables in classes?
> 
> Eclipse allows it, it's just warning me in case a field is being hidden unintentionally.  I have three options:
> 1.  Change my settings to not warn me about these ever
> 2.  Add the suppress warnings annotation wherever a field is intentionally being hidden
> 3.  Put up with the false positives
> 
> I went for #2 but if it bothers you I can change that approach to something else, I'm not really too worried about it.

4. Extend eclipse to allow per-project exclusion patterns to be
registered.

Is there a way to do 4 already?  I don't use eclipse.

It seems to me that if eclipse only has this as a global flag, that it
is severely broken, as each project has it's own policies and
patterns, and eclipse shouldn't force *all* code to follow the same rules.

Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 20/02/2010, at 4:24 PM, Adam Heath wrote:

> Scott Gray wrote:
>> On 20/02/2010, at 4:18 PM, Adam Heath wrote:
>> 
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
>>>> @@ -59,9 +59,10 @@
>>>> @SuppressWarnings("serial")
>>>> public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>>>> 
>>>> +    @SuppressWarnings("hiding")
>>>>    public static final String module = ModelEntity.class.getName();
>>> Huh?
>> 
>> I dunno ask Eclipse, it warned me that ModelEntity.module was hiding ModelInfo.module and offered me the opportunity to hide this warning.  I took that opportunity.
> 
> That's wrong.  module is used everywhere.  Is eclipse so stupid that
> it can't allow same-named *static* variables in classes?

Eclipse allows it, it's just warning me in case a field is being hidden unintentionally.  I have three options:
1.  Change my settings to not warn me about these ever
2.  Add the suppress warnings annotation wherever a field is intentionally being hidden
3.  Put up with the false positives

I went for #2 but if it bothers you I can change that approach to something else, I'm not really too worried about it.

Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> On 20/02/2010, at 4:18 PM, Adam Heath wrote:
> 
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
>>> @@ -59,9 +59,10 @@
>>> @SuppressWarnings("serial")
>>> public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>>>
>>> +    @SuppressWarnings("hiding")
>>>     public static final String module = ModelEntity.class.getName();
>> Huh?
> 
> I dunno ask Eclipse, it warned me that ModelEntity.module was hiding ModelInfo.module and offered me the opportunity to hide this warning.  I took that opportunity.

That's wrong.  module is used everywhere.  Is eclipse so stupid that
it can't allow same-named *static* variables in classes?

Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 20/02/2010, at 4:18 PM, Adam Heath wrote:

>> ==============================================================================
>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
>> @@ -59,9 +59,10 @@
>> @SuppressWarnings("serial")
>> public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>> 
>> +    @SuppressWarnings("hiding")
>>     public static final String module = ModelEntity.class.getName();
> 
> Huh?

I dunno ask Eclipse, it warned me that ModelEntity.module was hiding ModelInfo.module and offered me the opportunity to hide this warning.  I took that opportunity.

Re: svn commit: r912245 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Posted by Adam Heath <do...@brainfood.com>.
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat Feb 20 22:53:18 2010
> @@ -59,9 +59,10 @@
>  @SuppressWarnings("serial")
>  public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>  
> +    @SuppressWarnings("hiding")
>      public static final String module = ModelEntity.class.getName();

Huh?