KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have some data stored in Java elements and I need to return it in a given format - JSONObject. While my implementation works fine, I'm still getting a warning message from eclipse (Version: Juno Service Release 2): " Type safety: The method put(Object, Object) belongs to the raw type HashMap. References to generic type HashMap should be parameterized " This is my code: public interface Element {...} public abstract class AbstractElement implements Element {...} public final class Way extends AbstractElement {...} import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.json.simple.JSONArray; import org.json.simple.JSONObject; public class WayToJsonConverter{ ... public JSONObject wayToJson(){ JSONObject obj = new JSONObject(); obj.put("id",way.getId()); ... return obj; } ... } The problematic line is : obj.put("id",way.getId()); Is there a way to solve this issue other then adding @SuppressWarnings("unchecked") ?
Tags (comma-separated)
Save Edits
Cancel