Generics & Plugins

Ian Springer ian.springer at redhat.com
Tue Sep 13 21:28:47 UTC 2011


Do you see the warnings when you compile in Eclipse, or when editing a 
source file? I don't think I see the warnings in IntelliJ, but I also 
never compile anything via IntelliJ - I always compile from the command 
line via Maven.

If we really want to get serious about fixing warnings, we should 
consider enabling compiler warnings in the compiler plugin's config in 
the root pom.

On 09/13/2011 09:09 AM, Jay Shaughnessy wrote:
> There are a couple of places that just adding in the<?>  can cause an
> issue but I think it falls out pretty quickly.  I totally agree with you
> that we have way too many warnings like this, and I make it a point to
> remove all warnings (at least those flagged with my eclipse settings,
> like the one you mention) in files I touch.   In eclipse at least it's
> very easy to add the<?>  generics syntax with a hover option.
>
> I'm not sure the IJ users even see these warnings because I continually
> visit new files, or files I've already fixed, to find new instances of
> the problem.  In short, I think we should actually use valid java syntax
> when we can.  Five thousand warnings in the code base is annoying.
>
>
> On 9/12/2011 3:38 PM, John Mazzitelli wrote:
>> IIRC there are certain places where the<?>   placeholders cause compile
>> problems. I can't remember the details.
>>
>> On 09/12/2011 03:35 PM, Stefan Negrea wrote:
>>> Hello Everybody,
>>>
>>> I noticed a lot of raw type warnings in RHQ. I think most of them can be fixed pretty easy (without adding SuppressWarnings everywhere).
>>>
>>> Here are two specific examples:
>>> 1) org.rhq.core.pluginapi.inventory.ResourceComponent.java
>>>     - Now
>>>       public interface ResourceComponent<T extends ResourceComponent>    extends AvailabilityFacet {
>>>
>>>     - Could be changed to
>>>       public interface ResourceComponent<T extends ResourceComponent<?>>    extends AvailabilityFacet {
>>>
>>> 2) org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent.java
>>>     - Now
>>>       public interface ResourceDiscoveryComponent<T extends ResourceComponent>    {
>>>
>>>     - Could be changed to
>>>       public interface ResourceDiscoveryComponent<T extends ResourceComponent<?>>    {
>>>
>>>
>>> With this change the only problems that come to my mind are related to runtime exceptions from collections that use these classes. I attached a Java file with a few test cases for generics with wildcards . Hopefully I covered most of the RHQ use cases.
>>>
>>>
>>> The wildcard change looks benign to me. Are there any reasons this was not done? Am I missing some complex edge cases or classloader issues? Or maybe problems with different JVMs?
>>>
>>>
>>> Thank you,
>>> Stefan Negrea
>>>
>>> Software Engineer
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> rhq-devel mailing list
>>> rhq-devel at lists.fedorahosted.org
>>> https://fedorahosted.org/mailman/listinfo/rhq-devel
>> _______________________________________________
>> rhq-devel mailing list
>> rhq-devel at lists.fedorahosted.org
>> https://fedorahosted.org/mailman/listinfo/rhq-devel
>>
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-devel


-- 
Ian Springer
Principal Software Developer
JBoss Operations Network
Red Hat
ian.springer at redhat.com



More information about the rhq-devel mailing list