Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322199

Summary: 3 Compile warnings in official build
Product: [Eclipse Project] Equinox Reporter: Dani Megert <daniel_megert>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, irbull, tjwatson
Version: 3.7   
Target Milestone: 3.7 M3   
Hardware: PC   
OS: Windows XP   
URL: http://download.eclipse.org/eclipse/downloads/drops/N20100808-2000/compilelogs/plugins/org.eclipse.equinox.p2.installer_1.0.200.N20100808-2000/@dot.html
Whiteboard:

Description Dani Megert CLA 2010-08-10 02:45:02 EDT
N20100809-2000.

Compile warnings in org.eclipse.equinox.p2.installer_1.0.200.N20100809-2000.

1. WARNING in /src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java
 (at line 66)
ServiceReference reference = context.getServiceReference(name);
ServiceReference is a raw type. References to generic type ServiceReference<S> should be parameterized

2. WARNING in /src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java
 (at line 69)
Object result = context.getService(reference);
Type safety: Unchecked invocation getService(ServiceReference) of the generic method getService(ServiceReference<S>) of type BundleContext

3. WARNING in /src/org/eclipse/equinox/internal/p2/installer/InstallApplication.java
 (at line 69)
Object result = context.getService(reference);
Type safety: The expression of type ServiceReference needs unchecked conversion to conform to ServiceReference<Object>
Comment 1 Ian Bull CLA 2010-08-10 12:25:53 EDT
Tom, 

I assume these are a result of the generics work that you did in OSGi.  This happened a number of time last year too (when the p2 team was adding generics support to the p2 API).  Are there workspace settings we should be using to avoid these in the official build? Or should we be changing the compiler options when we build now?
Comment 2 Thomas Watson CLA 2010-08-10 13:02:14 EDT
Yes this is because of the work to generify the OSGi API. But I don't understand why only these three got flagged as a warning in p2.  for example:

org.eclipse.equinox.internal.p2.core.Activator.registerAgent()

This method has similar warnings that did not show up in the build.  We need to explain that before figuring out what settings to use.
Comment 3 Andrew Niefer CLA 2010-08-10 14:43:46 EDT
Fixed the compile warnings in head.

We should have a discussion on the p2 call around taking better advantage of the new osgi generics, which means tying ourselves to the 3.7 osgi (which I don't really see beeing an issue).

In particular, we could use BundleContext#getServiceRegerence(Class<s> clazz) which would allow something like

IProxyService proxies = getService(Icontext, IProxyService.class);

As to warnings only showing up for org.eclipse.equinox.p2.installer, it is included in a second product build to make the installer, that build specifies reporting raw & unchecked warnings where the normal master build does not.
Comment 4 DJ Houghton CLA 2010-09-16 12:17:02 EDT
There was a problem with tagging HEAD so this fix won't appear in integration builds until the first build after 3.7 M2.