Generics & Plugins

John Mazzitelli mazz at redhat.com
Mon Sep 12 19:38:41 UTC 2011


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


More information about the rhq-devel mailing list