Remove -Xlint:unchecked warnings

Fixed all instances of warnings OpenJDK finds with -Xlint:unchecked.
Merging this will at least result in a dependency on JDK 1.5 or later
that I'm pretty sure of.  But since the only JDKs that are really safe
to use these days are versions 1.8 and 9, that's probably okay.

No promises that this will make modern SWT work or anything, but it's
probably at least a beginnig toward that as well.
This commit is contained in:
T. Joseph Carter 2017-11-09 13:03:03 -08:00
parent 1880998892
commit 292afd24c9
29 changed files with 112 additions and 109 deletions

View File

@ -87,6 +87,7 @@
<javac srcdir="${source}" destdir="${classes}" classpath="${swtjar}"> <javac srcdir="${source}" destdir="${classes}" classpath="${swtjar}">
<include name="**/*.java"/> <include name="**/*.java"/>
<exclude name="**/*Test.java"/> <exclude name="**/*Test.java"/>
<compilerarg value="-Xlint:unchecked"/>
</javac> </javac>
<jar jarfile="${guijar}" manifest="build/manifest.mf"> <jar jarfile="${guijar}" manifest="build/manifest.mf">
<fileset dir="${classes}"/> <fileset dir="${classes}"/>
@ -107,6 +108,7 @@
<javac srcdir="${source}" destdir="${classes}" > <javac srcdir="${source}" destdir="${classes}" >
<include name="**/*.java"/> <include name="**/*.java"/>
<exclude name="**/*Test.java"/> <exclude name="**/*Test.java"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-XDignore.symbol.file"/> <compilerarg value="-XDignore.symbol.file"/>
</javac> </javac>
<jar jarfile="${cmdjar}" manifest="build/ac.mf"> <jar jarfile="${cmdjar}" manifest="build/ac.mf">

View File

