vitaut
vitaut

Reputation: 55564

How to avoid warnings when implementing an interface that uses raw types?

I am implementing the IProcessFactory interface that has the following method:

IProcess newProcess(ILaunch launch, Process process,
                    String label, Map attributes);

As you can see it uses the raw Map type. When I implement this method with the same signature Eclipse gives the following warning:

Map is a raw type. References to generic type Map should be parameterized.

Replacing Map with Map<?, ?> gives an error. So what is a proper way to implement such an interface?

Upvotes: 2

Views: 203

Answers (1)

aioobe
aioobe

Reputation: 421020

So what is a proper way to implement

To the extent of my knowledge you are forced to use raw types in such situations. Indeed Eclipse refers to them as "unavoidable".

How to avoid warnings when implementing an interface that uses raw types?

If you're using Eclipse you can disable these warnings under the Errors/Warnings section in the preferences.

See this answer for further details:

Upvotes: 4

Related Questions