Java Generics (suppress warnings cleanup)

Discussion in 'Bukkit Preview' started by Wolvereness, Feb 29, 2012.

  1. Offline

    Wolvereness Bukkit Team Member

    You may have found new issues compiling your plugins for 1.1-R5 configuration. There are source-code level changes (this means they generate compile errors, but pre-existing code does not break) for the generic types in ConfigurationSection of getList(String), getMapList(String), and createSection(String, Map). They now return collections with generic wildcards. Most fixes in your code will simply require changing your <Object> type in the code to <?> type. You may also opt to use the list getters that use specific types. Get operations will still behave normally on the wildcard types. If you happened to rely on the List<Map<String, Object>> for iteration over the map itself with String keys, you can simply cast the key to (String) or call .toString() wherever it is used.
     

Share This Page