Changeset 30717 in osm


Ignore:
Timestamp:
2014-10-13T21:40:00+02:00 (10 years ago)
Author:
donvip
Message:

[josm_tag2link] fix Java 7 warnings

Location:
applications/editors/josm/plugins/tag2link
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tag2link/.settings/org.eclipse.jdt.core.prefs

    r30416 r30717  
    11eclipse.preferences.version=1
     2org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
     3org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
     4org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
     5org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
     6org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
     7org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
    28org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
     9org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
    310org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
    411org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
     
    714org.eclipse.jdt.core.compiler.debug.localVariable=generate
    815org.eclipse.jdt.core.compiler.debug.sourceFile=generate
     16org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
    917org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
     18org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
     19org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
     20org.eclipse.jdt.core.compiler.problem.deadCode=warning
     21org.eclipse.jdt.core.compiler.problem.deprecation=warning
     22org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
     23org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
     24org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
     25org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
    1026org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
     27org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
     28org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
     29org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
     30org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
     31org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
     32org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
     33org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
     34org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
     35org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
     36org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
     37org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
     38org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
     39org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
     40org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
     41org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
     42org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
     43org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
     44org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
     45org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
     46org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
     47org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
     48org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
     49org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
     50org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
     51org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
     52org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
     53org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
     54org.eclipse.jdt.core.compiler.problem.nullReference=warning
     55org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
     56org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
     57org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
     58org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
     59org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
     60org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
     61org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
     62org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
     63org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
     64org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
     65org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
     66org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
     67org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
     68org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
     69org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
     70org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
     71org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
     72org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
     73org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
     74org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
     75org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
     76org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
     77org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
     78org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
     79org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
     80org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
     81org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
     82org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
     83org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
     84org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
     85org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
     86org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
     87org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
     88org.eclipse.jdt.core.compiler.problem.unusedImport=warning
     89org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
     90org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
     91org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
     92org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
     93org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
     94org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
     95org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
     96org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
     97org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
     98org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
     99org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
    11100org.eclipse.jdt.core.compiler.source=1.7
    12101org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java

    r28547 r30717  
    4444public class Tag2LinkRuleChecker implements Tag2LinkConstants {
    4545
    46     private static Collection<Source> sources = new ArrayList<Source>();
     46    private static Collection<Source> sources = new ArrayList<>();
    4747   
    4848    private static boolean initialized = false;
     
    149149   
    150150    private static Collection<Link> processEval(EvalResult eval, Rule rule, Source source) {
    151         Collection<Link> result = new ArrayList<Link>();
     151        Collection<Link> result = new ArrayList<>();
    152152        if (eval.matches()) {
    153153            for (Link link : rule.links) {
     
    176176     */
    177177    public static Collection<Link> getLinks(IPrimitive p) {
    178         Collection<Link> result = new ArrayList<Link>();
     178        Collection<Link> result = new ArrayList<>();
    179179        for (Source source : sources) {
    180180            for (Rule rule : source.rules) {
     
    191191     */
    192192    public static Collection<Link> getLinks(Tag tag) {
    193         Collection<Link> result = new ArrayList<Link>();
     193        Collection<Link> result = new ArrayList<>();
    194194        for (Source source : sources) {
    195195            for (Rule rule : source.rules) {
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java

    r28547 r30717  
    2727import java.net.URL;
    2828
     29import org.openstreetmap.josm.Main;
    2930import org.openstreetmap.josm.actions.JosmAction;
    3031import org.openstreetmap.josm.plugins.tag2link.Tag2LinkConstants;
     
    7172                    data += param+"="+lp.params.get(param);
    7273                }
    73                 OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());
    74                 osw.write(data);
    75                 osw.flush();
    76                 osw.close();
     74                try (OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream())) {
     75                    osw.write(data);
     76                    osw.flush();
     77                }
    7778               
    7879                String filename = "output.pdf";// FIXME: should work for PDF files only (not even tested)
    79                 FileOutputStream fos = new FileOutputStream(filename);
    80                 InputStream is = conn.getInputStream();
    81                 byte[] buffer = new byte[2048];
    82                 int n = -1;
    83                 while ((n = is.read(buffer)) > -1) {
    84                     fos.write(buffer, 0, n);
     80                try (FileOutputStream fos = new FileOutputStream(filename);
     81                     InputStream is = conn.getInputStream()) {
     82                    byte[] buffer = new byte[2048];
     83                    int n = -1;
     84                    while ((n = is.read(buffer)) > -1) {
     85                        fos.write(buffer, 0, n);
     86                    }
    8587                }
    86                 is.close();
    87                 fos.close();
    8888               
    89                 System.out.println("Opening "+filename);
     89                Main.info("Opening "+filename);
    9090                String result = OpenBrowser.displayUrl("file://"+filename);
    9191                if (result != null) {
    92                     System.err.println(result);
     92                    Main.error(result);
    9393                }
    9494               
    9595            } catch (MalformedURLException ex) {
    96                 ex.printStackTrace();
     96                Main.error(ex);
    9797            } catch (IOException ex) {
    98                 ex.printStackTrace();
     98                Main.error(ex);
    9999            }
    100100        } else {
    101             System.out.println("Opening "+link.url);
     101            Main.info("Opening "+link.url);
    102102            String result = OpenBrowser.displayUrl(link.url);
    103103            if (result != null) {
    104                 System.err.println(result);
     104                Main.error(result);
    105105            }
    106106        }
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java

    r28547 r30717  
    2626    public LinkPost(LinkPost link) {
    2727        this(new String(link.name), new String(link.url),
    28                 link.headers == null ? null : new HashMap<String, String>(link.headers),
    29                 link.params  == null ? null : new HashMap<String, String>(link.params));
     28                link.headers == null ? null : new HashMap<>(link.headers),
     29                link.params  == null ? null : new HashMap<>(link.params));
    3030    }
    3131
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java

    r28547 r30717  
    2626
    2727public class Rule {
    28     public final Collection<Condition> conditions = new ArrayList<Condition>();
    29     public final Collection<Link> links = new ArrayList<Link>();
     28    public final Collection<Condition> conditions = new ArrayList<>();
     29    public final Collection<Link> links = new ArrayList<>();
    3030   
    3131    public static class MatchingTag {
     
    3737            this.key = key;
    3838            this.value = value;
    39             this.params = new HashMap<String, String>();
     39            this.params = new HashMap<>();
    4040            this.prefix = prefix;
    4141            addKeyValueParams();
     
    7171            this.conditionsNumber = conditionsNumber;
    7272        }
    73         public final Collection<MatchingTag> matchingTags = new ArrayList<MatchingTag>();
     73        public final Collection<MatchingTag> matchingTags = new ArrayList<>();
    7474        public boolean matches() {
    7575            return conditionsNumber > 0 && matchingTags.size() >= conditionsNumber;
     
    117117
    118118    public EvalResult evaluates(Tag tag) {
    119         Map<String, String> map = new HashMap<String, String>();
     119        Map<String, String> map = new HashMap<>();
    120120        map.put(tag.getKey(), tag.getValue());
    121121        return evaluates(map);
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java

    r28547 r30717  
    3333     * The rules applied against an OSM primitive or tag.
    3434     */
    35     public final Collection<Rule> rules = new ArrayList<Rule>();
     35    public final Collection<Rule> rules = new ArrayList<>();
    3636
    3737    /**
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java

    r28549 r30717  
    6464     */
    6565    public static Collection<Source> readSources() {
    66         List<Source> result = new ArrayList<Source>();
     66        List<Source> result = new ArrayList<>();
    6767
    6868        try {
     
    123123   
    124124    private Collection<Source> parseDoc() throws XMLStreamException {
    125         List<Source> result = new ArrayList<Source>();
     125        List<Source> result = new ArrayList<>();
    126126        while (parser.hasNext()) {
    127127            int event = parser.next();
     
    140140   
    141141    private Collection<Source> parseRoot() throws XMLStreamException {
    142         List<Source> result = new ArrayList<Source>();
     142        List<Source> result = new ArrayList<>();
    143143        while (parser.hasNext()) {
    144144            int event = parser.next();
     
    217217                    if (parser.getLocalName().equals("header")) {
    218218                        if (headers == null) {
    219                             headers = new HashMap<String, String>();
     219                            headers = new HashMap<>();
    220220                        }
    221221                        headers.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value"));
    222222                    } else if (parser.getLocalName().equals("param")) {
    223223                        if (params == null) {
    224                             params = new HashMap<String, String>();
     224                            params = new HashMap<>();
    225225                        }
    226226                        params.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value"));
  • applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractPopupListener.java

    r28547 r30717  
    3737    protected AbstractPopupListener(MapFrame frame) {
    3838        this.frame = frame;
    39         this.itemList = new ArrayList<JMenuItem>();
     39        this.itemList = new ArrayList<>();
    4040    }
    4141   
Note: See TracChangeset for help on using the changeset viewer.