Skip to content

Commit

Permalink
8297413: Remove easy warnings in javafx.graphics
Browse files Browse the repository at this point in the history
Reviewed-by: kcr, nlisker, angorya
  • Loading branch information
hjohn authored and nlisker committed Dec 6, 2022
1 parent 7b3c88b commit f333662
Show file tree
Hide file tree
Showing 619 changed files with 2,767 additions and 1,966 deletions.
Expand Up @@ -66,10 +66,10 @@ public class Clipboard {
@Native public final static String SYSTEM = "SYSTEM";
@Native public final static String SELECTION = "SELECTION";

private final static Map <String, Clipboard> clipboards = new HashMap <String, Clipboard> ();
private final static Map<String, Clipboard> clipboards = new HashMap<>();
private final static ClipboardDelegate delegate = PlatformFactory.getPlatformFactory().createClipboardDelegate();

private final HashSet <ClipboardAssistance> assistants = new HashSet <ClipboardAssistance> ();
private final HashSet<ClipboardAssistance> assistants = new HashSet<>();
private final String name;
private final Object localDataProtector = new Object();
private HashMap <String, Object> localSharedData;
Expand Down
Expand Up @@ -28,7 +28,7 @@

public class ClipboardAssistance {

private final HashMap <String, Object> cacheData = new HashMap <String, Object> ();
private final HashMap<String, Object> cacheData = new HashMap<>();
private final Clipboard clipboard;
private int supportedActions = Clipboard.ACTION_ANY;

Expand Down
Expand Up @@ -251,7 +251,7 @@ private static String convertTitle(String title) {
protected static FileChooserResult createFileChooserResult(String[] files,
ExtensionFilter[] extensionFilters, int index)
{
List<File> list = new ArrayList<File>();
List<File> list = new ArrayList<>();
for (String s : files) {
if (s != null) {
list.add(new File(s));
Expand Down
Expand Up @@ -32,7 +32,7 @@
*/
public final class EventLoop {

private static final Deque<EventLoop> stack = new ArrayDeque<EventLoop>();
private static final Deque<EventLoop> stack = new ArrayDeque<>();

/**
* Possible states for a nested event loop object.
Expand Down
Expand Up @@ -24,7 +24,6 @@
*/
package com.sun.glass.ui;

import java.util.*;
import java.util.concurrent.*;

/**
Expand All @@ -43,7 +42,7 @@
*/
public final class InvokeLaterDispatcher extends Thread {
// The runnables queue
private final BlockingDeque<Runnable> deque = new LinkedBlockingDeque<Runnable>();
private final BlockingDeque<Runnable> deque = new LinkedBlockingDeque<>();

// Main lock
private final Object LOCK = new StringBuilder("InvokeLaterLock");
Expand Down
Expand Up @@ -28,7 +28,6 @@
import java.util.ArrayList;
import java.util.Collections;

import com.sun.glass.ui.Pixels;
import com.sun.glass.ui.delegate.MenuDelegate;
import com.sun.glass.ui.delegate.MenuItemDelegate;

Expand Down Expand Up @@ -58,7 +57,7 @@ public void setEventHandler(EventHandler eventHandler) {

private String title;
private boolean enabled;
private final List<Object> items = new ArrayList<Object>();
private final List<Object> items = new ArrayList<>();

private EventHandler eventHandler;

Expand Down
Expand Up @@ -33,7 +33,7 @@ public final class MenuBar {

final private MenuBarDelegate delegate;

private final List<Menu> menus = new ArrayList<Menu>();
private final List<Menu> menus = new ArrayList<>();

protected MenuBar() {
Application.checkEventThread();
Expand Down
Expand Up @@ -24,9 +24,6 @@
*/
package com.sun.glass.ui;

import java.security.AccessController;
import java.security.PrivilegedAction;

public final class Size {
public int width;
public int height;
Expand Down
Expand Up @@ -98,7 +98,7 @@ public synchronized void start(int period) {
this.period = UNSET_PERIOD;
throw new RuntimeException("Failed to start the timer");
} else {
this.period = (double)period;
this.period = period;
}
}

Expand Down
Expand Up @@ -925,7 +925,7 @@ protected void notifyMouse(int type, int button, int x, int y, int xAbs,
} else {
clickCount = 1;

View.lastClickedView = new WeakReference<View>(this);
View.lastClickedView = new WeakReference<>(this);
lastClickedButton = button;
lastClickedX = x;
lastClickedY = y;
Expand Down
Expand Up @@ -33,7 +33,6 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public abstract class Window {

Expand Down Expand Up @@ -84,7 +83,7 @@ public void handleLevelEvent(int level) {
private volatile long delegatePtr = 0L;

// window list
static private final LinkedList<Window> visibleWindows = new LinkedList<Window>();
static private final LinkedList<Window> visibleWindows = new LinkedList<>();
// Return a list of all visible windows. Note that on platforms without a native window manager,
// this list will be sorted in proper z-order
static public synchronized List<Window> getWindows() {
Expand Down
Expand Up @@ -28,7 +28,7 @@ public class Activity {

public static void shutdown() {
_shutdown();
};
}

private static native void _shutdown();
}
Expand Up @@ -24,9 +24,6 @@
*/
package com.sun.glass.ui.android;

import javafx.application.Platform;
import javafx.scene.Node;

public class DalvikInput {
/*
Expand Down
Expand Up @@ -32,6 +32,7 @@ class GtkClipboardDelegate implements ClipboardDelegate {
public GtkClipboardDelegate() {
}

@Override
public Clipboard createClipboard(String clipboardName) {
if (Clipboard.SYSTEM.equals(clipboardName)) {
return new GtkSystemClipboard();
Expand Down
Expand Up @@ -34,6 +34,7 @@ public GtkDnDClipboard() {
super(Clipboard.DND);
}

@Override
protected void pushToSystem(HashMap<String, Object> cacheData,
int supportedActions) {
final int performedAction = pushToSystemImpl(cacheData,
Expand Down
Expand Up @@ -32,18 +32,22 @@ class GtkMenuBarDelegate implements MenuBarDelegate {
public GtkMenuBarDelegate() {
}

@Override
public boolean createMenuBar() {
return true;
}

@Override
public boolean insert(MenuDelegate menu, int pos) {
return true;
}

@Override
public boolean remove(MenuDelegate menu, int pos) {
return true;
}

@Override
public long getNativeMenu() {
return 0;
}
Expand Down
Expand Up @@ -33,34 +33,42 @@ class GtkMenuDelegate implements MenuDelegate {
public GtkMenuDelegate() {
}

@Override
public boolean createMenu(String title, boolean enabled) {
return true;
}

@Override
public boolean setTitle(String title) {
return true;
}

@Override
public boolean setEnabled(boolean enabled) {
return true;
}

public boolean setPixels(Pixels pixels) {
@Override
public boolean setPixels(Pixels pixels) {
return false;
}

@Override
public boolean insert(MenuDelegate menu, int pos) {
return true;
}

@Override
public boolean insert(MenuItemDelegate item, int pos) {
return true;
}

@Override
public boolean remove(MenuDelegate menu, int pos) {
return true;
}

@Override
public boolean remove(MenuItemDelegate item, int pos) {
return true;
}
Expand Down
Expand Up @@ -33,30 +33,37 @@ class GtkMenuItemDelegate implements MenuItemDelegate {
public GtkMenuItemDelegate() {
}

@Override
public boolean createMenuItem(String title, Callback callback, int shortcutKey, int shortcutModifiers, Pixels pixels, boolean enabled, boolean checked) {
return true;
}

@Override
public boolean setTitle(String title) {
return true;
}

@Override
public boolean setCallback(Callback callback) {
return true;
}

@Override
public boolean setShortcut(int shortcutKey, int shortcutModifiers) {
return true;
}

@Override
public boolean setPixels(Pixels pixels) {
return true;
}

@Override
public boolean setEnabled(boolean enabled) {
return true;
}

@Override
public boolean setChecked(boolean checked) {
return true;
}
Expand Down
Expand Up @@ -29,7 +29,6 @@
import com.sun.glass.ui.MenuBar;
import com.sun.glass.ui.MenuItem;
import com.sun.glass.ui.PlatformFactory;
import com.sun.glass.ui.Window;
import com.sun.glass.ui.delegate.ClipboardDelegate;
import com.sun.glass.ui.delegate.MenuBarDelegate;
import com.sun.glass.ui.delegate.MenuDelegate;
Expand All @@ -53,6 +52,7 @@ public final class GtkPlatformFactory extends PlatformFactory {
return new GtkMenuItemDelegate();
}

@Override
public ClipboardDelegate createClipboardDelegate() {
return new GtkClipboardDelegate();
}
Expand Down
Expand Up @@ -31,7 +31,6 @@
import com.sun.glass.ui.delegate.MenuDelegate;
import com.sun.glass.ui.delegate.MenuItemDelegate;

@SuppressWarnings({"UnusedDeclaration"})
public final class IosPlatformFactory extends PlatformFactory {

/**
Expand Down
Expand Up @@ -193,7 +193,7 @@ protected Object popFromSystem(String mimeType) {
String[][] utfs = this.pasteboard.getUTFs();
if (mimeType.equals(URI_TYPE) == true) {
if (utfs != null) {
java.util.ArrayList<String> list = new java.util.ArrayList<String>();
java.util.ArrayList<String> list = new java.util.ArrayList<>();
for (int i=0; i<utfs.length; i++) {
String url = this.pasteboard.getItemStringForUTF(i, mimeToUtf(URI_TYPE));

Expand All @@ -208,7 +208,7 @@ protected Object popFromSystem(String mimeType) {
}
} else if (mimeType.equals(RAW_IMAGE_TYPE) == true) {
if (utfs != null) {
java.util.ArrayList<Pixels> list = new java.util.ArrayList<Pixels>();
java.util.ArrayList<Pixels> list = new java.util.ArrayList<>();
for (int i=0; i<utfs.length; i++) {
Object data = this.pasteboard.getItemAsRawImage(i);
if (data != null) {
Expand All @@ -225,7 +225,7 @@ protected Object popFromSystem(String mimeType) {
(mimeType.equals(HTML_TYPE) == true) ||
(mimeType.equals(RTF_TYPE) == true)) {
if (utfs != null) {
java.util.ArrayList<String> list = new java.util.ArrayList<String>();
java.util.ArrayList<String> list = new java.util.ArrayList<>();
for (int i=0; i<utfs.length; i++) {
String item = this.pasteboard.getItemStringForUTF(i, mimeToUtf(mimeType));
if (item != null) {
Expand All @@ -240,7 +240,7 @@ protected Object popFromSystem(String mimeType) {
} else if (mimeType.equals(FILE_LIST_TYPE) == true) {
// synthesize the list from individual URLs
if (utfs != null) {
java.util.ArrayList<String> list = new java.util.ArrayList<String>();
java.util.ArrayList<String> list = new java.util.ArrayList<>();
for (int i=0; i<utfs.length; i++) {
String file = this.pasteboard.getItemStringForUTF(i, IosPasteboard.UtfFileUrl); // explicitly ask for urls
if (file != null) {
Expand All @@ -255,7 +255,7 @@ protected Object popFromSystem(String mimeType) {
}
} else {
if (utfs != null) {
java.util.ArrayList<ByteBuffer> list = new java.util.ArrayList<ByteBuffer>();
java.util.ArrayList<ByteBuffer> list = new java.util.ArrayList<>();
for (int i=0; i<utfs.length; i++) {
byte data[] = this.pasteboard.getItemBytesForUTF(i, mimeToUtf(mimeType));
if (data != null) {
Expand Down Expand Up @@ -284,7 +284,7 @@ protected int supportedSourceActionsFromSystem() {
protected String[] mimesFromSystem() {
String[][] all = this.pasteboard.getUTFs();

java.util.ArrayList<String> mimes = new java.util.ArrayList<String>();
java.util.ArrayList<String> mimes = new java.util.ArrayList<>();

if (all != null) {
for (int i=0; i<all.length; i++) {
Expand Down
Expand Up @@ -1119,7 +1119,7 @@ private long[] accessibilityArrayAttributeValues(long attribute, int index, int
result[i] = getNativeAccessible(node);
i++;
}
if (i == maxCount) return NSAccessibilityUnignoredChildren(result);;
if (i == maxCount) return NSAccessibilityUnignoredChildren(result);
}
return null;
}
Expand Down Expand Up @@ -1456,7 +1456,6 @@ private MacVariant accessibilityAttributeValue(long attribute) {
if (kc instanceof KeyCodeCombination) {
KeyCode code = ((KeyCodeCombination)kc).getCode();
if (!isCmdCharBased(code)) {
@SuppressWarnings("deprecation")
int keyCode = code.getCode();
result = MacApplication._getMacKey(keyCode);
}
Expand Down Expand Up @@ -1506,7 +1505,7 @@ private MacVariant accessibilityAttributeValue(long attribute) {
}
case NSAccessibilityNumberOfCharactersAttribute: {
String text = (String)result;
result = (Integer)text.length();
result = text.length();
break;
}
case NSAccessibilitySelectedTextAttribute: {
Expand Down
Expand Up @@ -373,6 +373,7 @@ boolean isNormalTaskbarApp() {
}

private native String _getDataDirectory();
@Override
public String getDataDirectory() {
checkEventThread();
String baseDirectory = _getDataDirectory();
Expand Down
Expand Up @@ -29,6 +29,7 @@

final class MacClipboardDelegate implements ClipboardDelegate {

@Override
public Clipboard createClipboard(String clipboardName) {
if (Clipboard.SYSTEM.equals(clipboardName)) {
return new MacSystemClipboard(clipboardName);
Expand Down
Expand Up @@ -26,10 +26,7 @@

import com.sun.glass.ui.TouchInputSupport;
import com.sun.glass.ui.GestureSupport;
import com.sun.glass.ui.Application;
import com.sun.glass.ui.View;
import java.security.AccessController;
import java.security.PrivilegedAction;

final class MacGestureSupport {

Expand Down

1 comment on commit f333662

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.