Skip to content

Commit

Permalink
Merge pull request apache#5576 from tbw777/g2
Browse files Browse the repository at this point in the history
Installed some internal generics to fix some compiler warnings
  • Loading branch information
BradWalker authored Nov 7, 2023
2 parents 27e53d9 + 5cb5afe commit 0c8313e
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class WLTargetModuleID implements WebTargetModuleID {

private String contextUrl;

private List children = new ArrayList();
private List<WLTargetModuleID> children = new ArrayList<>();

private TargetModuleID parent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class ErrorAnnotationImpl implements ErrorAnnotation {
/** Jsp file, for which is the ErrorAnnotation */
private FileObject jspFo;

private List annotations;
private List<LineSetAnnotation> annotations;

/** Creates a new instance of ErrorAnnotation */
public ErrorAnnotationImpl(FileObject jspFo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ProcedureArgument implements Argument {
private String format;

/** Additional properties */
private Map addprops;
private Map<String, Object> addprops;

public static String getArgumentTypeName(int type)
{
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Boolean> customFoldId = new HashMap<>();

private static final RequestProcessor RP = new RequestProcessor(CustomFoldManager.class.getName(),
1, false, false);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public class KeywordMatchGenerator {
private int maxKwdLen;

/** Options */
private HashMap options = new HashMap();
private HashMap<String, String> options = new HashMap<>();

private HashMap kwdConstants = new HashMap();
private HashMap<String, String> kwdConstants = new HashMap<>();

/** Provide indentation (default 2 spaces) */
private String indent(int cnt) {
Expand Down Expand Up @@ -124,7 +124,7 @@ protected String getKwdConstantPrefix() {
}

protected String getKwdConstant(String kwd) {
return (String)kwdConstants.get(kwd);
return kwdConstants.get(kwd);
}

protected boolean upperCaseKeyConstants() {
Expand Down
18 changes: 9 additions & 9 deletions ide/editor/demosrc/base/org/netbeans/editor/example/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class Editor extends javax.swing.JFrame {
private boolean safeSave;

private int fileCounter = -1;
Map com2text = new HashMap();
private Map<Component, JTextComponent> com2text = new HashMap<>();

private Impl impl = new Impl("org.netbeans.editor.Bundle"); // NOI18N

Expand Down Expand Up @@ -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() ) {
Expand Down Expand Up @@ -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();
Expand All @@ -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() );
Expand Down Expand Up @@ -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);

Expand All @@ -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 );
Expand Down Expand Up @@ -523,14 +523,14 @@ public static void main (String args[]) {
private int separatorIndex;

private String[] getOpenedFiles() {
ArrayList opened = new ArrayList();
List<String> 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;
Expand All @@ -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) {
Expand Down
25 changes: 12 additions & 13 deletions ide/lexer/gen/src/org/netbeans/modules/lexer/gen/TokenTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public class TokenTypes {
private boolean inspected;

/** Map of [tokenTypeName, tokenTypeValue] */
protected final Map name2value = new HashMap();
protected final Map<String, Integer> name2value = new HashMap<>();

/** Map of [tokenTypeValue, tokenTypeName] */
protected final Map value2name = new HashMap();
protected final Map<Integer, String> value2name = new HashMap<>();

public TokenTypes(Class tokenTypesClass) {
this.tokenTypesClass = tokenTypesClass;
Expand All @@ -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<String> it = tokenTypeNamesIterator(); it.hasNext();) {
String tokenTypeName = it.next();
MutableTokenId id = languageData.findIdByTokenTypeName(tokenTypeName);

if (id == null) {
Expand Down Expand Up @@ -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<String> tokenTypeNamesIterator() {
inspect();

return name2value.keySet().iterator();
Expand All @@ -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<Integer> it = value2name.keySet().iterator(); it.hasNext();) {
Integer i = it.next();
maxValue = Math.max(maxValue, i);
}
return maxValue;
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Boolean> mutableTypes = new HashMap<>();
private Map<String, Boolean> 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;
Expand All @@ -516,20 +516,20 @@ 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;
else
callClone = JavaUtil.isCloneable(type) ? Boolean.TRUE : Boolean.FALSE;
needToCallClone.put(type, callClone);
}
return callClone.booleanValue();
return callClone;
}

protected boolean genCopyWillCopy(Property a) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, ImageIcon> 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
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public String getDisplayName (NodeModel model, Object o) throws
return model.getDisplayName (o);
}

private Map shortDescriptionMap = new HashMap();
private Map<Object, Object> shortDescriptionMap = new HashMap<>();

public String getShortDescription (final NodeModel model, final Object o) throws
UnknownTypeException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void removeListDataListener(ListDataListener l) {
delegate.removeListDataListener(l);
}

private List getData() {
private List<Object> getData() {
List<Object> data = new ArrayList<Object>();
int origSize = delegate.getSize();
for (int i = 0; i < origSize; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private class Listener implements TreeModelListener {


private TreeNode keep;
private List all = new ArrayList();
private List<TreeNode> all = new ArrayList<>();

public Listener(TreeNode keep) {
this.keep = keep;
Expand Down
Loading

0 comments on commit 0c8313e

Please sign in to comment.