@ -72,25 +72,25 @@ public class ApplesoftCompiler implements ApplesoftTokens {
* by the compiled program. This map is keyed by the name of the * by the compiled program. This map is keyed by the name of the
* address and the value is the address. * address and the value is the address.
*/ */
private Map knownAddresses = new HashMap(); private Map<String,String> knownAddresses = new HashMap<>();
/** /**
* Lists the names of all addresses used by the compiled program. * Lists the names of all addresses used by the compiled program.
* To identify the value, use the knownAddresses map. * To identify the value, use the knownAddresses map.
*/ */
private List usedAddresses = new ArrayList(); private List<String> usedAddresses = new ArrayList<>();
/** /**
* Contains a list of all variables declared or used by the * Contains a list of all variables declared or used by the
* program. * program.
*/ */
private List variables = new ArrayList(); private List<Variable> variables = new ArrayList<>();
/** /**
* Dynamically created map of commands to Methods. * Dynamically created map of commands to Methods.
*/ */
private Map commandMethods = new HashMap(); private Map<String,Method> commandMethods = new HashMap<>();
/** /**
* Track FOR loop variables. * Track FOR loop variables.
*/ */
private Stack loopVariables = new Stack(); private Stack<String> loopVariables = new Stack<>();
/** /**
* Indicates integer math operations only. * Indicates integer math operations only.
*/ */

View File

@ -37,7 +37,7 @@ public interface DirectoryEntry {
* return value should always be a list - a directory * return value should always be a list - a directory
* with 0 entries returns an empty list. * with 0 entries returns an empty list.
*/ */
public List getFiles(); public List<FileEntry> getFiles();
/** /**
* Create a new FileEntry. * Create a new FileEntry.

View File

@ -84,7 +84,7 @@ public interface FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode); public List<String> getFileColumnData(int displayMode);
/** /**
* Get file data. This handles any operating-system specific issues. * Get file data. This handles any operating-system specific issues.

View File

@ -29,7 +29,7 @@ import java.util.Comparator;
* Date created: Oct 27, 2002 8:24:39 PM * Date created: Oct 27, 2002 8:24:39 PM
* @author Rob Greene * @author Rob Greene
*/ */
public class FileEntryComparator implements Comparator { public class FileEntryComparator implements Comparator<FileEntry> {
private int columnIndex; private int columnIndex;
private int displayMode; private int displayMode;
@ -45,11 +45,12 @@ public class FileEntryComparator implements Comparator {
* Compare two FileEntry objects. * Compare two FileEntry objects.
* @see java.util.Comparator#compare(Object, Object) * @see java.util.Comparator#compare(Object, Object)
*/ */
public int compare(Object o1, Object o2) { public int compare(FileEntry o1, FileEntry o2) {
// FIXME?: This safety check is safe to remove now?
if (!(o1 instanceof FileEntry) || !(o2 instanceof FileEntry)) { if (!(o1 instanceof FileEntry) || !(o2 instanceof FileEntry)) {
return 0; return 0;
} }
if (o1 == null || o2 == null) { if (o1 == null || o2 == null) {
return ((o1 == null) ? -1 : 0) + ((o2 == null) ? 1 : 0); return ((o1 == null) ? -1 : 0) + ((o2 == null) ? 1 : 0);
} }

View File

@ -185,8 +185,8 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
* each disk format can build this as appropriate. Each subclass should * each disk format can build this as appropriate. Each subclass should
* override this method and add its own detail. * override this method and add its own detail.
*/ */
public List getDiskInformation() { public List<DiskInformation> getDiskInformation() {
List list = new ArrayList(); List<DiskInformation> list = new ArrayList<>();
list.add(new DiskInformation(textBundle.get("FormattedDisk.FileName"), getFilename())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FormattedDisk.FileName"), getFilename())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.DiskName"), getDiskName())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FormattedDisk.DiskName"), getDiskName())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.PhysicalSizeInBytes"), getPhysicalSize())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FormattedDisk.PhysicalSizeInBytes"), getPhysicalSize())); //$NON-NLS-1$
@ -204,8 +204,8 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
list.add(new FileColumnHeader(textBundle list.add(new FileColumnHeader(textBundle
.get("Name"), 30, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$ .get("Name"), 30, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle list.add(new FileColumnHeader(textBundle

View File

@ -413,7 +413,7 @@ public class GraphicsFileFilter implements FileFilter {
* @see <a href="http://web.pdx.edu/~heiss/technotes/ftyp/ft.about.html">File Types</a> * @see <a href="http://web.pdx.edu/~heiss/technotes/ftyp/ft.about.html">File Types</a>
*/ */
public AppleImage[] buildQuickDraw2Icons(FileEntry fileEntry) { public AppleImage[] buildQuickDraw2Icons(FileEntry fileEntry) {
List icons = new ArrayList(); List<AppleImage> icons = new ArrayList<>();
int offset = 26; // skip file header int offset = 26; // skip file header
byte[] filedata = fileEntry.getFileData(); byte[] filedata = fileEntry.getFileData();
while (offset < filedata.length) { while (offset < filedata.length) {

View File

@ -49,17 +49,17 @@ public abstract class AppleImage {
public static AppleImage create(int width, int height) { public static AppleImage create(int width, int height) {
String[] classes = { String[] classes = {
"ImageIoImage", "SunJpegImage", "SwtImage" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "ImageIoImage", "SunJpegImage", "SwtImage" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Class[] constructorArgClasses = new Class[] { Class<?> constructorArgType = AppleImage.class;
int.class, int.class }; Class<?>[] constructorArgClasses = new Class[] { AppleImage.class };
Object[] constructorArgs = new Object[] { Object[] constructorArgs = new Object[] {
new Integer(width), new Integer(height) }; new Integer(width), new Integer(height) };
for (int i=0; i<classes.length; i++) { for (int i=0; i<classes.length; i++) {
try { try {
Class appleImageClass = Class.forName( Class<?> appleImageClass = Class.forName(
"com.webcodepro.applecommander.storage.filters.imagehandlers." //$NON-NLS-1$ "com.webcodepro.applecommander.storage.filters.imagehandlers." //$NON-NLS-1$
+ classes[i]); + classes[i]);
Constructor constructor = Constructor constructor =
appleImageClass.getConstructor(constructorArgClasses); constructorArgType.getConstructor(constructorArgClasses);
AppleImage appleImage = (AppleImage) AppleImage appleImage = (AppleImage)
constructor.newInstance(constructorArgs); constructor.newInstance(constructorArgs);
return appleImage; return appleImage;

View File

@ -98,7 +98,7 @@ public class CpmFileEntry implements FileEntry {
/** /**
* The offset(s) into the block that the FileEntry is at. * The offset(s) into the block that the FileEntry is at.
*/ */
private List offsets = new ArrayList(); private List<Integer> offsets = new ArrayList<>();
/** /**
* Construct a CP/M file entry. * Construct a CP/M file entry.
@ -374,10 +374,10 @@ public class CpmFileEntry implements FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode) { public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
List list = new ArrayList(); List<String> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE: case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(getFilename()); list.add(getFilename());

View File

@ -152,7 +152,7 @@ public class CpmFormatDisk extends FormattedDisk {
* Compute the number of CP/M blocks that are currently used. * Compute the number of CP/M blocks that are currently used.
*/ */
public int getBlocksUsed() { public int getBlocksUsed() {
List files = getFiles(); List<FileEntry> files = getFiles();
int blocksUsed = 0; int blocksUsed = 0;
for (int i=0; i<files.size(); i++) { for (int i=0; i<files.size(); i++) {
CpmFileEntry fileEntry = (CpmFileEntry) files.get(i); CpmFileEntry fileEntry = (CpmFileEntry) files.get(i);
@ -192,7 +192,7 @@ public class CpmFormatDisk extends FormattedDisk {
usage[i] = true; usage[i] = true;
} }
// fill in space used by files // fill in space used by files
List files = getFiles(); List<FileEntry> files = getFiles();
for (int i=0; i<files.size(); i++) { for (int i=0; i<files.size(); i++) {
CpmFileEntry fileEntry = (CpmFileEntry) files.get(i); CpmFileEntry fileEntry = (CpmFileEntry) files.get(i);
int[] allocation = fileEntry.getAllocations(); int[] allocation = fileEntry.getAllocations();
@ -379,9 +379,9 @@ public class CpmFormatDisk extends FormattedDisk {
* Answer with a list of file entries. * Answer with a list of file entries.
* @see com.webcodepro.applecommander.storage.DirectoryEntry#getFiles() * @see com.webcodepro.applecommander.storage.DirectoryEntry#getFiles()
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
List files = new ArrayList(); List<FileEntry> files = new ArrayList<>();
Map index = new HashMap(); Map<String,CpmFileEntry> index = new HashMap<>();
for (int i=0; i<64; i++) { for (int i=0; i<64; i++) {
int offset = i*CpmFileEntry.ENTRY_LENGTH; int offset = i*CpmFileEntry.ENTRY_LENGTH;
CpmFileEntry fileEntry = new CpmFileEntry(this, offset); CpmFileEntry fileEntry = new CpmFileEntry(this, offset);
@ -473,8 +473,8 @@ public class CpmFormatDisk extends FormattedDisk {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FILE_DISPLAY_NATIVE: case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(textBundle.get("Name"), 8, //$NON-NLS-1$ list.add(new FileColumnHeader(textBundle.get("Name"), 8, //$NON-NLS-1$

View File

@ -263,10 +263,10 @@ public class DosFileEntry implements FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode) { public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
List list = new ArrayList(); List<String> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE: case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$

View File

@ -134,8 +134,8 @@ public class DosFormatDisk extends FormattedDisk {
* Retrieve a list of files. * Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
List list = new ArrayList(); List<FileEntry> list = new ArrayList<>();
byte[] vtoc = readVtoc(); byte[] vtoc = readVtoc();
int track = AppleUtil.getUnsignedByte(vtoc[1]); int track = AppleUtil.getUnsignedByte(vtoc[1]);
int sector = AppleUtil.getUnsignedByte(vtoc[2]); int sector = AppleUtil.getUnsignedByte(vtoc[2]);
@ -319,8 +319,8 @@ public class DosFormatDisk extends FormattedDisk {
/** /**
* Get DOS-specific disk information. * Get DOS-specific disk information.
*/ */
public List getDiskInformation() { public List<DiskInformation> getDiskInformation() {
List list = super.getDiskInformation(); List<DiskInformation> list = super.getDiskInformation();
list.add(new DiskInformation(textBundle.get("DosFormatDisk.TotalSectors"), getTotalSectors())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("DosFormatDisk.TotalSectors"), getTotalSectors())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("DosFormatDisk.FreeSectors"), getFreeSectors())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("DosFormatDisk.FreeSectors"), getFreeSectors())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("DosFormatDisk.UsedSectors"), getUsedSectors())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("DosFormatDisk.UsedSectors"), getUsedSectors())); //$NON-NLS-1$
@ -333,8 +333,8 @@ public class DosFormatDisk extends FormattedDisk {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FILE_DISPLAY_NATIVE: case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$

View File

@ -209,9 +209,9 @@ public class GutenbergFileEntry implements FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode) { public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
List list = new ArrayList(); List<String> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE: case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$

View File

@ -133,8 +133,8 @@ public class GutenbergFormatDisk extends FormattedDisk {
* Retrieve a list of files. * Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
List list = new ArrayList(); List<FileEntry> list = new ArrayList<>();
int track = CATALOG_TRACK; int track = CATALOG_TRACK;
int sector = VTOC_SECTOR; int sector = VTOC_SECTOR;
while (track < 40) { // iterate through all catalog sectors while (track < 40) { // iterate through all catalog sectors
@ -309,8 +309,8 @@ public class GutenbergFormatDisk extends FormattedDisk {
/** /**
* Get WP-specific disk information. * Get WP-specific disk information.
*/ */
public List getDiskInformation() { public List<DiskInformation> getDiskInformation() {
List list = super.getDiskInformation(); List<DiskInformation> list = super.getDiskInformation();
return list; return list;
} }
@ -318,8 +318,8 @@ public class GutenbergFormatDisk extends FormattedDisk {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FILE_DISPLAY_NATIVE: case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$

View File

@ -154,9 +154,9 @@ public class NakedosFileEntry implements FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode) { public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
List list = new ArrayList(); List<String> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE: case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$

View File

@ -138,8 +138,8 @@ public class NakedosFormatDisk extends FormattedDisk {
* Retrieve a list of files. * Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
ArrayList list = new ArrayList(); ArrayList<FileEntry> list = new ArrayList<>();
int totalUsed = 0; int totalUsed = 0;
int i; int i;
int[] fileSizes = new int[256]; int[] fileSizes = new int[256];
@ -310,9 +310,9 @@ public class NakedosFormatDisk extends FormattedDisk {
/** /**
* Get WP-specific disk information. * Get WP-specific disk information.
*/ */
public List getDiskInformation() { public List<DiskInformation> getDiskInformation() {
getFiles(); getFiles();
List list = super.getDiskInformation(); List<DiskInformation> list = super.getDiskInformation();
return list; return list;
} }
@ -320,8 +320,8 @@ public class NakedosFormatDisk extends FormattedDisk {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FILE_DISPLAY_NATIVE: case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$

View File

@ -203,7 +203,7 @@ public class PascalFileEntry implements FileEntry {
* Retrieve the list of files in this directory. * Retrieve the list of files in this directory.
* Always returns null, as Pascal does not support directories. * Always returns null, as Pascal does not support directories.
*/ */
public List getFiles() { public List<PascalFileEntry> getFiles() {
return null; return null;
} }
@ -223,7 +223,7 @@ public class PascalFileEntry implements FileEntry {
public void delete() { public void delete() {
int index = 0; int index = 0;
String dname = this.getFilename(); String dname = this.getFilename();
List dir = disk.getDirectory(); List<PascalFileEntry> dir = disk.getDirectory();
int count = dir.size(); int count = dir.size();
// find the index of the matching entry // find the index of the matching entry
for (int i = 1; i < count; i++) { for (int i = 1; i < count; i++) {
@ -261,12 +261,12 @@ public class PascalFileEntry implements FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode) { public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat( SimpleDateFormat dateFormat = new SimpleDateFormat(
textBundle.get("PascalFileEntry.PascalDateFormat")); //$NON-NLS-1$ textBundle.get("PascalFileEntry.PascalDateFormat")); //$NON-NLS-1$
List list = new ArrayList(); List<String> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE: case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(dateFormat.format(getModificationDate())); list.add(dateFormat.format(getModificationDate()));
@ -344,7 +344,7 @@ public class PascalFileEntry implements FileEntry {
*/ */
private void storageError(String s) throws DiskFullException { private void storageError(String s) throws DiskFullException {
if (this.index > 0) { if (this.index > 0) {
List dir = disk.getDirectory(); List<PascalFileEntry> dir = disk.getDirectory();
int count = dir.size(); int count = dir.size();
dir.remove(this.index); dir.remove(this.index);
PascalFileEntry volEntry = (PascalFileEntry) dir.get(0); PascalFileEntry volEntry = (PascalFileEntry) dir.get(0);
@ -452,7 +452,7 @@ public class PascalFileEntry implements FileEntry {
} }
// update this directory entry // update this directory entry
if (this.index > 0) { if (this.index > 0) {
List dir = disk.getDirectory(); List<PascalFileEntry> dir = disk.getDirectory();
dir.set(this.index, this); dir.set(this.index, this);
disk.putDirectory(dir); disk.putDirectory(dir);
} }

View File

@ -139,8 +139,8 @@ public class PascalFormatDisk extends FormattedDisk {
* Retrieve a list of files. * Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
List list = new ArrayList(); List<FileEntry> list = new ArrayList<>();
byte[] directory = readDirectory(); byte[] directory = readDirectory();
// process directory blocks: // process directory blocks:
int entrySize = ENTRY_SIZE; int entrySize = ENTRY_SIZE;
@ -158,8 +158,8 @@ public class PascalFormatDisk extends FormattedDisk {
/** /**
* Retrieve the entire directory. * Retrieve the entire directory.
*/ */
public List getDirectory() { public List<PascalFileEntry> getDirectory() {
List list = new ArrayList(); List<PascalFileEntry> list = new ArrayList<>();
byte[] directory = readDirectory(); byte[] directory = readDirectory();
int count = AppleUtil.getWordValue(directory, 16); int count = AppleUtil.getWordValue(directory, 16);
int offset = 0; int offset = 0;
@ -194,7 +194,7 @@ public class PascalFormatDisk extends FormattedDisk {
// find index of largest free space // find index of largest free space
int count = 0; int index = 0; int max = 0; int count = 0; int index = 0; int max = 0;
int last = 0; int first = 0; int free = 0; int last = 0; int first = 0; int free = 0;
List dir = getDirectory(); List<PascalFileEntry> dir = getDirectory();
count = dir.size(); count = dir.size();
for (int i = 1; i < count; i++) { for (int i = 1; i < count; i++) {
last = ((PascalFileEntry) dir.get(i - 1)).getLastBlock(); last = ((PascalFileEntry) dir.get(i - 1)).getLastBlock();
@ -432,8 +432,8 @@ public class PascalFormatDisk extends FormattedDisk {
/** /**
* Get Pascal-specific disk information. * Get Pascal-specific disk information.
*/ */
public List getDiskInformation() { public List<DiskInformation> getDiskInformation() {
List list = super.getDiskInformation(); List<DiskInformation> list = super.getDiskInformation();
list.add(new DiskInformation(textBundle.get("TotalBlocks"), getBlocksOnDisk())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("TotalBlocks"), getBlocksOnDisk())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$
@ -452,8 +452,8 @@ public class PascalFormatDisk extends FormattedDisk {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FILE_DISPLAY_NATIVE: case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(textBundle.get("Modified"), 8, //$NON-NLS-1$ list.add(new FileColumnHeader(textBundle.get("Modified"), 8, //$NON-NLS-1$

View File

@ -61,7 +61,7 @@ public class ProdosDirectoryEntry extends ProdosFileEntry implements DirectoryEn
* return value should always be a list - a directory * return value should always be a list - a directory
* with 0 entries returns an empty list. * with 0 entries returns an empty list.
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
return getDisk().getFiles(getSubdirectoryHeader().getFileEntryBlock()); return getDisk().getFiles(getSubdirectoryHeader().getFileEntryBlock());
} }

View File

@ -397,12 +397,12 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode) { public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat( SimpleDateFormat dateFormat = new SimpleDateFormat(
textBundle.get("DateFormat")); //$NON-NLS-1$ textBundle.get("DateFormat")); //$NON-NLS-1$
List list = new ArrayList(); List<String> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE: case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$ list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$

View File

@ -257,7 +257,7 @@ public class ProdosFormatDisk extends FormattedDisk {
* Retrieve a list of files. * Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles() * @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
return getFiles(VOLUME_DIRECTORY_BLOCK); return getFiles(VOLUME_DIRECTORY_BLOCK);
} }
@ -265,8 +265,8 @@ public class ProdosFormatDisk extends FormattedDisk {
* Build a list of files, starting in the given block number. * Build a list of files, starting in the given block number.
* This works for the master as well as the subdirectories. * This works for the master as well as the subdirectories.
*/ */
protected List getFiles(int blockNumber) { protected List<FileEntry> getFiles(int blockNumber) {
List files = new ArrayList(); List<FileEntry> files = new ArrayList<>();
while (blockNumber != 0) { while (blockNumber != 0) {
byte[] block = readBlock(blockNumber); byte[] block = readBlock(blockNumber);
int offset = 4; int offset = 4;
@ -400,8 +400,8 @@ public class ProdosFormatDisk extends FormattedDisk {
/** /**
* Get Pascal-specific disk information. * Get Pascal-specific disk information.
*/ */
public List getDiskInformation() { public List<DiskInformation> getDiskInformation() {
List list = super.getDiskInformation(); List<DiskInformation> list = super.getDiskInformation();
list.add(new DiskInformation(textBundle.get("TotalBlocks"), //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("TotalBlocks"), //$NON-NLS-1$
volumeHeader.getTotalBlocks())); volumeHeader.getTotalBlocks()));
list.add(new DiskInformation(textBundle.get("FreeBlocks"), //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FreeBlocks"), //$NON-NLS-1$
@ -429,8 +429,8 @@ public class ProdosFormatDisk extends FormattedDisk {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FILE_DISPLAY_NATIVE: case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$

View File

@ -157,7 +157,7 @@ public class RdosFileEntry implements FileEntry {
* Retrieve the list of files in this directory. * Retrieve the list of files in this directory.
* Since RDOS does not support directories, this will always return null. * Since RDOS does not support directories, this will always return null.
*/ */
public List getFiles() { public List<RdosFileEntry> getFiles() {
return null; return null;
} }
@ -180,10 +180,10 @@ public class RdosFileEntry implements FileEntry {
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk. * displayMode is specified in FormattedDisk.
*/ */
public List getFileColumnData(int displayMode) { public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(); NumberFormat numberFormat = NumberFormat.getNumberInstance();
List list = new ArrayList(); List<String> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE: case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(getFiletype()); list.add(getFiletype());

View File

@ -182,8 +182,8 @@ public class RdosFormatDisk extends FormattedDisk {
/** /**
* Retrieve a list of files. * Retrieve a list of files.
*/ */
public List getFiles() { public List<FileEntry> getFiles() {
List files = new ArrayList(); List<FileEntry> files = new ArrayList<>();
for (int b=13; b<23; b++) { for (int b=13; b<23; b++) {
byte[] data = readRdosBlock(b); byte[] data = readRdosBlock(b);
for (int i=0; i<data.length; i+= ENTRY_LENGTH) { for (int i=0; i<data.length; i+= ENTRY_LENGTH) {
@ -297,8 +297,8 @@ public class RdosFormatDisk extends FormattedDisk {
/** /**
* Get Pascal-specific disk information. * Get Pascal-specific disk information.
*/ */
public List getDiskInformation() { public List<DiskInformation> getDiskInformation() {
List list = super.getDiskInformation(); List<DiskInformation> list = super.getDiskInformation();
list.add(new DiskInformation(textBundle.get("TotalBlocks"), BLOCKS_ON_DISK)); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("TotalBlocks"), BLOCKS_ON_DISK)); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$ list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$
@ -309,8 +309,8 @@ public class RdosFormatDisk extends FormattedDisk {
* Get the standard file column header information. * Get the standard file column header information.
* This default implementation is intended only for standard mode. * This default implementation is intended only for standard mode.
*/ */
public List getFileColumnHeaders(int displayMode) { public List<FileColumnHeader> getFileColumnHeaders(int displayMode) {
List list = new ArrayList(); List<FileColumnHeader> list = new ArrayList<>();
switch (displayMode) { switch (displayMode) {
case FILE_DISPLAY_NATIVE: case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(textBundle.get("Type"), 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$ list.add(new FileColumnHeader(textBundle.get("Type"), 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$

View File

@ -79,14 +79,14 @@ public class AppleCommander {
* command-line version. * command-line version.
*/ */
protected static void launchSwtAppleCommander(String[] args) { protected static void launchSwtAppleCommander(String[] args) {
Class swtAppleCommander; Class<?> swtAppleCommander;
try { try {
swtAppleCommander = Class.forName( swtAppleCommander = Class.forName(
"com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$ "com.webcodepro.applecommander.ui.swt.SwtAppleCommander"); //$NON-NLS-1$
Object object = swtAppleCommander.newInstance(); Object object = swtAppleCommander.newInstance();
Method launchMethod = swtAppleCommander. Method launchMethod = swtAppleCommander.
getMethod("launch", (Class[])null); //$NON-NLS-1$ getMethod("launch", (Class[]) null); //$NON-NLS-1$
launchMethod.invoke(object, (Object[])null); launchMethod.invoke(object, (Object[]) null);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (SecurityException e) { } catch (SecurityException e) {
@ -133,14 +133,14 @@ public class AppleCommander {
* command-line version. * command-line version.
*/ */
protected static void launchSwingAppleCommander(String[] args) { protected static void launchSwingAppleCommander(String[] args) {
Class swtAppleCommander; Class<?> swtAppleCommander;
try { try {
swtAppleCommander = Class.forName( swtAppleCommander = Class.forName(
"com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$ "com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$
Object object = swtAppleCommander.newInstance(); Object object = swtAppleCommander.newInstance();
Method launchMethod = swtAppleCommander. Method launchMethod = swtAppleCommander.
getMethod("launch", (Class[])null); //$NON-NLS-1$ getMethod("launch", (Class[]) null); //$NON-NLS-1$
launchMethod.invoke(object, (Object[])null); launchMethod.invoke(object, (Object[]) null);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (SecurityException e) { } catch (SecurityException e) {

View File

@ -158,8 +158,8 @@ public class DiskExplorerTab {
private int currentFormat = FormattedDisk.FILE_DISPLAY_STANDARD; private int currentFormat = FormattedDisk.FILE_DISPLAY_STANDARD;
private boolean formatChanged; private boolean formatChanged;
private List currentFileList; private List<FileEntry> currentFileList;
private Map columnWidths = new HashMap(); private Map<Integer,int[]> columnWidths = new HashMap<>();
private boolean showDeletedFiles; private boolean showDeletedFiles;
/** /**
@ -846,7 +846,7 @@ public class DiskExplorerTab {
/** /**
* Display files in the fileTable. * Display files in the fileTable.
*/ */
protected void fillFileTable(List fileList) { protected void fillFileTable(List<FileEntry> fileList) {
int[] weights = sashForm.getWeights(); int[] weights = sashForm.getWeights();
if (formatChanged) { if (formatChanged) {
@ -1407,7 +1407,7 @@ public class DiskExplorerTab {
TreeItem selection = directoryTree.getSelection()[0]; TreeItem selection = directoryTree.getSelection()[0];
Object data = selection.getData(); Object data = selection.getData();
DirectoryEntry directory = (DirectoryEntry) data; DirectoryEntry directory = (DirectoryEntry) data;
List fileList = directory.getFiles(); List<FileEntry> fileList = directory.getFiles();
formatChanged = (currentFormat != newFormat); formatChanged = (currentFormat != newFormat);
if (formatChanged || !fileList.equals(currentFileList)) { if (formatChanged || !fileList.equals(currentFileList)) {
@ -2017,7 +2017,7 @@ public class DiskExplorerTab {
return viewFileItem; return viewFileItem;
} }
protected List getCurrentFileList() { protected List<FileEntry> getCurrentFileList() {
return currentFileList; return currentFileList;
} }

View File

@ -99,7 +99,7 @@ public class FileViewerWindow {
private Color green; private Color green;
private ContentTypeAdapter contentTypeAdapter; private ContentTypeAdapter contentTypeAdapter;
private Map nativeFilterAdapterMap; private Map<Class<?>,FilterAdapter> nativeFilterAdapterMap;
private FilterAdapter nativeFilterAdapter; private FilterAdapter nativeFilterAdapter;
private FilterAdapter hexFilterAdapter; private FilterAdapter hexFilterAdapter;
private FilterAdapter rawDumpFilterAdapter; private FilterAdapter rawDumpFilterAdapter;
@ -165,7 +165,7 @@ public class FileViewerWindow {
* Setup all possible specialized FilterAdapters. * Setup all possible specialized FilterAdapters.
*/ */
protected void createFilterAdapterMap() { protected void createFilterAdapterMap() {
nativeFilterAdapterMap = new HashMap(); nativeFilterAdapterMap = new HashMap<>();
nativeFilterAdapterMap.put(ApplesoftFileFilter.class, nativeFilterAdapterMap.put(ApplesoftFileFilter.class,
new ApplesoftFilterAdapter(this, textBundle.get("FileViewerWindow.ApplesoftButton"), //$NON-NLS-1$ new ApplesoftFilterAdapter(this, textBundle.get("FileViewerWindow.ApplesoftButton"), //$NON-NLS-1$

View File

@ -75,7 +75,7 @@ public class ImageManager {
public static final String LOGO_COMPILE_WIZARD = "CompileWizardLogo.gif"; //$NON-NLS-1$ public static final String LOGO_COMPILE_WIZARD = "CompileWizardLogo.gif"; //$NON-NLS-1$
public static final String LOGO_COMPARE_IMAGE_WIZARD = "CompareImageWizardLogo.gif"; //$NON-NLS-1$ public static final String LOGO_COMPARE_IMAGE_WIZARD = "CompareImageWizardLogo.gif"; //$NON-NLS-1$
private Map images = new HashMap(); private Map<String,Image> images = new HashMap<>();
private String[] imageNames = { private String[] imageNames = {
// Icons: // Icons:
ICON_DISK, ICON_STANDARD_FILE_VIEW, ICON_DISK, ICON_STANDARD_FILE_VIEW,

View File

@ -48,7 +48,7 @@ public abstract class Wizard {
private Shell dialog; private Shell dialog;
private Image logo; private Image logo;
private String title; private String title;
private Stack wizardPanes = new Stack(); private Stack<WizardPane> wizardPanes = new Stack<>();
private boolean wizardCompleted; private boolean wizardCompleted;
private Button backButton; private Button backButton;
private Button nextButton; private Button nextButton;
@ -109,8 +109,8 @@ public abstract class Wizard {
backButton.setText(textBundle.get("BackButton")); //$NON-NLS-1$ backButton.setText(textBundle.get("BackButton")); //$NON-NLS-1$
backButton.addSelectionListener(new SelectionAdapter() { backButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
WizardPane current = (WizardPane) getWizardPanes().pop(); WizardPane current = getWizardPanes().pop();
WizardPane previous = (WizardPane) getWizardPanes().peek(); WizardPane previous = getWizardPanes().peek();
getBackButton().setEnabled(getWizardPanes().size() > 1); getBackButton().setEnabled(getWizardPanes().size() > 1);
current.dispose(); current.dispose();
previous.open(); previous.open();
@ -220,7 +220,7 @@ public abstract class Wizard {
/** /**
* @return Returns the wizardPanes. * @return Returns the wizardPanes.
*/ */
protected Stack getWizardPanes() { protected Stack<WizardPane> getWizardPanes() {
return wizardPanes; return wizardPanes;
} }
/** /**

View File

@ -39,7 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
*/ */
public class ImportWizard extends Wizard { public class ImportWizard extends Wizard {
private FormattedDisk disk; private FormattedDisk disk;
private List importSpecifications; private List<ImportSpecification> importSpecifications;
/** /**
* Constructor for ImportWizard. * Constructor for ImportWizard.
*/ */
@ -70,9 +70,9 @@ public class ImportWizard extends Wizard {
/** /**
* Get the list of ImportSpecifications. * Get the list of ImportSpecifications.
*/ */
public List getImportSpecifications() { public List<ImportSpecification> getImportSpecifications() {
if (importSpecifications == null) { if (importSpecifications == null) {
importSpecifications = new ArrayList(); importSpecifications = new ArrayList<>();
} }
return importSpecifications; return importSpecifications;
} }