From 5cb5afea64e4b061b0e652888632138e3b386715 Mon Sep 17 00:00:00 2001 From: Andrey Bruykhov Date: Tue, 28 Feb 2023 13:25:55 +0300 Subject: [PATCH] Installed some internal generics to fix some compiler warnings --- .../weblogic9/deploy/WLTargetModuleID.java | 2 +- .../web/core/syntax/ErrorAnnotationImpl.java | 2 +- .../JSPVariablesFilter.java | 4 +-- .../lib/ddl/impl/ProcedureArgument.java | 4 +-- .../editor/fold/CustomFoldManager.java | 8 +++--- .../editor/ext/KeywordMatchGenerator.java | 6 ++--- .../org/netbeans/editor/example/Editor.java | 18 ++++++------- .../modules/lexer/gen/TokenTypes.java | 25 +++++++++---------- .../AbstractCodeGeneratorClass.java | 12 ++++----- .../xml/text/completion/IconStore.java | 6 ++--- .../debugger/jpda/ui/models/MonitorModel.java | 2 +- .../project/ui/PlatformsComboBoxModel.java | 2 +- .../view/ContextTreeViewModelTest.java | 2 +- .../profiler/common/ProfilingSettings.java | 16 ++++++------ .../profiler/classfile/ClassFileCache.java | 24 +++++++++--------- 15 files changed, 66 insertions(+), 67 deletions(-) diff --git a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLTargetModuleID.java b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLTargetModuleID.java index d305a581367f..68ca0a0942b8 100644 --- a/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLTargetModuleID.java +++ b/contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/deploy/WLTargetModuleID.java @@ -45,7 +45,7 @@ public class WLTargetModuleID implements WebTargetModuleID { private String contextUrl; - private List children = new ArrayList(); + private List children = new ArrayList<>(); private TargetModuleID parent; diff --git a/enterprise/web.core.syntax/src/org/netbeans/modules/web/core/syntax/ErrorAnnotationImpl.java b/enterprise/web.core.syntax/src/org/netbeans/modules/web/core/syntax/ErrorAnnotationImpl.java index d3a511ab4c86..f11c5bfa2e10 100644 --- a/enterprise/web.core.syntax/src/org/netbeans/modules/web/core/syntax/ErrorAnnotationImpl.java +++ b/enterprise/web.core.syntax/src/org/netbeans/modules/web/core/syntax/ErrorAnnotationImpl.java @@ -61,7 +61,7 @@ public class ErrorAnnotationImpl implements ErrorAnnotation { /** Jsp file, for which is the ErrorAnnotation */ private FileObject jspFo; - private List annotations; + private List annotations; /** Creates a new instance of ErrorAnnotation */ public ErrorAnnotationImpl(FileObject jspFo) { diff --git a/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java b/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java index 293fb5c0e327..612e909131e2 100644 --- a/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java +++ b/enterprise/web.debug/src/org/netbeans/modules/web/debug/variablesfilterring/JSPVariablesFilter.java @@ -320,12 +320,12 @@ private static boolean isLeafType (String type) { public static class ImplicitLocals { private List locals = new ArrayList (); - private static HashSet localsNames = null; + private static HashSet localsNames = null; public static boolean isImplicitLocal(String aLocalName) { if (localsNames == null) { - localsNames = new HashSet(); + localsNames = new HashSet<>(); localsNames.add("application"); localsNames.add("config"); localsNames.add("out"); diff --git a/ide/db/libsrc/org/netbeans/lib/ddl/impl/ProcedureArgument.java b/ide/db/libsrc/org/netbeans/lib/ddl/impl/ProcedureArgument.java index 83db1ace523f..4fdbfeeaedd1 100644 --- a/ide/db/libsrc/org/netbeans/lib/ddl/impl/ProcedureArgument.java +++ b/ide/db/libsrc/org/netbeans/lib/ddl/impl/ProcedureArgument.java @@ -45,7 +45,7 @@ public class ProcedureArgument implements Argument { private String format; /** Additional properties */ - private Map addprops; + private Map addprops; public static String getArgumentTypeName(int type) { @@ -92,7 +92,7 @@ public Object getProperty(String pname) /** Sets general property */ public void setProperty(String pname, Object pval) { - if (addprops == null) addprops = new HashMap(); + if (addprops == null) addprops = new HashMap<>(); addprops.put(pname, pval); } diff --git a/ide/editor.fold/src/org/netbeans/modules/editor/fold/CustomFoldManager.java b/ide/editor.fold/src/org/netbeans/modules/editor/fold/CustomFoldManager.java index 88a7badd6ffb..101cac79705e 100644 --- a/ide/editor.fold/src/org/netbeans/modules/editor/fold/CustomFoldManager.java +++ b/ide/editor.fold/src/org/netbeans/modules/editor/fold/CustomFoldManager.java @@ -60,7 +60,7 @@ public final class CustomFoldManager implements FoldManager, Runnable { private int minUpdateMarkOffset = Integer.MAX_VALUE; private int maxUpdateMarkOffset = -1; private List removedFoldList; - private HashMap customFoldId = new HashMap(); + private HashMap customFoldId = new HashMap<>(); private static final RequestProcessor RP = new RequestProcessor(CustomFoldManager.class.getName(), 1, false, false); @@ -188,7 +188,7 @@ private void processRemovedFolds(FoldHierarchyTransaction transaction) { Fold removedFold = (Fold)removedFoldList.get(i); FoldMarkInfo startMark = (FoldMarkInfo)getOperation().getExtraInfo(removedFold); if (startMark.getId() != null) - customFoldId.put(startMark.getId(), Boolean.valueOf(removedFold.isCollapsed())); // remember the last fold's state before remove + customFoldId.put(startMark.getId(), removedFold.isCollapsed()); // remember the last fold's state before remove FoldMarkInfo endMark = startMark.getPairMark(); // get prior releasing if (getOperation().isStartDamaged(removedFold)) { // start mark area was damaged startMark.release(true, transaction); // forced remove @@ -481,9 +481,9 @@ private FoldMarkInfo scanToken(Token token) throws BadLocationException { if (matcher.group(2) != null) { // fold's id exists Boolean collapsed = (Boolean)customFoldId.get(matcher.group(2)); if (collapsed != null) - state = collapsed.booleanValue(); // fold's state is already known from the past + state = collapsed; // fold's state is already known from the past else - customFoldId.put(matcher.group(2), Boolean.valueOf(state)); + customFoldId.put(matcher.group(2), state); } return new FoldMarkInfo(true, token.offset(null), matcher.end(0), matcher.group(2), state, matcher.group(4)); // NOI18N } else { // fold's end mark found diff --git a/ide/editor.lib/src/org/netbeans/editor/ext/KeywordMatchGenerator.java b/ide/editor.lib/src/org/netbeans/editor/ext/KeywordMatchGenerator.java index 339d42bb232f..fc9a9691e5e2 100644 --- a/ide/editor.lib/src/org/netbeans/editor/ext/KeywordMatchGenerator.java +++ b/ide/editor.lib/src/org/netbeans/editor/ext/KeywordMatchGenerator.java @@ -67,9 +67,9 @@ public class KeywordMatchGenerator { private int maxKwdLen; /** Options */ - private HashMap options = new HashMap(); + private HashMap options = new HashMap<>(); - private HashMap kwdConstants = new HashMap(); + private HashMap kwdConstants = new HashMap<>(); /** Provide indentation (default 2 spaces) */ private String indent(int cnt) { @@ -124,7 +124,7 @@ protected String getKwdConstantPrefix() { } protected String getKwdConstant(String kwd) { - return (String)kwdConstants.get(kwd); + return kwdConstants.get(kwd); } protected boolean upperCaseKeyConstants() { diff --git a/ide/editor/demosrc/base/org/netbeans/editor/example/Editor.java b/ide/editor/demosrc/base/org/netbeans/editor/example/Editor.java index 0a81e745443c..c1acb0b7ae3e 100644 --- a/ide/editor/demosrc/base/org/netbeans/editor/example/Editor.java +++ b/ide/editor/demosrc/base/org/netbeans/editor/example/Editor.java @@ -75,7 +75,7 @@ public class Editor extends javax.swing.JFrame { private boolean safeSave; private int fileCounter = -1; - Map com2text = new HashMap(); + private Map com2text = new HashMap<>(); private Impl impl = new Impl("org.netbeans.editor.Bundle"); // NOI18N @@ -258,7 +258,7 @@ private void initComponents() {//GEN-BEGIN:initComponents private boolean saveFile( Component comp, File file, boolean checkOverwrite ) { if( comp == null ) return false; tabPane.setSelectedComponent( comp ); - JTextComponent edit = (JTextComponent)com2text.get( comp ); + JTextComponent edit = com2text.get( comp ); Document doc = edit.getDocument(); if( checkOverwrite && file.exists() ) { @@ -326,7 +326,7 @@ private boolean saveFile( Component comp, File file, boolean checkOverwrite ) { private boolean saveFile( Component comp ) { if( comp == null ) return false; - JTextComponent edit = (JTextComponent)com2text.get( comp ); + JTextComponent edit = com2text.get( comp ); Document doc = edit.getDocument(); File file = (File)doc.getProperty( FILE ); boolean created = ((Boolean)doc.getProperty( CREATED )).booleanValue(); @@ -336,7 +336,7 @@ private boolean saveFile( Component comp ) { private boolean saveAs( Component comp ) { if( comp == null ) return false; - JTextComponent edit = (JTextComponent)com2text.get( comp ); + JTextComponent edit = com2text.get( comp ); File file = (File)edit.getDocument().getProperty( FILE ); fileChooser.setCurrentDirectory( file.getParentFile() ); @@ -399,7 +399,7 @@ private void doExit() { } private void doCloseEditor(Component editor) { - JTextComponent editorPane = (JTextComponent ) com2text.get(editor); + JTextComponent editorPane = com2text.get(editor); if (editorPane != null) { File file = (File) editorPane.getDocument().getProperty(FILE); @@ -412,7 +412,7 @@ private void doCloseEditor(Component editor) { private boolean checkClose( Component comp ) { if( comp == null ) return false; - JTextComponent edit = (JTextComponent)com2text.get( comp ); + JTextComponent edit = com2text.get( comp ); Document doc = edit.getDocument(); Object mod = doc.getProperty( MODIFIED ); @@ -523,14 +523,14 @@ public static void main (String args[]) { private int separatorIndex; private String[] getOpenedFiles() { - ArrayList opened = new ArrayList(); + List opened = new ArrayList<>(); int components = tabPane.getComponentCount(); for (int cntr = 0; cntr < components; cntr++) { Component editorComponent = tabPane.getComponentAt( cntr ); - JTextComponent editor = (JTextComponent) com2text.get(editorComponent); + JTextComponent editor = com2text.get(editorComponent); if (editor == null) { continue; @@ -544,7 +544,7 @@ private String[] getOpenedFiles() { } } - return (String []) opened.toArray(new String[opened.size()]); + return opened.toArray(new String[opened.size()]); } private int findInRecent(String fileToFind) { diff --git a/ide/lexer/gen/src/org/netbeans/modules/lexer/gen/TokenTypes.java b/ide/lexer/gen/src/org/netbeans/modules/lexer/gen/TokenTypes.java index 0f7ebeb6f8f7..0eb991415738 100644 --- a/ide/lexer/gen/src/org/netbeans/modules/lexer/gen/TokenTypes.java +++ b/ide/lexer/gen/src/org/netbeans/modules/lexer/gen/TokenTypes.java @@ -55,10 +55,10 @@ public class TokenTypes { private boolean inspected; /** Map of [tokenTypeName, tokenTypeValue] */ - protected final Map name2value = new HashMap(); + protected final Map name2value = new HashMap<>(); /** Map of [tokenTypeValue, tokenTypeName] */ - protected final Map value2name = new HashMap(); + protected final Map value2name = new HashMap<>(); public TokenTypes(Class tokenTypesClass) { this.tokenTypesClass = tokenTypesClass; @@ -74,8 +74,8 @@ public TokenTypes(Class tokenTypesClass) { protected void updateData(LanguageData languageData) { inspect(); - for (Iterator it = tokenTypeNamesIterator(); it.hasNext();) { - String tokenTypeName = (String)it.next(); + for (Iterator it = tokenTypeNamesIterator(); it.hasNext();) { + String tokenTypeName = it.next(); MutableTokenId id = languageData.findIdByTokenTypeName(tokenTypeName); if (id == null) { @@ -120,19 +120,19 @@ public Class getTokenTypesClass() { public Integer getTokenTypeValue(String tokenTypeName) { inspect(); - return (Integer)name2value.get(tokenTypeName); + return name2value.get(tokenTypeName); } public String getTokenTypeName(int tokenTypeValue) { inspect(); - return (String)value2name.get(Integer.valueOf(tokenTypeValue)); + return value2name.get(Integer.valueOf(tokenTypeValue)); } /** * @return all the field names */ - public Iterator tokenTypeNamesIterator() { + public Iterator tokenTypeNamesIterator() { inspect(); return name2value.keySet().iterator(); @@ -143,9 +143,9 @@ public int findMaxTokenTypeValue() { inspect(); int maxValue = 0; - for (Iterator it = value2name.keySet().iterator(); it.hasNext();) { - Integer i = (Integer)it.next(); - maxValue = Math.max(maxValue, i.intValue()); + for (Iterator it = value2name.keySet().iterator(); it.hasNext();) { + Integer i = it.next(); + maxValue = Math.max(maxValue, i); } return maxValue; } @@ -177,9 +177,8 @@ protected boolean inspect() { int value = f.getInt(null); String fieldName = f.getName(); if (isAccepted(fieldName, value)) { - Integer valueInteger = Integer.valueOf(value); - name2value.put(fieldName, valueInteger); - value2name.put(valueInteger, fieldName); + name2value.put(fieldName, value); + value2name.put(value, fieldName); } } } diff --git a/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/AbstractCodeGeneratorClass.java b/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/AbstractCodeGeneratorClass.java index 5720d7754607..19eff6cc7b51 100644 --- a/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/AbstractCodeGeneratorClass.java +++ b/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/AbstractCodeGeneratorClass.java @@ -501,12 +501,12 @@ protected void genInvalidName(String var) throws IOException { JavaWriter jw; - private Map mutableTypes = new HashMap(); - private Map needToCallClone = new HashMap(); + private Map mutableTypes = new HashMap<>(); + private Map needToCallClone = new HashMap<>(); protected boolean isMutableType(Property prop) { String type = prop.getType(); - Boolean mutable = (Boolean) mutableTypes.get(type); + Boolean mutable = mutableTypes.get(type); if (mutable == null) { if (prop.isBean) mutable = Boolean.TRUE; @@ -516,12 +516,12 @@ else if (prop.isScalar() || JavaUtil.isImmutable(type)) mutable = Boolean.TRUE; mutableTypes.put(type, mutable); } - return mutable.booleanValue(); + return mutable; } protected boolean isCloneCallNeededOnType(Property prop) { String type = prop.getType(); - Boolean callClone = (Boolean) needToCallClone.get(type); + Boolean callClone = needToCallClone.get(type); if (callClone == null) { if (prop.isBean || !isMutableType(prop)) callClone = Boolean.FALSE; @@ -529,7 +529,7 @@ protected boolean isCloneCallNeededOnType(Property prop) { callClone = JavaUtil.isCloneable(type) ? Boolean.TRUE : Boolean.FALSE; needToCallClone.put(type, callClone); } - return callClone.booleanValue(); + return callClone; } protected boolean genCopyWillCopy(Property a) { diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/completion/IconStore.java b/ide/xml.text/src/org/netbeans/modules/xml/text/completion/IconStore.java index d46850e74b2b..95b933c3781f 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/completion/IconStore.java +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/completion/IconStore.java @@ -51,7 +51,7 @@ final class IconStore extends Object { /** HashMap{@link java.util.HashMap } that acts as a store for the icons. */ - private static HashMap iconsMap = new HashMap(); + private static HashMap iconsMap = new HashMap<>(); /** Main method to retrieve the ImageIcon{@link javax.swing.ImageIcon} * @param name Name of the icon to retrieve. In most instances would be one of the variables of @@ -64,10 +64,10 @@ public static ImageIcon getImageIcon(String name){ name = SPACER_16; if(iconsMap.containsKey(name)) - return (ImageIcon)iconsMap.get(name); + return iconsMap.get(name); else{ iconsMap.put(name, new ImageIcon(IconStore.class.getResource(name + ICON_SUFFIX))); - return (ImageIcon)iconsMap.get(name); + return iconsMap.get(name); } } } diff --git a/java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/MonitorModel.java b/java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/MonitorModel.java index bc221df36f66..6e01c7996660 100644 --- a/java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/MonitorModel.java +++ b/java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/MonitorModel.java @@ -207,7 +207,7 @@ public String getDisplayName (NodeModel model, Object o) throws return model.getDisplayName (o); } - private Map shortDescriptionMap = new HashMap(); + private Map shortDescriptionMap = new HashMap<>(); public String getShortDescription (final NodeModel model, final Object o) throws UnknownTypeException { diff --git a/javafx/javafx2.project/src/org/netbeans/modules/javafx2/project/ui/PlatformsComboBoxModel.java b/javafx/javafx2.project/src/org/netbeans/modules/javafx2/project/ui/PlatformsComboBoxModel.java index 4c35f1246fd1..3a0ddc884fce 100644 --- a/javafx/javafx2.project/src/org/netbeans/modules/javafx2/project/ui/PlatformsComboBoxModel.java +++ b/javafx/javafx2.project/src/org/netbeans/modules/javafx2/project/ui/PlatformsComboBoxModel.java @@ -68,7 +68,7 @@ public void removeListDataListener(ListDataListener l) { delegate.removeListDataListener(l); } - private List getData() { + private List getData() { List data = new ArrayList(); int origSize = delegate.getSize(); for (int i = 0; i < origSize; i++) { diff --git a/platform/openide.explorer/test/unit/src/org/openide/explorer/view/ContextTreeViewModelTest.java b/platform/openide.explorer/test/unit/src/org/openide/explorer/view/ContextTreeViewModelTest.java index e30d59adf94e..ce1e0aba74c2 100644 --- a/platform/openide.explorer/test/unit/src/org/openide/explorer/view/ContextTreeViewModelTest.java +++ b/platform/openide.explorer/test/unit/src/org/openide/explorer/view/ContextTreeViewModelTest.java @@ -302,7 +302,7 @@ private class Listener implements TreeModelListener { private TreeNode keep; - private List all = new ArrayList(); + private List all = new ArrayList<>(); public Listener(TreeNode keep) { this.keep = keep; diff --git a/profiler/lib.profiler.common/src/org/netbeans/lib/profiler/common/ProfilingSettings.java b/profiler/lib.profiler.common/src/org/netbeans/lib/profiler/common/ProfilingSettings.java index 1b095931d5c9..8ae32aa383b2 100644 --- a/profiler/lib.profiler.common/src/org/netbeans/lib/profiler/common/ProfilingSettings.java +++ b/profiler/lib.profiler.common/src/org/netbeans/lib/profiler/common/ProfilingSettings.java @@ -104,10 +104,10 @@ public class ProfilingSettings { // CPU Profiling: Code Fragment private ClientUtils.SourceCodeSelection fragmentSelection = null; - private List instrumentationMarkerMethods = new ArrayList(); + private List instrumentationMarkerMethods = new ArrayList<>(); // CPU Profiling: Part of Application - private List instrumentationRootMethods = new ArrayList(); + private List instrumentationRootMethods = new ArrayList<>(); // CPU instrumentation filter related settings private GenericFilter instrumentationFilter = new GenericFilter(); @@ -334,17 +334,17 @@ public void setInstrumentationMarkerMethods(final ClientUtils.SourceCodeSelectio } public ClientUtils.SourceCodeSelection[] getInstrumentationMarkerMethods() { - return (ClientUtils.SourceCodeSelection[]) instrumentationMarkerMethods.toArray(new ClientUtils.SourceCodeSelection[0]); + return instrumentationMarkerMethods.toArray(new ClientUtils.SourceCodeSelection[0]); } public ClientUtils.SourceCodeSelection[] getInstrumentationMethods() { - Set methods = new HashSet(); + Set methods = new HashSet<>(); // Keep the order: // 1. Root methods; 2. Marker methods methods.addAll(instrumentationRootMethods); methods.addAll(instrumentationMarkerMethods); - return (ClientUtils.SourceCodeSelection[]) methods.toArray(new ClientUtils.SourceCodeSelection[0]); + return methods.toArray(new ClientUtils.SourceCodeSelection[0]); } public void setInstrumentationRootMethods(final ClientUtils.SourceCodeSelection[] roots) { @@ -360,7 +360,7 @@ public void setInstrumentationRootMethods(final ClientUtils.SourceCodeSelection[ } public ClientUtils.SourceCodeSelection[] getInstrumentationRootMethods() { - return (ClientUtils.SourceCodeSelection[]) instrumentationRootMethods.toArray(new ClientUtils.SourceCodeSelection[0]); + return instrumentationRootMethods.toArray(new ClientUtils.SourceCodeSelection[0]); } public void setSamplingFrequency(int samplingFrequency) { @@ -898,14 +898,14 @@ public void store(final Map props, final String prefix) { for (int i = 0; i < instrumentationRootMethods.size(); i++) { props.put(prefix + PROP_INSTRUMENTATION_ROOT_METHODS_PREFIX + i, - ClientUtils.selectionToString((ClientUtils.SourceCodeSelection) instrumentationRootMethods.get(i))); + ClientUtils.selectionToString(instrumentationRootMethods.get(i))); } props.put(prefix + PROP_INSTRUMENTATION_MARKER_METHODS_SIZE, Integer.toString(instrumentationMarkerMethods.size())); for (int i = 0; i < instrumentationMarkerMethods.size(); i++) { props.put(prefix + PROP_INSTRUMENTATION_MARKER_METHODS_PREFIX + i, - ClientUtils.selectionToString((ClientUtils.SourceCodeSelection) instrumentationMarkerMethods.get(i))); + ClientUtils.selectionToString(instrumentationMarkerMethods.get(i))); } // CPU Profiling: Code Fragment diff --git a/profiler/lib.profiler/src/org/netbeans/lib/profiler/classfile/ClassFileCache.java b/profiler/lib.profiler/src/org/netbeans/lib/profiler/classfile/ClassFileCache.java index 36d06d382f8f..ec1058678ce0 100644 --- a/profiler/lib.profiler/src/org/netbeans/lib/profiler/classfile/ClassFileCache.java +++ b/profiler/lib.profiler/src/org/netbeans/lib/profiler/classfile/ClassFileCache.java @@ -50,7 +50,7 @@ public class ClassFileCache { //~ Instance fields ---------------------------------------------------------------------------------------------------------- private ClassPath classPath; // Used to quickly obtain an open JAR file for a given name - private Hashtable vmSuppliedClassCache; + private Hashtable vmSuppliedClassCache; private byte[][] classFileBytes; private String[] classNameAndLocation; private long[] lastTimeUsed; @@ -58,8 +58,8 @@ public class ClassFileCache { private int size; private int sizeLimit; private long timeCounter; - private List preloadNames; - private List preloadLoaderIds; + private List preloadNames; + private List preloadLoaderIds; //~ Constructors ------------------------------------------------------------------------------------------------------------- @@ -72,9 +72,9 @@ public class ClassFileCache { classFileBytes = new byte[capacity][]; lastTimeUsed = new long[capacity]; - vmSuppliedClassCache = new Hashtable(); - preloadNames = new ArrayList(); - preloadLoaderIds = new ArrayList(); + vmSuppliedClassCache = new Hashtable<>(); + preloadNames = new ArrayList<>(); + preloadLoaderIds = new ArrayList<>(); } //~ Methods ------------------------------------------------------------------------------------------------------------------ @@ -96,7 +96,7 @@ byte[] getClassFile(String name, String location) throws IOException { byte[] res; if (location.startsWith(ClassRepository.LOCATION_VMSUPPLIED)) { - res = (byte[]) vmSuppliedClassCache.get(nameAndLocation); + res = vmSuppliedClassCache.get(nameAndLocation); if (res != null && res.length == 0) { try { // known class without bytecode; get it from TA @@ -104,10 +104,10 @@ byte[] getClassFile(String name, String location) throws IOException { if (!preloadNames.contains(name)) { preloadBytecode(name, location); } - String names[] = (String[]) preloadNames.toArray(new String[0]); + String names[] = preloadNames.toArray(new String[0]); int loadersId[] = new int[preloadLoaderIds.size()]; for (int i=0; i(); + preloadLoaderIds = new ArrayList<>(); + res = vmSuppliedClassCache.get(nameAndLocation); if (res.length == 0) { throw new IOException("Get class file for " + name + " not found in TA"); }