mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-05 04:31:36 +00:00
8044862: Fix raw and unchecked lint warnings in macosx specific code
Reviewed-by: darcy, pchelko
This commit is contained in:
parent
529b1b6422
commit
91a46ed171
@ -74,19 +74,19 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
* Entries that have been deleted. When something calls engineStore we'll
|
||||
* remove them from the keychain.
|
||||
*/
|
||||
private Hashtable deletedEntries = new Hashtable();
|
||||
private Hashtable<String, Object> deletedEntries = new Hashtable<>();
|
||||
|
||||
/**
|
||||
* Entries that have been added. When something calls engineStore we'll
|
||||
* add them to the keychain.
|
||||
*/
|
||||
private Hashtable addedEntries = new Hashtable();
|
||||
private Hashtable<String, Object> addedEntries = new Hashtable<>();
|
||||
|
||||
/**
|
||||
* Private keys and certificates are stored in a hashtable.
|
||||
* Hash entries are keyed by alias names.
|
||||
*/
|
||||
private Hashtable entries = new Hashtable();
|
||||
private Hashtable<String, Object> entries = new Hashtable<>();
|
||||
|
||||
/**
|
||||
* Algorithm identifiers and corresponding OIDs for the contents of the PKCS12 bag we get from the Keychain.
|
||||
@ -471,7 +471,7 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
|
||||
// This will be slow, but necessary. Enumerate the values and then see if the cert matches the one in the trusted cert entry.
|
||||
// Security framework doesn't support the same certificate twice in a keychain.
|
||||
Collection allValues = entries.values();
|
||||
Collection<Object> allValues = entries.values();
|
||||
|
||||
for (Object value : allValues) {
|
||||
if (value instanceof TrustedCertEntry) {
|
||||
@ -517,7 +517,7 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
*
|
||||
* @return enumeration of the alias names
|
||||
*/
|
||||
public Enumeration engineAliases() {
|
||||
public Enumeration<String> engineAliases() {
|
||||
permissionCheck();
|
||||
return entries.keys();
|
||||
}
|
||||
@ -598,8 +598,8 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
permissionCheck();
|
||||
Certificate certElem;
|
||||
|
||||
for (Enumeration e = entries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = (String)e.nextElement();
|
||||
for (Enumeration<String> e = entries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = e.nextElement();
|
||||
Object entry = entries.get(alias);
|
||||
if (entry instanceof TrustedCertEntry) {
|
||||
certElem = ((TrustedCertEntry)entry).cert;
|
||||
@ -634,8 +634,8 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
permissionCheck();
|
||||
|
||||
// Delete items that do have a keychain item ref.
|
||||
for (Enumeration e = deletedEntries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = (String)e.nextElement();
|
||||
for (Enumeration<String> e = deletedEntries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = e.nextElement();
|
||||
Object entry = deletedEntries.get(alias);
|
||||
if (entry instanceof TrustedCertEntry) {
|
||||
if (((TrustedCertEntry)entry).certRef != 0) {
|
||||
@ -664,8 +664,8 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
|
||||
// Add all of the certs or keys in the added entries.
|
||||
// No need to check for 0 refs, as they are in the added list.
|
||||
for (Enumeration e = addedEntries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = (String)e.nextElement();
|
||||
for (Enumeration<String> e = addedEntries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = e.nextElement();
|
||||
Object entry = addedEntries.get(alias);
|
||||
if (entry instanceof TrustedCertEntry) {
|
||||
TrustedCertEntry tce = (TrustedCertEntry)entry;
|
||||
@ -730,8 +730,8 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
|
||||
// Release any stray keychain references before clearing out the entries.
|
||||
synchronized(entries) {
|
||||
for (Enumeration e = entries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = (String)e.nextElement();
|
||||
for (Enumeration<String> e = entries.keys(); e.hasMoreElements(); ) {
|
||||
String alias = e.nextElement();
|
||||
Object entry = entries.get(alias);
|
||||
if (entry instanceof TrustedCertEntry) {
|
||||
if (((TrustedCertEntry)entry).certRef != 0) {
|
||||
@ -816,7 +816,7 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
|
||||
// Next, create X.509 Certificate objects from the raw data. This is complicated
|
||||
// because a certificate's public key may be too long for Java's default encryption strength.
|
||||
List createdCerts = new ArrayList();
|
||||
List<CertKeychainItemPair> createdCerts = new ArrayList<>();
|
||||
|
||||
try {
|
||||
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||
@ -842,12 +842,12 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
|
||||
// We have our certificates in the List, so now extract them into an array of
|
||||
// Certificates and SecCertificateRefs.
|
||||
Object[] objArray = createdCerts.toArray();
|
||||
CertKeychainItemPair[] objArray = createdCerts.toArray(new CertKeychainItemPair[0]);
|
||||
Certificate[] certArray = new Certificate[objArray.length];
|
||||
long[] certRefArray = new long[objArray.length];
|
||||
|
||||
for (int i = 0; i < objArray.length; i++) {
|
||||
CertKeychainItemPair addedItem = (CertKeychainItemPair)objArray[i];
|
||||
CertKeychainItemPair addedItem = objArray[i];
|
||||
certArray[i] = addedItem.mCert;
|
||||
certRefArray[i] = addedItem.mCertificateRef;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class _AppDockIconHandler {
|
||||
|
||||
static Creator getCImageCreator() {
|
||||
try {
|
||||
final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {});
|
||||
final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class<?>[] {});
|
||||
getCreatorMethod.setAccessible(true);
|
||||
return (Creator)getCreatorMethod.invoke(null, new Object[] {});
|
||||
} catch (final Throwable e) {
|
||||
|
||||
@ -75,7 +75,7 @@ public abstract class AquaBorder implements Border, UIResource {
|
||||
protected AquaBorder deriveBorderForSize(final Size size) {
|
||||
try {
|
||||
final Class<? extends AquaBorder> clazz = getClass();
|
||||
final AquaBorder border = clazz.getConstructor(new Class[] { clazz }).newInstance(new Object[] { this });
|
||||
final AquaBorder border = clazz.getConstructor(new Class<?>[] { clazz }).newInstance(new Object[] { this });
|
||||
border.setSize(size);
|
||||
return border;
|
||||
} catch (final Throwable e) {
|
||||
|
||||
@ -35,8 +35,8 @@ import apple.laf.JRSUIConstants.*;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaComboBoxButton extends JButton {
|
||||
final protected JComboBox comboBox;
|
||||
final protected JList list;
|
||||
final protected JComboBox<Object> comboBox;
|
||||
final protected JList<?> list;
|
||||
final protected CellRendererPane rendererPane;
|
||||
final protected AquaComboBoxUI ui;
|
||||
|
||||
@ -45,7 +45,10 @@ class AquaComboBoxButton extends JButton {
|
||||
boolean isSquare;
|
||||
|
||||
@SuppressWarnings("serial") // anonymous class
|
||||
protected AquaComboBoxButton(final AquaComboBoxUI ui, final JComboBox comboBox, final CellRendererPane rendererPane, final JList list) {
|
||||
protected AquaComboBoxButton(final AquaComboBoxUI ui,
|
||||
final JComboBox<Object> comboBox,
|
||||
final CellRendererPane rendererPane,
|
||||
final JList<?> list) {
|
||||
super("");
|
||||
putClientProperty("JButton.buttonType", "comboboxInternal");
|
||||
|
||||
@ -163,7 +166,7 @@ class AquaComboBoxButton extends JButton {
|
||||
}
|
||||
|
||||
protected void doRendererPaint(final Graphics g, final ButtonModel buttonModel, final boolean editable, final Insets insets, int left, int top, int width, int height) {
|
||||
final ListCellRenderer renderer = comboBox.getRenderer();
|
||||
final ListCellRenderer<Object> renderer = comboBox.getRenderer();
|
||||
|
||||
// fake it out! not renderPressed
|
||||
final Component c = renderer.getListCellRendererComponent(list, comboBox.getSelectedItem(), -1, false, false);
|
||||
|
||||
@ -43,7 +43,7 @@ class AquaComboBoxPopup extends BasicComboPopup {
|
||||
protected Component bottomStrut;
|
||||
protected boolean isPopDown = false;
|
||||
|
||||
public AquaComboBoxPopup(final JComboBox cBox) {
|
||||
public AquaComboBoxPopup(final JComboBox<Object> cBox) {
|
||||
super(cBox);
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ class AquaComboBoxPopup extends BasicComboPopup {
|
||||
final int rowCount = Math.min(maxRowCount, currentElementCount);
|
||||
|
||||
final Dimension popupSize = new Dimension();
|
||||
final ListCellRenderer renderer = list.getCellRenderer();
|
||||
final ListCellRenderer<Object> renderer = list.getCellRenderer();
|
||||
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
final Object value = list.getModel().getElementAt(i);
|
||||
@ -149,8 +149,8 @@ class AquaComboBoxPopup extends BasicComboPopup {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("serial") // anonymous class
|
||||
protected JList createList() {
|
||||
return new JList(comboBox.getModel()) {
|
||||
protected JList<Object> createList() {
|
||||
return new JList<Object>(comboBox.getModel()) {
|
||||
@Override
|
||||
public void processMouseEvent(MouseEvent e) {
|
||||
if (e.isMetaDown()) {
|
||||
|
||||
@ -29,8 +29,8 @@ import javax.swing.*;
|
||||
import javax.swing.plaf.UIResource;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaComboBoxRenderer extends AquaComboBoxRendererInternal implements UIResource {
|
||||
public AquaComboBoxRenderer(final JComboBox comboBox) {
|
||||
class AquaComboBoxRenderer extends AquaComboBoxRendererInternal<Object> implements UIResource {
|
||||
public AquaComboBoxRenderer(final JComboBox<?> comboBox) {
|
||||
super(comboBox);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer {
|
||||
final JComboBox fComboBox;
|
||||
class AquaComboBoxRendererInternal<E> extends JLabel implements ListCellRenderer<E> {
|
||||
final JComboBox<?> fComboBox;
|
||||
boolean fSelected;
|
||||
boolean fChecked;
|
||||
boolean fInList;
|
||||
@ -40,7 +40,7 @@ class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer {
|
||||
boolean fDrawCheckedItem = true;
|
||||
|
||||
// Provides space for a checkbox, and is translucent
|
||||
public AquaComboBoxRendererInternal(final JComboBox comboBox) {
|
||||
public AquaComboBoxRendererInternal(final JComboBox<?> comboBox) {
|
||||
super();
|
||||
fComboBox = comboBox;
|
||||
}
|
||||
@ -72,7 +72,10 @@ class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer {
|
||||
}
|
||||
|
||||
// Really means is the one with the mouse over it
|
||||
public Component getListCellRendererComponent(final JList list, final Object value, int index, final boolean isSelected, final boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(final JList<? extends E> list,
|
||||
final E value, int index,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus) {
|
||||
fInList = (index >= 0); // When the button wants the item painted, it passes in -1
|
||||
fSelected = isSelected;
|
||||
if (index < 0) {
|
||||
|
||||
@ -102,13 +102,13 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
if (now - 1000 < lastBlink) return;
|
||||
lastBlink = now;
|
||||
|
||||
final JList itemList = popup.getList();
|
||||
final JList<Object> itemList = popup.getList();
|
||||
final ListUI listUI = itemList.getUI();
|
||||
if (!(listUI instanceof AquaListUI)) return;
|
||||
final AquaListUI aquaListUI = (AquaListUI)listUI;
|
||||
|
||||
final int selectedIndex = comboBox.getSelectedIndex();
|
||||
final ListModel dataModel = itemList.getModel();
|
||||
final ListModel<Object> dataModel = itemList.getModel();
|
||||
if (dataModel == null) return;
|
||||
|
||||
final Object value = dataModel.getElementAt(selectedIndex);
|
||||
@ -125,7 +125,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
// this space intentionally left blank
|
||||
}
|
||||
|
||||
protected ListCellRenderer createRenderer() {
|
||||
protected ListCellRenderer<Object> createRenderer() {
|
||||
return new AquaComboBoxRenderer(comboBox);
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
|
||||
final Object text = editor.getText();
|
||||
|
||||
final ListModel model = listBox.getModel();
|
||||
final ListModel<Object> model = listBox.getModel();
|
||||
final int items = model.getSize();
|
||||
for (int i = 0; i < items; i++) {
|
||||
final Object element = model.getElementAt(i);
|
||||
@ -423,7 +423,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
return;
|
||||
}
|
||||
|
||||
final JComboBox cb = (JComboBox)parent;
|
||||
final JComboBox<?> cb = (JComboBox<?>) parent;
|
||||
final int width = cb.getWidth();
|
||||
final int height = cb.getHeight();
|
||||
|
||||
@ -450,11 +450,11 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
return Boolean.TRUE.equals(c.getClientProperty(AquaComboBoxUI.IS_TABLE_CELL_EDITOR));
|
||||
}
|
||||
|
||||
protected static boolean isPopdown(final JComboBox c) {
|
||||
protected static boolean isPopdown(final JComboBox<?> c) {
|
||||
return c.isEditable() || Boolean.TRUE.equals(c.getClientProperty(AquaComboBoxUI.POPDOWN_CLIENT_PROPERTY_KEY));
|
||||
}
|
||||
|
||||
protected static void triggerSelectionEvent(final JComboBox comboBox, final ActionEvent e) {
|
||||
protected static void triggerSelectionEvent(final JComboBox<?> comboBox, final ActionEvent e) {
|
||||
if (!comboBox.isEnabled()) return;
|
||||
|
||||
final AquaComboBoxUI aquaUi = (AquaComboBoxUI)comboBox.getUI();
|
||||
@ -505,7 +505,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
@SuppressWarnings("serial") // anonymous class
|
||||
private static final Action toggleSelectionAction = new AbstractAction() {
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JComboBox comboBox = (JComboBox)e.getSource();
|
||||
final JComboBox<?> comboBox = (JComboBox<?>) e.getSource();
|
||||
if (!comboBox.isEnabled()) return;
|
||||
if (comboBox.isEditable()) return;
|
||||
|
||||
@ -525,7 +525,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
private final Action hideAction = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JComboBox comboBox = (JComboBox)e.getSource();
|
||||
final JComboBox<?> comboBox = (JComboBox<?>) e.getSource();
|
||||
comboBox.firePopupMenuCanceled();
|
||||
comboBox.setPopupVisible(false);
|
||||
}
|
||||
@ -588,10 +588,11 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static final RecyclableSingleton<ClientPropertyApplicator<JComboBox, AquaComboBoxUI>> APPLICATOR = new RecyclableSingleton<ClientPropertyApplicator<JComboBox, AquaComboBoxUI>>() {
|
||||
static final RecyclableSingleton<ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>> APPLICATOR = new
|
||||
RecyclableSingleton<ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>>() {
|
||||
@Override
|
||||
protected ClientPropertyApplicator<JComboBox, AquaComboBoxUI> getInstance() {
|
||||
return new ClientPropertyApplicator<JComboBox, AquaComboBoxUI>(
|
||||
protected ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI> getInstance() {
|
||||
return new ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>(
|
||||
new Property<AquaComboBoxUI>(AquaFocusHandler.FRAME_ACTIVE_PROPERTY) {
|
||||
public void applyProperty(final AquaComboBoxUI target, final Object value) {
|
||||
if (Boolean.FALSE.equals(value)) {
|
||||
@ -633,7 +634,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
}
|
||||
}
|
||||
) {
|
||||
public AquaComboBoxUI convertJComponentToTarget(final JComboBox combo) {
|
||||
public AquaComboBoxUI convertJComponentToTarget(final JComboBox<?> combo) {
|
||||
final ComboBoxUI comboUI = combo.getUI();
|
||||
if (comboUI instanceof AquaComboBoxUI) return (AquaComboBoxUI)comboUI;
|
||||
return null;
|
||||
@ -641,7 +642,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
};
|
||||
}
|
||||
};
|
||||
static ClientPropertyApplicator<JComboBox, AquaComboBoxUI> getApplicator() {
|
||||
static ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI> getApplicator() {
|
||||
return APPLICATOR.get();
|
||||
}
|
||||
}
|
||||
|
||||
@ -724,6 +724,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
final Transferable transferable = dtde.getTransferable();
|
||||
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
final java.util.List<File> fileList = (java.util.List<File>)transferable.getTransferData(DataFlavor.javaFileListFlavor);
|
||||
dropFiles(fileList.toArray(new File[fileList.size()]));
|
||||
dtde.dropComplete(true);
|
||||
@ -1144,11 +1145,14 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // anonymous class
|
||||
protected ListCellRenderer createDirectoryComboBoxRenderer(final JFileChooser fc) {
|
||||
return new AquaComboBoxRendererInternal(directoryComboBox) {
|
||||
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
final File directory = (File)value;
|
||||
protected ListCellRenderer<File> createDirectoryComboBoxRenderer(final JFileChooser fc) {
|
||||
return new AquaComboBoxRendererInternal<File>(directoryComboBox) {
|
||||
public Component getListCellRendererComponent(final JList<? extends File> list,
|
||||
final File directory,
|
||||
final int index,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, directory, index, isSelected, cellHasFocus);
|
||||
if (directory == null) {
|
||||
setText("");
|
||||
return this;
|
||||
@ -1173,7 +1177,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Data model for a type-face selection combo-box.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
|
||||
protected class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
|
||||
Vector<File> fDirectories = new Vector<File>();
|
||||
int topIndex = -1;
|
||||
int fPathCount = 0;
|
||||
@ -1248,7 +1252,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return fDirectories.size();
|
||||
}
|
||||
|
||||
public Object getElementAt(final int index) {
|
||||
public File getElementAt(final int index) {
|
||||
return fDirectories.elementAt(index);
|
||||
}
|
||||
}
|
||||
@ -1257,11 +1261,14 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// Renderer for Types ComboBox
|
||||
//
|
||||
@SuppressWarnings("serial") // anonymous class
|
||||
protected ListCellRenderer createFilterComboBoxRenderer() {
|
||||
return new AquaComboBoxRendererInternal(filterComboBox) {
|
||||
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
final FileFilter filter = (FileFilter)value;
|
||||
protected ListCellRenderer<FileFilter> createFilterComboBoxRenderer() {
|
||||
return new AquaComboBoxRendererInternal<FileFilter>(filterComboBox) {
|
||||
public Component getListCellRendererComponent(final JList<? extends FileFilter> list,
|
||||
final FileFilter filter,
|
||||
final int index,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus) {
|
||||
super.getListCellRendererComponent(list, filter, index, isSelected, cellHasFocus);
|
||||
if (filter != null) setText(filter.getDescription());
|
||||
return this;
|
||||
}
|
||||
@ -1356,7 +1363,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
getFileChooser().setFileFilter((FileFilter)filterComboBox.getSelectedItem());
|
||||
getFileChooser().setFileFilter((FileFilter) filterComboBox.getSelectedItem());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1503,7 +1510,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
fTextfieldPanel.add(tPanel, BorderLayout.CENTER);
|
||||
|
||||
// DirectoryComboBox, left-justified, 200x20 not including drop shadow
|
||||
directoryComboBox = new JComboBox();
|
||||
directoryComboBox = new JComboBox<>();
|
||||
directoryComboBox.putClientProperty("JComboBox.lightweightKeyboardNavigation", "Lightweight");
|
||||
fDirectoryComboBoxModel = createDirectoryComboBoxModel(fc);
|
||||
directoryComboBox.setModel(fDirectoryComboBoxModel);
|
||||
@ -1551,7 +1558,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// Combobox
|
||||
filterComboBoxModel = createFilterComboBoxModel();
|
||||
fc.addPropertyChangeListener(filterComboBoxModel);
|
||||
filterComboBox = new JComboBox(filterComboBoxModel);
|
||||
filterComboBox = new JComboBox<>(filterComboBoxModel);
|
||||
formatLabel.setLabelFor(filterComboBox);
|
||||
filterComboBox.setRenderer(createFilterComboBoxRenderer());
|
||||
d = new Dimension(220, (int)filterComboBox.getMinimumSize().getHeight());
|
||||
@ -1788,7 +1795,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
JComboBox directoryComboBox;
|
||||
JComboBox<File> directoryComboBox;
|
||||
DirectoryComboBoxModel fDirectoryComboBoxModel;
|
||||
private final Action directoryComboBoxAction = new DirectoryComboBoxAction();
|
||||
|
||||
@ -1797,7 +1804,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
JTableExtension fFileList;
|
||||
|
||||
private FilterComboBoxModel filterComboBoxModel;
|
||||
JComboBox filterComboBox;
|
||||
JComboBox<FileFilter> filterComboBox;
|
||||
private final Action filterComboBoxAction = new FilterComboBoxAction();
|
||||
|
||||
private static final Dimension hstrut10 = new Dimension(10, 1);
|
||||
|
||||
@ -131,7 +131,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener {
|
||||
c.setSelectionBackground(UIManager.getColor(bgName));
|
||||
}
|
||||
|
||||
static void swapSelectionColors(final String prefix, final JList c, final Object value) {
|
||||
static void swapSelectionColors(final String prefix, final JList<?> c, final Object value) {
|
||||
if (!isComponentValid(c)) return;
|
||||
|
||||
final Color bg = c.getSelectionBackground();
|
||||
@ -149,7 +149,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
static void setSelectionColors(final JList c, final String fgName, final String bgName) {
|
||||
static void setSelectionColors(final JList<?> c, final String fgName, final String bgName) {
|
||||
c.setSelectionForeground(UIManager.getColor(fgName));
|
||||
c.setSelectionBackground(UIManager.getColor(bgName));
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public class AquaListUI extends BasicListUI {
|
||||
* For a Home action, scrolls to the top. Otherwise, scroll to the end.
|
||||
*/
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JList list = (JList)e.getSource();
|
||||
final JList<?> list = (JList<?>)e.getSource();
|
||||
|
||||
if (fHomeAction) {
|
||||
list.ensureIndexIsVisible(0);
|
||||
@ -135,7 +135,7 @@ public class AquaListUI extends BasicListUI {
|
||||
}*/
|
||||
}
|
||||
|
||||
JList getComponent() {
|
||||
JList<Object> getComponent() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class AquaListUI extends BasicListUI {
|
||||
final Rectangle rowBounds = getCellBounds(list, selectedIndex, selectedIndex);
|
||||
if (rowBounds == null) return;
|
||||
|
||||
final ListCellRenderer renderer = list.getCellRenderer();
|
||||
final ListCellRenderer<Object> renderer = list.getCellRenderer();
|
||||
if (renderer == null) return;
|
||||
|
||||
final Component rendererComponent = renderer.getListCellRendererComponent(list, value, selectedIndex, selected, true);
|
||||
|
||||
@ -3820,7 +3820,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
_loader = null;
|
||||
final Class<?> klass = (Class<?>)loader;
|
||||
try {
|
||||
final java.lang.reflect.Method method = klass.getDeclaredMethod("loadActionMap", new Class[] { LazyActionMap.class });
|
||||
final java.lang.reflect.Method method = klass.getDeclaredMethod("loadActionMap", new Class<?>[] { LazyActionMap.class });
|
||||
method.invoke(klass, new Object[] { this });
|
||||
} catch (final NoSuchMethodException nsme) {
|
||||
assert false : "LazyActionMap unable to load actions " + klass;
|
||||
|
||||
@ -69,6 +69,7 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
|
||||
final static RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>> TABLE_HEADER_APPLICATORS = new RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected ClientPropertyApplicator<JTableHeader, JTableHeader> getInstance() {
|
||||
return new ClientPropertyApplicator<JTableHeader, JTableHeader>(
|
||||
new Property<JTableHeader>("JTableHeader.selectedColumn") {
|
||||
|
||||
@ -121,7 +121,7 @@ public class AquaUtilControlSize {
|
||||
try {
|
||||
// see if this component has a "getUI" method
|
||||
final Class<? extends JComponent> clazz = c.getClass();
|
||||
final Method getUIMethod = clazz.getMethod("getUI", new Class[0]);
|
||||
final Method getUIMethod = clazz.getMethod("getUI", new Class<?>[0]);
|
||||
|
||||
// see if that UI is one of ours that understands sizing
|
||||
final Object ui = getUIMethod.invoke(c, new Object[0]);
|
||||
|
||||
@ -82,7 +82,8 @@ final class AquaUtils {
|
||||
@Override
|
||||
public Creator run() {
|
||||
try {
|
||||
final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {});
|
||||
final Method getCreatorMethod = CImage.class.getDeclaredMethod(
|
||||
"getCreator", new Class<?>[] {});
|
||||
getCreatorMethod.setAccessible(true);
|
||||
return (Creator)getCreatorMethod.invoke(null, new Object[] {});
|
||||
} catch (final Exception ignored) {
|
||||
@ -383,7 +384,8 @@ final class AquaUtils {
|
||||
@Override
|
||||
public Method run() {
|
||||
try {
|
||||
final Method method = JComponent.class.getDeclaredMethod("getFlag", new Class[] { int.class });
|
||||
final Method method = JComponent.class.getDeclaredMethod(
|
||||
"getFlag", new Class<?>[] { int.class });
|
||||
method.setAccessible(true);
|
||||
return method;
|
||||
} catch (final Throwable ignored) {
|
||||
|
||||
@ -33,6 +33,7 @@ import javax.swing.JComponent;
|
||||
public class ClientPropertyApplicator<T extends JComponent, N> implements PropertyChangeListener {
|
||||
private final Map<String, Property<N>> properties = new HashMap<String, Property<N>>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ClientPropertyApplicator(final Property<N>... propertyList) {
|
||||
for (final Property<N> p : propertyList) {
|
||||
properties.put(p.name, p);
|
||||
|
||||
@ -273,6 +273,7 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM
|
||||
try {
|
||||
if (stolenFields == null) return m;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Vector<Menu> menus = (Vector<Menu>)stolenFields[0].get(this);
|
||||
menus.insertElementAt(m, index);
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||
super.startDrag(dsc, cursor, dragImage, dragImageOffset);
|
||||
}
|
||||
|
||||
protected void startDrag(Transferable transferable, long[] formats, Map formatMap) {
|
||||
protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) {
|
||||
DragGestureEvent trigger = getTrigger();
|
||||
InputEvent triggerEvent = trigger.getTriggerEvent();
|
||||
|
||||
@ -311,7 +311,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefaultDragImage(JList component) {
|
||||
private void setDefaultDragImage(JList<?> component) {
|
||||
Rectangle selectedOutline = null;
|
||||
|
||||
// This code actually works, even under the (non-existant) multiple-selections, because we only draw a union outline
|
||||
@ -485,7 +485,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||
private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable,
|
||||
InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp,
|
||||
long nsDragImagePtr, int dragImageOffsetX, int dragImageOffsetY,
|
||||
int sourceActions, long[] formats, Map formatMap);
|
||||
int sourceActions, long[] formats, Map<Long, DataFlavor> formatMap);
|
||||
|
||||
private native void doDragging(long nativeDragSource);
|
||||
|
||||
|
||||
@ -44,13 +44,14 @@ import sun.lwawt.*;
|
||||
public class CInputMethod extends InputMethodAdapter {
|
||||
private InputMethodContext fIMContext;
|
||||
private Component fAwtFocussedComponent;
|
||||
private LWComponentPeer fAwtFocussedComponentPeer;
|
||||
private LWComponentPeer<?, ?> fAwtFocussedComponentPeer;
|
||||
private boolean isActive;
|
||||
|
||||
private static Map<TextAttribute, Integer>[] sHighlightStyles;
|
||||
|
||||
// Intitalize highlight mapping table and its mapper.
|
||||
static {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
Map<TextAttribute, Integer> styles[] = new Map[4];
|
||||
HashMap<TextAttribute, Integer> map;
|
||||
|
||||
@ -242,7 +243,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
public void hideWindows() {
|
||||
}
|
||||
|
||||
long getNativeViewPtr(LWComponentPeer peer) {
|
||||
long getNativeViewPtr(LWComponentPeer<?, ?> peer) {
|
||||
if (peer.getPlatformWindow() instanceof CPlatformWindow) {
|
||||
CPlatformWindow platformWindow = (CPlatformWindow) peer.getPlatformWindow();
|
||||
CPlatformView platformView = platformWindow.getContentView();
|
||||
@ -272,7 +273,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
* to talk to when responding to key events.
|
||||
*/
|
||||
protected void setAWTFocussedComponent(Component component) {
|
||||
LWComponentPeer peer = null;
|
||||
LWComponentPeer<?, ?> peer = null;
|
||||
long modelPtr = 0;
|
||||
CInputMethod imInstance = this;
|
||||
|
||||
@ -305,7 +306,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
/**
|
||||
* @see java.awt.Toolkit#mapInputMethodHighlight
|
||||
*/
|
||||
public static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||
public static Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||
int index;
|
||||
int state = highlight.getState();
|
||||
if (state == InputMethodHighlight.RAW_TEXT) {
|
||||
@ -384,7 +385,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
|
||||
// java.awt.Toolkit#getNativeContainer() is not available
|
||||
// from this package
|
||||
private LWComponentPeer getNearestNativePeer(Component comp) {
|
||||
private LWComponentPeer<?, ?> getNearestNativePeer(Component comp) {
|
||||
if (comp==null)
|
||||
return null;
|
||||
|
||||
@ -796,7 +797,7 @@ public class CInputMethod extends InputMethodAdapter {
|
||||
// these calls will be ignored.
|
||||
private native void nativeNotifyPeer(long nativePeer, CInputMethod imInstance);
|
||||
private native void nativeEndComposition(long nativePeer);
|
||||
private native void nativeHandleEvent(LWComponentPeer peer, AWTEvent event);
|
||||
private native void nativeHandleEvent(LWComponentPeer<?, ?> peer, AWTEvent event);
|
||||
|
||||
// Returns the locale of the active input method.
|
||||
static native Locale getNativeLocale();
|
||||
|
||||
@ -57,7 +57,7 @@ public class CInputMethodDescriptor implements InputMethodDescriptor {
|
||||
}
|
||||
|
||||
static Object[] getAvailableLocalesInternal() {
|
||||
List workList = nativeGetAvailableLocales();
|
||||
List<?> workList = nativeGetAvailableLocales();
|
||||
|
||||
if (workList != null) {
|
||||
return workList.toArray();
|
||||
@ -119,5 +119,5 @@ public class CInputMethodDescriptor implements InputMethodDescriptor {
|
||||
}
|
||||
|
||||
private static native void nativeInit();
|
||||
private static native List nativeGetAvailableLocales();
|
||||
private static native List<?> nativeGetAvailableLocales();
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
return (bits & mask) != 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
static ClientPropertyApplicator<JRootPane, CPlatformWindow> CLIENT_PROPERTY_APPLICATOR = new ClientPropertyApplicator<JRootPane, CPlatformWindow>(new Property[] {
|
||||
new Property<CPlatformWindow>(WINDOW_DOCUMENT_MODIFIED) { public void applyProperty(final CPlatformWindow c, final Object value) {
|
||||
c.setStyleBits(DOCUMENT_MODIFIED, value == null ? false : Boolean.parseBoolean(value.toString()));
|
||||
|
||||
@ -32,6 +32,7 @@ import java.awt.dnd.peer.DragSourceContextPeer;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.InvocationEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.im.InputMethodHighlight;
|
||||
import java.awt.im.spi.InputMethodDescriptor;
|
||||
import java.awt.peer.*;
|
||||
@ -691,6 +692,7 @@ public final class LWCToolkit extends LWToolkit {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
|
||||
Class<T> abstractRecognizerClass, DragSource ds, Component c,
|
||||
int srcActions, DragGestureListener dgl) {
|
||||
@ -743,7 +745,7 @@ public final class LWCToolkit extends LWToolkit {
|
||||
* @since 1.3
|
||||
*/
|
||||
@Override
|
||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||
public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||
return CInputMethod.mapInputMethodHighlight(highlight);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user