best practices Casting for Trunk java 1.5+

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

best practices Casting for Trunk java 1.5+

BJ Freeman
I see this
-        Map result = ServiceUtil.returnSuccess();
+        Map<String, Object> result = ServiceUtil.returnSuccess();

and I see this

+        Map bodyParameters = (Map) serviceContext.remove("bodyParameters");

for the left side which is the best practice?



Reply | Threaded
Open this post in threaded view
|

Re: best practices Casting for Trunk java 1.5+

Jacques Le Roux
Administrator
If you use an editor like Eclipse there are auto-completion suggestions

1) would be
    Map<String, Object> result = ServiceUtil.returnSuccess();
2) would be
    Map<String, Object> bodyParameters = (Map<String, Object>) serviceContext.remove("bodyParameters");

A bit verbose, but this how things are going in Java, clearly its more secure. It's like when you are checking in on a plane :
longer but, normally, safer...

Jacques

From: "BJ Freeman" <[hidden email]>
>I see this
> -        Map result = ServiceUtil.returnSuccess();
> +        Map<String, Object> result = ServiceUtil.returnSuccess();
> and I see this
>
> +        Map bodyParameters = (Map) serviceContext.remove("bodyParameters");
>
> for the left side which is the best practice?

Reply | Threaded
Open this post in threaded view
|

Re: best practices Casting for Trunk java 1.5+

BJ Freeman
Thanks I was seeing both in the commits so was not sure.

Jacques Le Roux sent the following on 7/24/2008 6:17 AM:

> If you use an editor like Eclipse there are auto-completion suggestions
>
> 1) would be
>    Map<String, Object> result = ServiceUtil.returnSuccess();
> 2) would be
>    Map<String, Object> bodyParameters = (Map<String, Object>)
> serviceContext.remove("bodyParameters");
>
> A bit verbose, but this how things are going in Java, clearly its more
> secure. It's like when you are checking in on a plane : longer but,
> normally, safer...
>
> Jacques
>
> From: "BJ Freeman" <[hidden email]>
>> I see this
>> -        Map result = ServiceUtil.returnSuccess();
>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>> and I see this
>>
>> +        Map bodyParameters = (Map)
>> serviceContext.remove("bodyParameters");
>>
>> for the left side which is the best practice?
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: best practices Casting for Trunk java 1.5+

Adrian Crum
BJ,

In the example you used, I was fixing a bug, so I included only the
changes needed to fix the bug. I could have updated the entire class to
use the Java 5 Generics, but that would have obscured the changes needed
to fix the bug.

-Adrian

BJ Freeman wrote:

> Thanks I was seeing both in the commits so was not sure.
>
> Jacques Le Roux sent the following on 7/24/2008 6:17 AM:
>> If you use an editor like Eclipse there are auto-completion suggestions
>>
>> 1) would be
>>    Map<String, Object> result = ServiceUtil.returnSuccess();
>> 2) would be
>>    Map<String, Object> bodyParameters = (Map<String, Object>)
>> serviceContext.remove("bodyParameters");
>>
>> A bit verbose, but this how things are going in Java, clearly its more
>> secure. It's like when you are checking in on a plane : longer but,
>> normally, safer...
>>
>> Jacques
>>
>> From: "BJ Freeman" <[hidden email]>
>>> I see this
>>> -        Map result = ServiceUtil.returnSuccess();
>>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>>> and I see this
>>>
>>> +        Map bodyParameters = (Map)
>>> serviceContext.remove("bodyParameters");
>>>
>>> for the left side which is the best practice?
>>
>>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: best practices Casting for Trunk java 1.5+

BJ Freeman
Thanks for that point.
so only make changes for the immediate problems for clarity.
for my own information.
would it be ok to provide a patch for the bug and also provide a patch
to update since I am looking at the module anyway.
or should we just have a refactoring jira to do that?

Adrian Crum sent the following on 7/24/2008 9:45 AM:

> BJ,
>
> In the example you used, I was fixing a bug, so I included only the
> changes needed to fix the bug. I could have updated the entire class to
> use the Java 5 Generics, but that would have obscured the changes needed
> to fix the bug.
>
> -Adrian
>
> BJ Freeman wrote:
>> Thanks I was seeing both in the commits so was not sure.
>>
>> Jacques Le Roux sent the following on 7/24/2008 6:17 AM:
>>> If you use an editor like Eclipse there are auto-completion suggestions
>>>
>>> 1) would be
>>>    Map<String, Object> result = ServiceUtil.returnSuccess();
>>> 2) would be
>>>    Map<String, Object> bodyParameters = (Map<String, Object>)
>>> serviceContext.remove("bodyParameters");
>>>
>>> A bit verbose, but this how things are going in Java, clearly its more
>>> secure. It's like when you are checking in on a plane : longer but,
>>> normally, safer...
>>>
>>> Jacques
>>>
>>> From: "BJ Freeman" <[hidden email]>
>>>> I see this
>>>> -        Map result = ServiceUtil.returnSuccess();
>>>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>>>> and I see this
>>>>
>>>> +        Map bodyParameters = (Map)
>>>> serviceContext.remove("bodyParameters");
>>>>
>>>> for the left side which is the best practice?
>>>
>>>
>>>
>>
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: best practices Casting for Trunk java 1.5+

