Ignore:
Timestamp:
2014-04-26T17:39:23+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - use diamond operator where applicable

Location:
trunk/src/org/openstreetmap/josm/plugins
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r6883 r7005  
    2727import org.xml.sax.SAXException;
    2828
    29 
    3029/**
    3130 * Asynchronous task for downloading a collection of plugins.
     
    4342    public static final String PLUGIN_MIME_TYPES = "application/java-archive, application/zip; q=0.9, application/octet-stream; q=0.5";
    4443   
    45     private final Collection<PluginInformation> toUpdate = new LinkedList<PluginInformation>();
    46     private final Collection<PluginInformation> failed = new LinkedList<PluginInformation>();
    47     private final Collection<PluginInformation> downloaded = new LinkedList<PluginInformation>();
     44    private final Collection<PluginInformation> toUpdate = new LinkedList<>();
     45    private final Collection<PluginInformation> failed = new LinkedList<>();
     46    private final Collection<PluginInformation> downloaded = new LinkedList<>();
    4847    private Exception lastException;
    4948    private boolean canceled;
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r7004 r7005  
    195195     * All installed and loaded plugins (resp. their main classes)
    196196     */
    197     public static final Collection<PluginProxy> pluginList = new LinkedList<PluginProxy>();
     197    public static final Collection<PluginProxy> pluginList = new LinkedList<>();
    198198
    199199    /**
    200200     * Add here all ClassLoader whose resource should be searched.
    201201     */
    202     private static final List<ClassLoader> sources = new LinkedList<ClassLoader>();
     202    private static final List<ClassLoader> sources = new LinkedList<>();
    203203
    204204    static {
     
    227227     */
    228228    private static void filterDeprecatedPlugins(Component parent, Collection<String> plugins) {
    229         Set<DeprecatedPlugin> removedPlugins = new TreeSet<DeprecatedPlugin>();
     229        Set<DeprecatedPlugin> removedPlugins = new TreeSet<>();
    230230        for (DeprecatedPlugin depr : DEPRECATED_PLUGINS) {
    231231            if (plugins.contains(depr.name)) {
     
    461461
    462462        // Add all plugins already loaded (to include early plugins when checking late ones)
    463         Collection<PluginInformation> allPlugins = new HashSet<PluginInformation>(plugins);
     463        Collection<PluginInformation> allPlugins = new HashSet<>(plugins);
    464464        for (PluginProxy proxy : pluginList) {
    465465            allPlugins.add(proxy.getPluginInformation());
     
    487487        //
    488488        if (requires != null) {
    489             Set<String> pluginNames = new HashSet<String>();
     489            Set<String> pluginNames = new HashSet<>();
    490490            for (PluginInformation pi: plugins) {
    491491                pluginNames.add(pi.name);
    492492            }
    493             Set<String> missingPlugins = new HashSet<String>();
     493            Set<String> missingPlugins = new HashSet<>();
    494494            List<String> requiredPlugins = local ? plugin.getLocalRequiredPlugins() : plugin.getRequiredPlugins();
    495495            for (String requiredPlugin : requiredPlugins) {
     
    515515    public static ClassLoader createClassLoader(Collection<PluginInformation> plugins) {
    516516        // iterate all plugins and collect all libraries of all plugins:
    517         List<URL> allPluginLibraries = new LinkedList<URL>();
     517        List<URL> allPluginLibraries = new LinkedList<>();
    518518        File pluginDir = Main.pref.getPluginsDirectory();
    519519
    520520        // Add all plugins already loaded (to include early plugins in the classloader, allowing late plugins to rely on early ones)
    521         Collection<PluginInformation> allPlugins = new HashSet<PluginInformation>(plugins);
     521        Collection<PluginInformation> allPlugins = new HashSet<>(plugins);
    522522        for (PluginProxy proxy : pluginList) {
    523523            allPlugins.add(proxy.getPluginInformation());
     
    592592            monitor.beginTask(tr("Loading plugins ..."));
    593593            monitor.subTask(tr("Checking plugin preconditions..."));
    594             List<PluginInformation> toLoad = new LinkedList<PluginInformation>();
     594            List<PluginInformation> toLoad = new LinkedList<>();
    595595            for (PluginInformation pi: plugins) {
    596596                if (checkLoadPreconditions(parent, plugins, pi)) {
     
    636636     */
    637637    public static void loadEarlyPlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) {
    638         List<PluginInformation> earlyPlugins = new ArrayList<PluginInformation>(plugins.size());
     638        List<PluginInformation> earlyPlugins = new ArrayList<>(plugins.size());
    639639        for (PluginInformation pi: plugins) {
    640640            if (pi.early) {
     
    654654     */
    655655    public static void loadLatePlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) {
    656         List<PluginInformation> latePlugins = new ArrayList<PluginInformation>(plugins.size());
     656        List<PluginInformation> latePlugins = new ArrayList<>(plugins.size());
    657657        for (PluginInformation pi: plugins) {
    658658            if (!pi.early) {
     
    688688                return null;
    689689            }
    690             HashMap<String, PluginInformation> ret = new HashMap<String, PluginInformation>();
     690            HashMap<String, PluginInformation> ret = new HashMap<>();
    691691            for (PluginInformation pi: task.getAvailablePlugins()) {
    692692                ret.put(pi.name, pi);
     
    733733        try {
    734734            monitor.beginTask(tr("Determine plugins to load..."));
    735             Set<String> plugins = new HashSet<String>();
     735            Set<String> plugins = new HashSet<>();
    736736            plugins.addAll(Main.pref.getCollection("plugins",  new LinkedList<String>()));
    737737            if (System.getProperty("josm.plugins") != null) {
     
    743743            filterUnmaintainedPlugins(parent, plugins);
    744744            Map<String, PluginInformation> infos = loadLocallyAvailablePluginInformation(monitor.createSubTaskMonitor(1,false));
    745             List<PluginInformation> ret = new LinkedList<PluginInformation>();
     745            List<PluginInformation> ret = new LinkedList<>();
    746746            for (Iterator<String> it = plugins.iterator(); it.hasNext();) {
    747747                String plugin = it.next();
     
    791791    private static Set<PluginInformation> findRequiredPluginsToDownload(
    792792            Collection<PluginInformation> pluginsToUpdate, List<PluginInformation> allPlugins, Set<PluginInformation> pluginsToDownload) {
    793         Set<PluginInformation> result = new HashSet<PluginInformation>();
     793        Set<PluginInformation> result = new HashSet<>();
    794794        for (PluginInformation pi : pluginsToUpdate) {
    795795            for (String name : pi.getRequiredPlugins()) {
     
    880880            // filter plugins which actually have to be updated
    881881            //
    882             Collection<PluginInformation> pluginsToUpdate = new ArrayList<PluginInformation>();
     882            Collection<PluginInformation> pluginsToUpdate = new ArrayList<>();
    883883            for (PluginInformation pi: plugins) {
    884884                if (pi.isUpdateRequired()) {
     
    889889            if (!pluginsToUpdate.isEmpty()) {
    890890
    891                 Set<PluginInformation> pluginsToDownload = new HashSet<PluginInformation>(pluginsToUpdate);
     891                Set<PluginInformation> pluginsToDownload = new HashSet<>(pluginsToUpdate);
    892892
    893893                if (allPlugins != null) {
     
    11501150
    11511151        try {
    1152             FutureTask<Integer> task = new FutureTask<Integer>(new Callable<Integer>() {
     1152            FutureTask<Integer> task = new FutureTask<>(new Callable<Integer>() {
    11531153                @Override
    11541154                public Integer call() {
     
    12181218            return null;
    12191219
    1220         Set<String> plugins = new HashSet<String>(
     1220        Set<String> plugins = new HashSet<>(
    12211221                Main.pref.getCollection("plugins",Collections.<String> emptySet())
    12221222        );
     
    12601260    public static String getBugReportText() {
    12611261        StringBuilder text = new StringBuilder();
    1262         LinkedList <String> pl = new LinkedList<String>(Main.pref.getCollection("plugins", new LinkedList<String>()));
     1262        LinkedList <String> pl = new LinkedList<>(Main.pref.getCollection("plugins", new LinkedList<String>()));
    12631263        for (final PluginProxy pp : pluginList) {
    12641264            PluginInformation pi = pp.getPluginInformation();
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r7004 r7005  
    7575    /** The plugin icon. */
    7676    public ImageIcon icon;
    77     public List<URL> libraries = new LinkedList<URL>();
    78     public final Map<String, String> attr = new TreeMap<String, String>();
     77    public List<URL> libraries = new LinkedList<>();
     78    public final Map<String, String> attr = new TreeMap<>();
    7979
    8080    private static final ImageIcon emptyIcon = new ImageIcon(new BufferedImage(24, 24, BufferedImage.TYPE_INT_ARGB));
     
    401401    public static Collection<String> getPluginLocations() {
    402402        Collection<String> locations = Main.pref.getAllPossiblePreferenceDirs();
    403         Collection<String> all = new ArrayList<String>(locations.size());
     403        Collection<String> all = new ArrayList<>(locations.size());
    404404        for (String s : locations) {
    405405            all.add(s+"plugins");
     
    497497
    498498    private static List<String> getRequiredPlugins(String pluginList) {
    499         List<String> requiredPlugins = new ArrayList<String>();
     499        List<String> requiredPlugins = new ArrayList<>();
    500500        if (pluginList != null) {
    501501            for (String s : pluginList.split(";")) {
  • trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java

    r6920 r7005  
    5858     */
    5959    public List<PluginInformation> parse(InputStream in) throws PluginListParseException{
    60         List<PluginInformation> ret = new LinkedList<PluginInformation>();
     60        List<PluginInformation> ret = new LinkedList<>();
    6161        BufferedReader r = null;
    6262        try {
  • trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java

    r6920 r7005  
    4545    public ReadLocalPluginInformationTask() {
    4646        super(tr("Reading local plugin information.."), false);
    47         availablePlugins = new HashMap<String, PluginInformation>();
     47        availablePlugins = new HashMap<>();
    4848    }
    4949
    5050    public ReadLocalPluginInformationTask(ProgressMonitor monitor) {
    5151        super(tr("Reading local plugin information.."),monitor, false);
    52         availablePlugins = new HashMap<String, PluginInformation>();
     52        availablePlugins = new HashMap<>();
    5353    }
    5454
     
    237237     */
    238238    public List<PluginInformation> getAvailablePlugins() {
    239         return new ArrayList<PluginInformation>(availablePlugins.values());
     239        return new ArrayList<>(availablePlugins.values());
    240240    }
    241241
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r6890 r7005  
    6464            this.sites = Collections.emptySet();
    6565        }
    66         this.availablePlugins = new LinkedList<PluginInformation>();
     66        this.availablePlugins = new LinkedList<>();
    6767        this.displayErrMsg = displayErrMsg;
    6868    }
     
    350350     */
    351351    protected List<PluginInformation> filterDeprecatedPlugins(List<PluginInformation> plugins) {
    352         List<PluginInformation> ret = new ArrayList<PluginInformation>(plugins.size());
    353         HashSet<String> deprecatedPluginNames = new HashSet<String>();
     352        List<PluginInformation> ret = new ArrayList<>(plugins.size());
     353        HashSet<String> deprecatedPluginNames = new HashSet<>();
    354354        for (PluginHandler.DeprecatedPlugin p : PluginHandler.DEPRECATED_PLUGINS) {
    355355            deprecatedPluginNames.add(p.name);
     
    389389
    390390        // collect old cache files and remove if no longer in use
    391         List<File> siteCacheFiles = new LinkedList<File>();
     391        List<File> siteCacheFiles = new LinkedList<>();
    392392        for (String location : PluginInformation.getPluginLocations()) {
    393393            File [] f = new File(location).listFiles(
Note: See TracChangeset for help on using the changeset viewer.