It's all about the answers!

Ask a question

How to avoid RAW type warning from IBuildDefinition.getProperties()?


David Frenzel (153) | asked Jul 24 '18, 10:54 a.m.

I'm reading the properties from a project area and want to save it a list:

IBuildDefinition buildDefinition = buildClient.getBuildDefinition(buildDefName, new NullProgressMonitor()); List<IBuildProperty> buildProps = buildDefinition.getProperties();

This produces a warning because getProperties() returns a raw-type List. How can I fix the warning because I'm assuming that the API is not going to get changed so that this warning would be avoided in the first place. 

Thanks!

Accepted answer


permanent link
Ralph Schoon (63.4k33646) | answered Jul 24 '18, 11:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I don't think you can. You can either suppress the warning in Eclipse or cast to a raw type and then use instanceof tests when working with the list.

David Frenzel selected this answer as the correct answer

Comments
David Frenzel commented Jul 24 '18, 11:19 a.m.

Since I'm iterating over the List I'm now casting all the Objects (because it's a raw List now) to IBuildProperty and now the warnings are gone. Thanks!

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.