Generics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Generics

Vadim Chekan
Folks,
I've educated myself about generics in Java and looks like there is
plenty of work to do in the project.

1. There are 4K of compiler warnings when I imported all projects.
2. Generics are consistently used as raw types all over the project,
which defeats the very idea of generics as a way to avoid type casts and
improve code quality as the result.
3. Some constructions look suspicious, for example
class RouteType extends ProcessorType<ProcessorType>
perhaps should be
class RouteType extends ProcessorType<ProcessorType<RouteType>>
if I understand the idea correctly.

Any comments?
Reply | Threaded
Open this post in threaded view
|

Re: Generics

jstrachan
2008/9/1 Vadim Chekan <[hidden email]>:

> Folks,
> I've educated myself about generics in Java and looks like there is plenty
> of work to do in the project.
>
> 1. There are 4K of compiler warnings when I imported all projects.
> 2. Generics are consistently used as raw types all over the project, which
> defeats the very idea of generics as a way to avoid type casts and improve
> code quality as the result.
> 3. Some constructions look suspicious, for example
> class RouteType extends ProcessorType<ProcessorType>
> perhaps should be
> class RouteType extends ProcessorType<ProcessorType<RouteType>>
> if I understand the idea correctly.
>
> Any comments?

Am sure there's lots of things that can be fixed with the use of
generics :) Much of the problems are my fault and I apologise :) FWIW
I'd actually like to remove some generics use from the code where we
can; e.g. using generics to define
component/endpoint/producer/consumer was probably a mistake really; it
lead to us having to unnecessarily copy exchanges to avoid class cast
exceptions
http://issues.apache.org/activemq/browse/CAMEL-507
http://issues.apache.org/activemq/browse/CAMEL-872

How about you submit some patches where you think some of the errors
can be removed and use of generics improved? We love contributions!
http://activemq.apache.org/camel/contributing.html
--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

Re: Generics

Vadim Chekan
James Strachan wrote:

> 2008/9/1 Vadim Chekan <[hidden email]>:
>> Folks,
>> I've educated myself about generics in Java and looks like there is plenty
>> of work to do in the project.
>>
>> 1. There are 4K of compiler warnings when I imported all projects.
>> 2. Generics are consistently used as raw types all over the project, which
>> defeats the very idea of generics as a way to avoid type casts and improve
>> code quality as the result.
>> 3. Some constructions look suspicious, for example
>> class RouteType extends ProcessorType<ProcessorType>
>> perhaps should be
>> class RouteType extends ProcessorType<ProcessorType<RouteType>>
>> if I understand the idea correctly.
>>
>> Any comments?
>
> Am sure there's lots of things that can be fixed with the use of
> generics :) Much of the problems are my fault and I apologise :) FWIW
> I'd actually like to remove some generics use from the code where we
> can; e.g. using generics to define
> component/endpoint/producer/consumer was probably a mistake really; it
> lead to us having to unnecessarily copy exchanges to avoid class cast
> exceptions
> http://issues.apache.org/activemq/browse/CAMEL-507
> http://issues.apache.org/activemq/browse/CAMEL-872
>
> How about you submit some patches where you think some of the errors
> can be removed and use of generics improved? We love contributions!
> http://activemq.apache.org/camel/contributing.html

I'm just asking if it is a problem before attempting to fix it because
Java is not my primary language and I could easily miss some non obvious
aspects of it.

Vadim.