Browse Source

Fix errorprone issues

pull/345/head
Jannis Weis 2 years ago
parent
commit
b805009c7c
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 17
      core/src/main/java/com/github/weisj/darklaf/components/color/SmallColorChooser.java
  2. 6
      core/src/main/java/com/github/weisj/darklaf/components/iconeditor/IconEditorPanel.java
  3. 4
      core/src/main/java/com/github/weisj/darklaf/defaults/ResourceBundleCache.java
  4. 1
      core/src/main/java/com/github/weisj/darklaf/defaults/UIDefaultsWithResourceBundleCache.java
  5. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameComponentPopupMenu.java
  6. 2
      property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/DarkSVGIcon.java
  7. 3
      utils/src/main/java/com/github/weisj/darklaf/util/AlignmentHelper.java

17
core/src/main/java/com/github/weisj/darklaf/components/color/SmallColorChooser.java

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2020-2022 Jannis Weis * Copyright (c) 2020-2023 Jannis Weis
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, * associated documentation files (the "Software"), to deal in the Software without restriction,
@ -376,17 +376,16 @@ public class SmallColorChooser extends JPanel implements ChooserComponent<Color>
private final DocumentFilter documentFilter = new DocumentFilter() { private final DocumentFilter documentFilter = new DocumentFilter() {
@Override @Override
public void insertString(final FilterBypass fb, final int offset, final String string, public void insertString(final DocumentFilter.FilterBypass fb, final int offset,
final AttributeSet attr) final String string, final AttributeSet attr)
throws BadLocationException { throws BadLocationException {
if (!isValidString(string)) return; if (!isValidString(string)) return;
super.insertString(fb, offset, string, attr); super.insertString(fb, offset, string, attr);
} }
@Override @Override
public void replace(final FilterBypass fb, final int offset, final int length, public void replace(final DocumentFilter.FilterBypass fb, final int offset,
final String text, final int length, final String text, final AttributeSet attrs)
final AttributeSet attrs)
throws BadLocationException { throws BadLocationException {
if (!isValidString(text)) return; if (!isValidString(text)) return;
super.replace(fb, offset, length, text, attrs); super.replace(fb, offset, length, text, attrs);
@ -403,12 +402,14 @@ public class SmallColorChooser extends JPanel implements ChooserComponent<Color>
private final NavigationFilter navigationFilter = new NavigationFilter() { private final NavigationFilter navigationFilter = new NavigationFilter() {
@Override @Override
public void setDot(final FilterBypass fb, final int dot, final Position.Bias bias) { public void setDot(final NavigationFilter.FilterBypass fb, final int dot,
final Position.Bias bias) {
super.setDot(fb, clampDot(dot, tf), bias); super.setDot(fb, clampDot(dot, tf), bias);
} }
@Override @Override
public void moveDot(final FilterBypass fb, final int dot, final Position.Bias bias) { public void moveDot(final NavigationFilter.FilterBypass fb, final int dot,
final Position.Bias bias) {
super.moveDot(fb, clampDot(dot, tf), bias); super.moveDot(fb, clampDot(dot, tf), bias);
} }

6
core/src/main/java/com/github/weisj/darklaf/components/iconeditor/IconEditorPanel.java

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2020-2021 Jannis Weis * Copyright (c) 2020-2023 Jannis Weis
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, * associated documentation files (the "Software"), to deal in the Software without restriction,
@ -147,8 +147,8 @@ public class IconEditorPanel extends JPanel {
List<String> keys = props.entrySet().stream().sorted((e1, e2) -> { List<String> keys = props.entrySet().stream().sorted((e1, e2) -> {
boolean color1 = e1.getValue() instanceof Color; boolean color1 = e1.getValue() instanceof Color;
boolean color2 = e2.getValue() instanceof Color; boolean color2 = e2.getValue() instanceof Color;
if (color1 && !color2) return -1; if (!color2) return -1;
if (color2 && !color1) return 1; if (!color1) return 1;
return e1.getKey().toString().compareTo(e2.getKey().toString()); return e1.getKey().toString().compareTo(e2.getKey().toString());
}).map(e -> e.getKey().toString()).collect(Collectors.toList()); }).map(e -> e.getKey().toString()).collect(Collectors.toList());
valuePanel.add(LayoutHelper.createTitledColumn( valuePanel.add(LayoutHelper.createTitledColumn(

4
core/src/main/java/com/github/weisj/darklaf/defaults/ResourceBundleCache.java

@ -25,7 +25,7 @@ import java.util.*;
class ResourceBundleCache { class ResourceBundleCache {
private static class ResourceBundleEntry { private static final class ResourceBundleEntry {
private final WeakReference<ClassLoader> classLoader; private final WeakReference<ClassLoader> classLoader;
private final String path; private final String path;
@ -37,7 +37,7 @@ class ResourceBundleCache {
@Override @Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (!(o instanceof ResourceBundleEntry)) return false;
ResourceBundleEntry that = (ResourceBundleEntry) o; ResourceBundleEntry that = (ResourceBundleEntry) o;
ClassLoader loaderA = classLoader.get(); ClassLoader loaderA = classLoader.get();
ClassLoader loaderB = that.classLoader.get(); ClassLoader loaderB = that.classLoader.get();

1
core/src/main/java/com/github/weisj/darklaf/defaults/UIDefaultsWithResourceBundleCache.java

@ -34,6 +34,7 @@ public class UIDefaultsWithResourceBundleCache extends UIDefaults {
} }
@Override @Override
@SuppressWarnings("UnsynchronizedOverridesSynchronized")
public Object get(final Object key) { public Object get(final Object key) {
Object value = super.get(key); Object value = super.get(key);
return (value != null) ? value : getFromResourceBundle(key, null); return (value != null) ? value : getFromResourceBundle(key, null);

4
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameComponentPopupMenu.java

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2019-2021 Jannis Weis * Copyright (c) 2019-2023 Jannis Weis
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, * associated documentation files (the "Software"), to deal in the Software without restriction,
@ -95,7 +95,7 @@ public class DarkTabFrameComponentPopupMenu extends JXPopupMenu implements Prope
case NORTH_WEST: case NORTH_WEST:
case SOUTH_EAST: case SOUTH_EAST:
case SOUTH_WEST: case SOUTH_WEST:
return UIManager.getString("popup.moveTo." + a.name().toLowerCase(), l); return UIManager.getString("popup.moveTo." + a.name().toLowerCase(Locale.ENGLISH), l);
case CENTER: case CENTER:
default: default:
return ""; return "";

2
property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/DarkSVGIcon.java

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2019-2022 Jannis Weis * Copyright (c) 2019-2023 Jannis Weis
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, * associated documentation files (the "Software"), to deal in the Software without restriction,

3
utils/src/main/java/com/github/weisj/darklaf/util/AlignmentHelper.java

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2019-2021 Jannis Weis * Copyright (c) 2019-2023 Jannis Weis
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, * associated documentation files (the "Software"), to deal in the Software without restriction,
@ -56,6 +56,7 @@ final class AlignmentHelper {
} }
/** Helper interface to avoid long type names. */ /** Helper interface to avoid long type names. */
@Immutable
private interface Mapper extends BiFunction<Dimension, Rectangle, Integer> { private interface Mapper extends BiFunction<Dimension, Rectangle, Integer> {
} }

Loading…
Cancel
Save