Adrian Crum
The best practice for patches is to have them separate - one for the bug
fix, another for the other changes. That makes it easier for the
committers to review.

-Adrian

BJ Freeman wrote:

> Thanks for that point.
> so only make changes for the immediate problems for clarity.
> for my own information.
> would it be ok to provide a patch for the bug and also provide a patch
> to update since I am looking at the module anyway.
> or should we just have a refactoring jira to do that?
>
> Adrian Crum sent the following on 7/24/2008 9:45 AM:
>> BJ,
>>
>> In the example you used, I was fixing a bug, so I included only the
>> changes needed to fix the bug. I could have updated the entire class to
>> use the Java 5 Generics, but that would have obscured the changes needed
>> to fix the bug.
>>
>> -Adrian
>>
>> BJ Freeman wrote:
>>> Thanks I was seeing both in the commits so was not sure.
>>>
>>> Jacques Le Roux sent the following on 7/24/2008 6:17 AM:
>>>> If you use an editor like Eclipse there are auto-completion suggestions
>>>>
>>>> 1) would be
>>>>    Map<String, Object> result = ServiceUtil.returnSuccess();
>>>> 2) would be
>>>>    Map<String, Object> bodyParameters = (Map<String, Object>)
>>>> serviceContext.remove("bodyParameters");
>>>>
>>>> A bit verbose, but this how things are going in Java, clearly its more
>>>> secure. It's like when you are checking in on a plane : longer but,
>>>> normally, safer...
>>>>
>>>> Jacques
>>>>
>>>> From: "BJ Freeman" <[hidden email]>
>>>>> I see this
>>>>> -        Map result = ServiceUtil.returnSuccess();
>>>>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>>>>> and I see this
>>>>>
>>>>> +        Map bodyParameters = (Map)
>>>>> serviceContext.remove("bodyParameters");
>>>>>
>>>>> for the left side which is the best practice?
>>>>
>>>>
>>>
>>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: best practices Casting for Trunk java 1.5+

BJ Freeman
Sounds like a plan. Thanks

Adrian Crum sent the following on 7/24/2008 10:18 AM:

> The best practice for patches is to have them separate - one for the bug
> fix, another for the other changes. That makes it easier for the
> committers to review.
>
> -Adrian
>
> BJ Freeman wrote:
>> Thanks for that point.
>> so only make changes for the immediate problems for clarity.
>> for my own information.
>> would it be ok to provide a patch for the bug and also provide a patch
>> to update since I am looking at the module anyway.
>> or should we just have a refactoring jira to do that?
>>
>> Adrian Crum sent the following on 7/24/2008 9:45 AM:
>>> BJ,
>>>
>>> In the example you used, I was fixing a bug, so I included only the
>>> changes needed to fix the bug. I could have updated the entire class to
>>> use the Java 5 Generics, but that would have obscured the changes needed
>>> to fix the bug.
>>>
>>> -Adrian
>>>
>>> BJ Freeman wrote:
>>>> Thanks I was seeing both in the commits so was not sure.
>>>>
>>>> Jacques Le Roux sent the following on 7/24/2008 6:17 AM:
>>>>> If you use an editor like Eclipse there are auto-completion
>>>>> suggestions
>>>>>
>>>>> 1) would be
>>>>>    Map<String, Object> result = ServiceUtil.returnSuccess();
>>>>> 2) would be
>>>>>    Map<String, Object> bodyParameters = (Map<String, Object>)
>>>>> serviceContext.remove("bodyParameters");
>>>>>
>>>>> A bit verbose, but this how things are going in Java, clearly its more
>>>>> secure. It's like when you are checking in on a plane : longer but,
>>>>> normally, safer...
>>>>>
>>>>> Jacques
>>>>>
>>>>> From: "BJ Freeman" <[hidden email]>
>>>>>> I see this
>>>>>> -        Map result = ServiceUtil.returnSuccess();
>>>>>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>>>>>> and I see this
>>>>>>
>>>>>> +        Map bodyParameters = (Map)
>>>>>> serviceContext.remove("bodyParameters");
>>>>>>
>>>>>> for the left side which is the best practice?
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>
>
>