Brajesh
Brajesh

Reputation: 43

Eclipse Warning message

How to resolve warning message coming in eclipse editor when I am writing this below code

Map <String, Class> fieldTypes = new HashMap<String, Class>();

When I am adding Add @SuppressWarning 'rawtypes' to either above this line of above method, still eclipse showing this warning.

Thanks
Brajesh

Upvotes: 0

Views: 1994

Answers (5)

Mariusz
Mariusz

Reputation: 2727

In order to turn off the compiler warning for this specific message, set "Unchecked generic type operation" to 'Ignore'.

Upvotes: 1

dogbane
dogbane

Reputation: 274532

Are you sure you are using the right syntax?

The following works for me (on Eclipse 3.7.1) and suppresses the warning:

@SuppressWarnings("rawtypes")
Map <String, Class> fieldTypes = new HashMap<String, Class>();

Upvotes: 0

Sunil Kumar Sahoo
Sunil Kumar Sahoo

Reputation: 53647

If fieldTypes is not used you will get warning to avoid that you need to add

Add @SsuppressWarnings unused to main

Upvotes: 0

Buhake Sindi
Buhake Sindi

Reputation: 89169

The correct way is:

Map <String, Class<?>> fieldTypes = new HashMap<String, Class<?>>(); //If you want all unknowns.

This requires no SuppressWarnings.

Upvotes: 1

GustyWind
GustyWind

Reputation: 3036

Under Window>Prefernces>Java>Compiler>Erro/Warnings change the severity levels for Annotations sections

Upvotes: 1

Related Questions