Ignore:
Timestamp:
2023-10-16T19:03:11+02:00 (16 months ago)
Author:
taylor.smock
Message:

See #23218: Use newer error_prone versions when compiling on Java 11+

error_prone 2.11 dropped support for compiling with Java 8, although it still
supports compiling for Java 8. The "major" new check for us is NotJavadoc since
we used /** in quite a few places which were not javadoc.

Other "new" checks that are of interest:

  • AlreadyChecked: if (foo) { doFoo(); } else if (!foo) { doBar(); }
  • UnnecessaryStringBuilder: Avoid StringBuilder (Java converts + to StringBuilder behind-the-scenes, but may also do something else if it performs better)
  • NonApiType: Avoid specific interface types in function definitions
  • NamedLikeContextualKeyword: Avoid using restricted names for classes and methods
  • UnusedMethod: Unused private methods should be removed

This fixes most of the new error_prone issues and some SonarLint issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r18603 r18871  
    765765    private static void prepareFileChooser(String url, AbstractFileChooser fc) {
    766766        if (Utils.isBlank(url)) return;
    767         URL sourceUrl = null;
     767        URL sourceUrl;
    768768        try {
    769769            sourceUrl = new URL(url);
     
    816816            p.add(new JLabel(tr("URL / File:")), GBC.std().insets(15, 0, 5, 0));
    817817            p.add(tfURL, GBC.std().insets(0, 0, 5, 5));
    818             JButton fileChooser = new JButton(new LaunchFileChooserAction());
     818            JButton fileChooser = new JButton(new LaunchFileChooserSourceTypeAction());
    819819            fileChooser.setMargin(new Insets(0, 0, 0, 0));
    820820            p.add(fileChooser, GBC.eol().insets(0, 0, 5, 5));
     
    848848        }
    849849
    850         class LaunchFileChooserAction extends AbstractAction {
    851             LaunchFileChooserAction() {
     850        class LaunchFileChooserSourceTypeAction extends AbstractAction {
     851            LaunchFileChooserSourceTypeAction() {
    852852                new ImageProvider("open").getResource().attachImageIcon(this);
    853853                putValue(SHORT_DESCRIPTION, tr("Launch a file chooser to select a file"));
     
    15351535            gc.weightx = 0.0;
    15361536            gc.weighty = 1.0;
    1537             add(new JButton(new LaunchFileChooserAction()));
     1537            add(new JButton(new LaunchFileChooserEditCellAction()));
    15381538
    15391539            tfFileName.addFocusListener(
     
    16221622        }
    16231623
    1624         class LaunchFileChooserAction extends AbstractAction {
    1625             LaunchFileChooserAction() {
     1624        class LaunchFileChooserEditCellAction extends AbstractAction {
     1625            LaunchFileChooserEditCellAction() {
    16261626                putValue(NAME, "...");
    16271627                putValue(SHORT_DESCRIPTION, tr("Launch a file chooser to select a file"));
Note: See TracChangeset for help on using the changeset viewer.