# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /doma/jarda/netbeans-src/openide/util # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: src/org/openide/util/Task.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Task.java Base (1.2) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Task.java Locally Modified (Based On 1.2) *************** *** 44,52 **** } /** map of subclasses to booleans whether they override waitFinished() or not - * */ ! private static java.util.WeakHashMap overrides; /** request processor for workarounding compatibility problem with * classes that do not override waitFinished (long) --- 44,51 ---- } /** map of subclasses to booleans whether they override waitFinished() or not */ ! private static java.util.WeakHashMap overrides; /** request processor for workarounding compatibility problem with * classes that do not override waitFinished (long) *************** *** 60,66 **** private boolean finished; /** listeners for the finish of task (TaskListener) */ ! private HashSet list; /** Create a new task. * The runnable should provide its own error-handling, as --- 59,65 ---- private boolean finished; /** listeners for the finish of task (TaskListener) */ ! private HashSet list; /** Create a new task. * The runnable should provide its own error-handling, as *************** *** 225,231 **** */ public synchronized void addTaskListener(TaskListener l) { if (list == null) { ! list = new HashSet(); } list.add(l); --- 224,230 ---- */ public synchronized void addTaskListener(TaskListener l) { if (list == null) { ! list = new HashSet(); } list.add(l); *************** *** 263,280 **** return true; } ! java.util.WeakHashMap m; Boolean does; synchronized (Task.class) { if (overrides == null) { ! overrides = new java.util.WeakHashMap(); RP = new RequestProcessor("Timeout waitFinished compatibility processor", 255); // NOI18N } m = overrides; ! does = (Boolean) m.get(getClass()); if (does != null) { return does.booleanValue(); --- 262,279 ---- return true; } ! java.util.WeakHashMap m; Boolean does; synchronized (Task.class) { if (overrides == null) { ! overrides = new java.util.WeakHashMap(); RP = new RequestProcessor("Timeout waitFinished compatibility processor", 255); // NOI18N } m = overrides; ! does = m.get(getClass()); if (does != null) { return does.booleanValue(); Index: src/org/openide/util/IconManager.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/IconManager.java Base (1.2) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/IconManager.java Locally Modified (Based On 1.2) *************** *** 35,47 **** private static final Object NO_ICON = new Object(); /** map of resource name to loaded icon (String, SoftRefrence (Image)) or (String, NO_ICON) */ ! private static final HashMap map = new HashMap(128); ! private static final HashMap localizedMap = new HashMap(128); /** Resource paths for which we have had to strip initial slash. * @see "#20072" */ ! private static final Set extraInitialSlashes = new HashSet(); // Set private static volatile Object currentLoader; private static Lookup.Result loaderQuery = null; private static boolean noLoaderWarned = false; --- 35,47 ---- private static final Object NO_ICON = new Object(); /** map of resource name to loaded icon (String, SoftRefrence (Image)) or (String, NO_ICON) */ ! private static final HashMap map = new HashMap(128); ! private static final HashMap localizedMap = new HashMap(128); /** Resource paths for which we have had to strip initial slash. * @see "#20072" */ ! private static final Set extraInitialSlashes = new HashSet(); // Set private static volatile Object currentLoader; private static Lookup.Result loaderQuery = null; private static boolean noLoaderWarned = false; *************** *** 428,433 **** --- 428,434 ---- private Map holder; private Object key; + @SuppressWarnings("unchecked") public ActiveRef(Object o, Map holder, Object key) { super(o, Utilities.activeReferenceQueue()); this.holder = holder; Index: nbproject/project.properties *** /doma/jarda/netbeans-src/openide/util/nbproject/project.properties Base (1.9) --- /doma/jarda/netbeans-src/openide/util/nbproject/project.properties Locally Modified (Based On 1.9) *************** *** 9,14 **** --- 9,16 ---- # Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun # Microsystems, Inc. All Rights Reserved. + javac.compilerargs=-Xlint:unchecked + javac.source=1.5 module.jar.dir=lib spec.version.base=6.9.0 Index: src/org/openide/util/actions/SystemAction.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/actions/SystemAction.java Base (1.4) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/actions/SystemAction.java Locally Modified (Based On 1.4) *************** *** 52,58 **** /** Name of property for the action's display icon, if textual. */ private static final String PROP_ICON_TEXTUAL = "iconTextual"; // NOI18N private static ImageIcon BLANK_ICON = null; ! private static final Set relativeIconResourceClasses = new HashSet(200); // Set // Matches NB 3.4 w/ openide-compat.jar; see #26491 private static final long serialVersionUID = -8361232596876856810L; --- 52,58 ---- /** Name of property for the action's display icon, if textual. */ private static final String PROP_ICON_TEXTUAL = "iconTextual"; // NOI18N private static ImageIcon BLANK_ICON = null; ! private static final Set relativeIconResourceClasses = new HashSet(200); // Matches NB 3.4 w/ openide-compat.jar; see #26491 private static final long serialVersionUID = -8361232596876856810L; *************** *** 332,338 **** * @return an array of both sets of actions in the same order */ public static SystemAction[] linkActions(SystemAction[] actions1, SystemAction[] actions2) { ! List l = new Vector(Arrays.asList(actions1)); l.addAll(Arrays.asList(actions2)); return (SystemAction[]) l.toArray(actions1); --- 332,338 ---- * @return an array of both sets of actions in the same order */ public static SystemAction[] linkActions(SystemAction[] actions1, SystemAction[] actions2) { ! List l = new Vector(Arrays.asList(actions1)); l.addAll(Arrays.asList(actions2)); return (SystemAction[]) l.toArray(actions1); Index: src/org/openide/util/actions/CallbackSystemAction.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/actions/CallbackSystemAction.java Base (1.6) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/actions/CallbackSystemAction.java Locally Modified (Based On 1.6) *************** *** 44,53 **** private static final String PROP_ACTION_PERFORMER = "actionPerformer"; // NOI18N /** a list of all actions that has survive focus change set to false */ ! private static final WeakSet notSurviving = new WeakSet(37); /** a list of CallableSystemAction actions surviving focus change */ ! private static final WeakSet surviving = new WeakSet(37); /** key to access listener */ private static final Object LISTENER = new Object(); --- 44,53 ---- private static final String PROP_ACTION_PERFORMER = "actionPerformer"; // NOI18N /** a list of all actions that has survive focus change set to false */ ! private static final WeakSet notSurviving = new WeakSet(37); /** a list of CallableSystemAction actions surviving focus change */ ! private static final WeakSet surviving = new WeakSet(37); /** key to access listener */ private static final Object LISTENER = new Object(); *************** *** 255,264 **** /** Array of actions from a set of classes. */ private static ArrayList toInstances(java.util.Set s) { ! ArrayList actions; synchronized (notSurviving) { ! actions = new ArrayList(s.size()); Iterator it = s.iterator(); --- 255,264 ---- /** Array of actions from a set of classes. */ private static ArrayList toInstances(java.util.Set s) { ! ArrayList actions; synchronized (notSurviving) { ! actions = new ArrayList(s.size()); Iterator it = s.iterator(); *************** *** 265,271 **** while (it.hasNext()) { Class c = (Class) it.next(); ! Object a = SystemAction.findObject(c, false); if (a != null) { actions.add(a); --- 265,271 ---- while (it.hasNext()) { Class c = (Class) it.next(); ! SystemAction a = (SystemAction)SystemAction.findObject(c, false); if (a != null) { actions.add(a); *************** *** 311,317 **** private static final class GlobalManager implements LookupListener { private static GlobalManager instance; private Lookup.Result result; ! private Reference actionMap = new WeakReference(null); private final ActionMap survive = new ActionMap(); private GlobalManager() { --- 311,317 ---- private static final class GlobalManager implements LookupListener { private static GlobalManager instance; private Lookup.Result result; ! private Reference actionMap = new WeakReference(null); private final ActionMap survive = new ActionMap(); private GlobalManager() { *************** *** 374,380 **** return; } ! actionMap = new WeakReference(a); if (errLog) { err.log("clearActionPerformers"); // NOI18N --- 374,380 ---- return; } ! actionMap = new WeakReference(a); if (errLog) { err.log("clearActionPerformers"); // NOI18N *************** *** 387,393 **** /** An action that holds a weak reference to other action. */ ! private static final class WeakAction extends WeakReference implements Action { public WeakAction(Action delegate) { super(delegate); } --- 387,393 ---- /** An action that holds a weak reference to other action. */ ! private static final class WeakAction extends WeakReference implements Action { public WeakAction(Action delegate) { super(delegate); } *************** *** 428,439 **** /** A class that listens on changes in enabled state of an action * and updates the state of the action according to it. */ ! private static final class ActionDelegateListener extends WeakReference implements PropertyChangeListener { private WeakReference delegate; ! public ActionDelegateListener(CallbackSystemAction c, javax.swing.Action delegate) { super(c); ! this.delegate = new WeakReference(delegate); delegate.addPropertyChangeListener(this); } --- 428,439 ---- /** A class that listens on changes in enabled state of an action * and updates the state of the action according to it. */ ! private static final class ActionDelegateListener extends WeakReference implements PropertyChangeListener { private WeakReference delegate; ! public ActionDelegateListener(CallbackSystemAction c, Action delegate) { super(c); ! this.delegate = new WeakReference(delegate); delegate.addPropertyChangeListener(this); } *************** *** 466,472 **** prev.removePropertyChangeListener(this); } ! this.delegate = new WeakReference(action); action.addPropertyChangeListener(this); } --- 466,472 ---- prev.removePropertyChangeListener(this); } ! this.delegate = new WeakReference(action); action.addPropertyChangeListener(this); } *************** *** 579,585 **** last.removePropertyChangeListener(weakL); } ! lastRef = new WeakReference(a); a.addPropertyChangeListener(weakL); } --- 579,585 ---- last.removePropertyChangeListener(weakL); } ! lastRef = new WeakReference(a); a.addPropertyChangeListener(weakL); } Index: src/org/openide/util/Enumerations.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Enumerations.java Base (1.1) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Enumerations.java Locally Modified (Based On 1.1) *************** *** 37,44 **** * from empty().nextElement(). * @return the enumeration */ ! public static final Enumeration empty() { ! return Collections.enumeration(Collections.EMPTY_LIST); } /** --- 37,45 ---- * from empty().nextElement(). * @return the enumeration */ ! public static final Enumeration empty() { ! Collection emptyL = Collections.emptyList(); ! return Collections.enumeration(emptyL); } /** *************** *** 91,97 **** */ public static Enumeration removeDuplicates(Enumeration en) { class RDupls implements Processor { ! private Set set = new HashSet(); public Object process(Object o, Collection nothing) { return set.add(o) ? o : null; --- 92,98 ---- */ public static Enumeration removeDuplicates(Enumeration en) { class RDupls implements Processor { ! private Set set = new HashSet(); public Object process(Object o, Collection nothing) { return set.add(o) ? o : null; Index: src/org/openide/util/actions/CallableSystemAction.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/actions/CallableSystemAction.java Base (1.4) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/actions/CallableSystemAction.java Locally Modified (Based On 1.4) *************** *** 42,48 **** * Set of action classes for which we have already issued a warning that * {@link #asynchronous} was not overridden to return false. */ ! private static final Set warnedAsynchronousActions = new WeakSet(); // Set private static final boolean DEFAULT_ASYNCH = !Boolean.getBoolean( "org.openide.util.actions.CallableSystemAction.synchronousByDefault" ); --- 42,48 ---- * Set of action classes for which we have already issued a warning that * {@link #asynchronous} was not overridden to return false. */ ! private static final Set warnedAsynchronousActions = new WeakSet(); private static final boolean DEFAULT_ASYNCH = !Boolean.getBoolean( "org.openide.util.actions.CallableSystemAction.synchronousByDefault" ); Index: src/org/openide/ErrorManager.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/ErrorManager.java Base (1.3) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/ErrorManager.java Locally Modified (Based On 1.3) *************** *** 502,510 **** /** * A set that has to be updated when the list of delegates * changes. All instances created by getInstance are held here. - * It is a set of DelagatingErrorManager. */ ! private WeakSet createdByMe = new WeakSet(); /** If we are the "central" delagate this is not null and * we listen on the result. On newly created delegates this --- 502,509 ---- /** * A set that has to be updated when the list of delegates * changes. All instances created by getInstance are held here. */ ! private WeakSet createdByMe = new WeakSet(); /** If we are the "central" delagate this is not null and * we listen on the result. On newly created delegates this *************** *** 674,681 **** * Updates the list of delegates. Also updates all instances created * by ourselves. */ public synchronized void setDelegates(Collection newDelegates) { ! java.util.LinkedHashSet d = new java.util.LinkedHashSet(newDelegates); delegates = d; for (Iterator i = createdByMe.iterator(); i.hasNext();) { --- 673,682 ---- * Updates the list of delegates. Also updates all instances created * by ourselves. */ + @SuppressWarnings("unchecked") public synchronized void setDelegates(Collection newDelegates) { ! java.util.LinkedHashSet d; ! d = new java.util.LinkedHashSet((Collection)newDelegates); delegates = d; for (Iterator i = createdByMe.iterator(); i.hasNext();) { *************** *** 695,701 **** * @param DelagatingErrorManager d the instance to which we will attach */ private void attachNewDelegates(DelegatingErrorManager dem, String name) { ! Set newDelegatesForDem = new HashSet(); for (Iterator j = delegates.iterator(); j.hasNext();) { ErrorManager e = (ErrorManager) j.next(); --- 696,702 ---- * @param DelagatingErrorManager d the instance to which we will attach */ private void attachNewDelegates(DelegatingErrorManager dem, String name) { ! Set newDelegatesForDem = new HashSet(); for (Iterator j = delegates.iterator(); j.hasNext();) { ErrorManager e = (ErrorManager) j.next(); Index: src/org/openide/util/Utilities.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Utilities.java Base (1.10) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Utilities.java Locally Modified (Based On 1.10) *************** *** 158,164 **** /** reference to map that maps allowed key names to their values (String, Integer) and reference to map for mapping of values to their names */ ! private static Reference namesAndValues; /** The operating system on which NetBeans runs*/ private static int operatingSystem = -1; --- 158,164 ---- /** reference to map that maps allowed key names to their values (String, Integer) and reference to map for mapping of values to their names */ ! private static Reference namesAndValues; /** The operating system on which NetBeans runs*/ private static int operatingSystem = -1; *************** *** 492,498 **** return workingSet; } ! java.util.ArrayList lines = new java.util.ArrayList(); int lineStart = 0; // the position of start of currently processed line in the original string --- 492,498 ---- return workingSet; } ! java.util.ArrayList lines = new java.util.ArrayList(); int lineStart = 0; // the position of start of currently processed line in the original string *************** *** 616,622 **** return original; } ! java.util.Vector lines = new java.util.Vector(); int lineStart = 0; // the position of start of currently processed line in the original string int lastSpacePos = -1; --- 616,622 ---- return original; } ! java.util.Vector lines = new java.util.Vector(); int lineStart = 0; // the position of start of currently processed line in the original string int lastSpacePos = -1; *************** *** 1323,1329 **** int INPARAMPENDING = 0x2; // INPARAM + \ int STICK = 0x4; // INPARAM + " or STICK + non_" // NOI18N int STICKPENDING = 0x8; // STICK + \ ! Vector params = new Vector(5, 5); char c; int state = NULL; --- 1323,1329 ---- int INPARAMPENDING = 0x2; // INPARAM + \ int STICK = 0x4; // INPARAM + " or STICK + non_" // NOI18N int STICKPENDING = 0x8; // STICK + \ ! Vector params = new Vector(5, 5); char c; int state = NULL; *************** *** 1532,1539 **** Field[] fields = KeyEvent.class.getDeclaredFields(); ! HashMap names = new HashMap(((fields.length * 4) / 3) + 5, 0.75f); ! HashMap values = new HashMap(((fields.length * 4) / 3) + 5, 0.75f); for (int i = 0; i < fields.length; i++) { if (Modifier.isStatic(fields[i].getModifiers())) { --- 1532,1539 ---- Field[] fields = KeyEvent.class.getDeclaredFields(); ! HashMap names = new HashMap(((fields.length * 4) / 3) + 5, 0.75f); ! HashMap values = new HashMap(((fields.length * 4) / 3) + 5, 0.75f); for (int i = 0; i < fields.length; i++) { if (Modifier.isStatic(fields[i].getModifiers())) { *************** *** 1569,1575 **** HashMap[] arr = { names, values }; ! namesAndValues = new SoftReference(arr); return arr; } --- 1569,1575 ---- HashMap[] arr = { names, values }; ! namesAndValues = new SoftReference(arr); return arr; } *************** *** 1741,1747 **** */ public static KeyStroke[] stringToKeys(String s) { StringTokenizer st = new StringTokenizer(s.toUpperCase(Locale.ENGLISH), " "); // NOI18N ! ArrayList arr = new ArrayList(); while (st.hasMoreElements()) { s = st.nextToken(); --- 1741,1747 ---- */ public static KeyStroke[] stringToKeys(String s) { StringTokenizer st = new StringTokenizer(s.toUpperCase(Locale.ENGLISH), " "); // NOI18N ! ArrayList arr = new ArrayList(); while (st.hasMoreElements()) { s = st.nextToken(); *************** *** 1755,1761 **** arr.add(k); } ! return (KeyStroke[]) arr.toArray(new KeyStroke[arr.size()]); } /** Adds characters for modifiers to the buffer. --- 1755,1761 ---- arr.add(k); } ! return arr.toArray(new KeyStroke[arr.size()]); } /** Adds characters for modifiers to the buffer. *************** *** 2079,2084 **** --- 2079,2085 ---- * @throws UnorderableException if the specified partial order is inconsistent on this list * @deprecated Deprecated in favor of the potentially much faster (and possibly more correct) {@link #topologicalSort}. */ + @SuppressWarnings("unchecked") // do not bother, it is deprecated anyway public static List partialSort(List l, Comparator c, boolean stable) throws UnorderableException { // map from objects in the list to null or sets of objects they are greater than *************** *** 2200,2210 **** * @since 3.30 * @see Issue #27286 */ public static List topologicalSort(Collection c, Map edges) throws TopologicalSortException { ! Map finished = new HashMap(); List r = new ArrayList(Math.max(c.size(), 1)); ! List cRev = new ArrayList(c); Collections.reverse(cRev); Iterator it = cRev.iterator(); --- 2201,2212 ---- * @since 3.30 * @see Issue #27286 */ + @SuppressWarnings("unchecked") // NEEDS API public static List topologicalSort(Collection c, Map edges) throws TopologicalSortException { ! Map finished = new HashMap(); List r = new ArrayList(Math.max(c.size(), 1)); ! List cRev = new ArrayList(c); Collections.reverse(cRev); Iterator it = cRev.iterator(); *************** *** 2232,2238 **** * @param r the order in progress * @return list with detected cycle */ ! static List visit(Object node, Map edges, Map finished, List r) { Boolean b = (Boolean) finished.get(node); //System.err.println("node=" + node + " color=" + b); --- 2234,2240 ---- * @param r the order in progress * @return list with detected cycle */ ! static List visit(Object node, Map edges, Map finished, List r) { Boolean b = (Boolean) finished.get(node); //System.err.println("node=" + node + " color=" + b); *************** *** 2241,2247 **** return null; } ! ArrayList cycle = new ArrayList(); cycle.add(node); finished.put(node, null); --- 2243,2249 ---- return null; } ! ArrayList cycle = new ArrayList(); cycle.add(node); finished.put(node, null); *************** *** 2256,2262 **** Iterator it = e.iterator(); while (it.hasNext()) { ! List cycle = visit(it.next(), edges, finished, r); if (cycle != null) { if (cycle instanceof ArrayList) { --- 2258,2264 ---- Iterator it = e.iterator(); while (it.hasNext()) { ! List cycle = visit(it.next(), edges, finished, r); if (cycle != null) { if (cycle instanceof ArrayList) { *************** *** 2430,2440 **** re = new RE13(); // } ! TreeSet list = new TreeSet( ! new Comparator() { ! public int compare(Object o1, Object o2) { ! String s1 = ((String[]) o1)[0]; ! String s2 = ((String[]) o2)[0]; int i1 = s1.length(); int i2 = s2.length(); --- 2432,2442 ---- re = new RE13(); // } ! TreeSet list = new TreeSet( ! new Comparator() { ! public int compare(String[] o1, String[] o2) { ! String s1 = o1[0]; ! String s2 = o2[0]; int i1 = s1.length(); int i2 = s2.length(); *************** *** 2500,2506 **** * @param resource URL identifiing transaction table * @param results will be filled with String[2] */ ! private static void loadTranslationFile(RE re, BufferedReader reader, Set results) throws IOException { for (;;) { String line = reader.readLine(); --- 2502,2508 ---- * @param resource URL identifiing transaction table * @param results will be filled with String[2] */ ! private static void loadTranslationFile(RE re, BufferedReader reader, Set results) throws IOException { for (;;) { String line = reader.readLine(); *************** *** 2575,2581 **** JPopupMenu menu = org.netbeans.modules.openide.util.AWTBridge.getDefault().createEmptyPopup(); // keeps actions for which was menu item created already ! HashSet counted = new HashSet(); boolean haveHadNonSep = false; boolean needSep = false; --- 2577,2583 ---- JPopupMenu menu = org.netbeans.modules.openide.util.AWTBridge.getDefault().createEmptyPopup(); // keeps actions for which was menu item created already ! HashSet counted = new HashSet(); boolean haveHadNonSep = false; boolean needSep = false; Index: src/org/openide/util/RequestProcessor.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/RequestProcessor.java Base (1.12) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/RequestProcessor.java Locally Modified (Based On 1.12) *************** *** 119,130 **** private Object processorLock = new Object(); /** The set holding all the Processors assigned to this RequestProcessor */ ! private HashSet processors = new HashSet(); /** Actualy the first item is pending to be processed. * Can be accessed/trusted only under the above processorLock lock. * If null, nothing is scheduled and the processor is not running. */ ! private List queue = new LinkedList(); /** Number of currently running processors. If there is a new request * and this number is lower that the throughput, new Processor is asked --- 119,130 ---- private Object processorLock = new Object(); /** The set holding all the Processors assigned to this RequestProcessor */ ! private HashSet processors = new HashSet(); /** Actualy the first item is pending to be processed. * Can be accessed/trusted only under the above processorLock lock. * If null, nothing is scheduled and the processor is not running. */ ! private List queue = new LinkedList(); /** Number of currently running processors. If there is a new request * and this number is lower that the throughput, new Processor is asked *************** *** 442,448 **** queue.add(item); item.enqueued = true; } else { ! for (ListIterator it = queue.listIterator(); it.hasNext();) { Item next = (Item) it.next(); if (iprio > next.getPriority()) { --- 442,448 ---- queue.add(item); item.enqueued = true; } else { ! for (ListIterator it = queue.listIterator(); it.hasNext();) { Item next = (Item) it.next(); if (iprio > next.getPriority()) { *************** *** 805,811 **** */ private static class Processor extends Thread { /** A stack containing all the inactive Processors */ ! private static Stack pool = new Stack(); /* One minute of inactivity and the Thread will die if not assigned */ private static final int INACTIVE_TIMEOUT = 60000; --- 805,811 ---- */ private static class Processor extends Thread { /** A stack containing all the inactive Processors */ ! private static Stack pool = new Stack(); /* One minute of inactivity and the Thread will die if not assigned */ private static final int INACTIVE_TIMEOUT = 60000; *************** *** 1033,1040 **** * end of the task. */ static ThreadGroup getTopLevelThreadGroup() { ! java.security.PrivilegedAction run = new java.security.PrivilegedAction() { ! public Object run() { ThreadGroup current = Thread.currentThread().getThreadGroup(); while (current.getParent() != null) { --- 1033,1040 ---- * end of the task. */ static ThreadGroup getTopLevelThreadGroup() { ! java.security.PrivilegedAction run = new java.security.PrivilegedAction() { ! public ThreadGroup run() { ThreadGroup current = Thread.currentThread().getThreadGroup(); while (current.getParent() != null) { *************** *** 1045,1051 **** } }; ! return (ThreadGroup) java.security.AccessController.doPrivileged(run); } } } --- 1045,1051 ---- } }; ! return java.security.AccessController.doPrivileged(run); } } } Index: src/org/openide/util/Queue.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Queue.java Base (1.1) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Queue.java Locally Modified (Based On 1.1) *************** *** 21,27 **** */ public class Queue extends Object { /** Queue enumeration */ ! private java.util.LinkedList queue = new java.util.LinkedList(); /** Adds new item. * @param o object to add --- 21,27 ---- */ public class Queue extends Object { /** Queue enumeration */ ! private java.util.LinkedList queue = new java.util.LinkedList(); /** Adds new item. * @param o object to add Index: src/org/openide/util/WeakSet.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/WeakSet.java Base (1.2) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/WeakSet.java Locally Modified (Based On 1.2) *************** *** 34,40 **** * * @author Ales Novak */ ! public class WeakSet extends AbstractSet implements Cloneable, Serializable { static final long serialVersionUID = 3062376055928236721L; /** load factor */ --- 34,40 ---- * * @author Ales Novak */ ! public class WeakSet extends AbstractSet implements Cloneable, Serializable { static final long serialVersionUID = 3062376055928236721L; /** load factor */ *************** *** 64,70 **** /** Constructs a new set containing the elements in the specified collection. * @param c a collection to add */ ! public WeakSet(Collection c) { this(); addAll(c); } --- 64,70 ---- /** Constructs a new set containing the elements in the specified collection. * @param c a collection to add */ ! public WeakSet(Collection c) { this(); addAll(c); } *************** *** 99,105 **** * * @param o an Object to add */ ! public boolean add(Object o) { if (o == null) { size++; nullCount++; --- 99,105 ---- * * @param o an Object to add */ ! public boolean add(E o) { if (o == null) { size++; nullCount++; *************** *** 119,125 **** int hash = hashIt(o); Entry next = entries[hash]; ! iterChain = entries[hash] = new Entry(o, refq, next, iterChain); rehash(); return true; --- 119,125 ---- int hash = hashIt(o); Entry next = entries[hash]; ! iterChain = entries[hash] = new Entry(this, o, refq, next, iterChain); rehash(); return true; *************** *** 188,194 **** } /** Returns an iterator over the elements in this set. */ ! public Iterator iterator() { return new WeakSetIterator(); } --- 188,194 ---- } /** Returns an iterator over the elements in this set. */ ! public Iterator iterator() { return new WeakSetIterator(); } *************** *** 229,237 **** return size; } ! public Object[] toArray(Object[] array) { ! ArrayList list = new ArrayList(array.length); ! Iterator it = iterator(); while (it.hasNext()) { list.add(it.next()); --- 229,237 ---- return size; } ! public T[] toArray(T[] array) { ! ArrayList list = new ArrayList(array.length); ! Iterator it = iterator(); while (it.hasNext()) { list.add(it.next()); *************** *** 241,248 **** } public Object[] toArray() { ! ArrayList list = new ArrayList(); ! Iterator it = iterator(); while (it.hasNext()) { list.add(it.next()); --- 241,248 ---- } public Object[] toArray() { ! ArrayList list = new ArrayList(); ! Iterator it = iterator(); while (it.hasNext()) { list.add(it.next()); *************** *** 328,333 **** --- 328,334 ---- obtos.writeObject(toArray()); } + @SuppressWarnings("unchecked") private void readObject(ObjectInputStream obtis) throws IOException, ClassNotFoundException { obtis.defaultReadObject(); *************** *** 336,346 **** refq = new ReferenceQueue(); for (int i = 0; i < arr.length; i++) { ! add(arr[i]); } } ! class WeakSetIterator implements Iterator { Entry current; Entry next; Object currentObj; --- 337,347 ---- refq = new ReferenceQueue(); for (int i = 0; i < arr.length; i++) { ! add((E)arr[i]); } } ! class WeakSetIterator implements Iterator { Entry current; Entry next; Object currentObj; *************** *** 382,388 **** return ((myNullCount > 0) || (next != null)); } ! public Object next() { checkModcount(); checkRefQueue(); --- 383,390 ---- return ((myNullCount > 0) || (next != null)); } ! @SuppressWarnings("unchecked") ! public E next() { checkModcount(); checkRefQueue(); *************** *** 409,415 **** nextObj = next.get(); } while (next.isEnqueued()); ! return currentObj; } } --- 411,417 ---- nextObj = next.get(); } while (next.isEnqueued()); ! return (E)currentObj; } } *************** *** 432,438 **** } /** Entries of this set */ ! class Entry extends WeakReference { // double linked list Entry prev; Entry next; --- 434,443 ---- } /** Entries of this set */ ! static class Entry extends WeakReference { ! /** reference to outer WeakSet */ ! private WeakSet set; ! // double linked list Entry prev; Entry next; *************** *** 440,450 **** Entry iterChainNext; Entry iterChainPrev; ! Entry(Object referenced, ReferenceQueue q, Entry next, Entry nextInIter) { super(referenced, q); this.next = next; this.prev = null; --- 445,455 ---- Entry iterChainNext; Entry iterChainPrev; ! @SuppressWarnings("unchecked") ! Entry(WeakSet set, Object referenced, ReferenceQueue q, Entry next, Entry nextInIter) { super(referenced, q); + this.set = set; + this.next = next; this.prev = null; *************** *** 450,456 **** } if (referenced != null) { ! hashcode = hashIt(referenced); } else { hashcode = 0; } --- 458,464 ---- } if (referenced != null) { ! hashcode = set.hashIt(referenced); } else { hashcode = 0; } *************** *** 489,499 **** if (iterChainPrev != null) { iterChainPrev.iterChainNext = iterChainNext; } else { // root ! iterChain = iterChainNext; } ! if (entries[hashcode] == this) { ! entries[hashcode] = next; } prev = null; --- 497,507 ---- if (iterChainPrev != null) { iterChainPrev.iterChainNext = iterChainNext; } else { // root ! set.iterChain = iterChainNext; } ! if (set.entries[hashcode] == this) { ! set.entries[hashcode] = next; } prev = null; *************** *** 517,523 **** } public Entry clone(ReferenceQueue q) { ! return new Entry(get(), q, ((next != null) ? (Entry) next.clone(q) : null), null); } } } --- 525,531 ---- } public Entry clone(ReferenceQueue q) { ! return new Entry(set, get(), q, ((next != null) ? (Entry) next.clone(q) : null), null); } } } Index: src/org/openide/util/TimedSoftReference.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/TimedSoftReference.java Base (1.1) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/TimedSoftReference.java Locally Modified (Based On 1.1) *************** *** 37,47 **** * * @author Jesse Glick */ ! final class TimedSoftReference extends SoftReference implements Runnable { private static final int TIMEOUT = 30000; private static final RequestProcessor RP = new RequestProcessor("TimedSoftReference"); // NOI18N private RequestProcessor.Task task; ! private Object o; private final Map m; private final Object k; --- 37,47 ---- * * @author Jesse Glick */ ! final class TimedSoftReference extends SoftReference implements Runnable { private static final int TIMEOUT = 30000; private static final RequestProcessor RP = new RequestProcessor("TimedSoftReference"); // NOI18N private RequestProcessor.Task task; ! private T o; private final Map m; private final Object k; *************** *** 56,62 **** * @param m a map in which this reference may serve as a value * @param k the key whose value in m may be this reference */ ! public TimedSoftReference(Object o, Map m, Object k) { super(o, Utilities.activeReferenceQueue()); this.o = o; this.m = m; --- 56,63 ---- * @param m a map in which this reference may serve as a value * @param k the key whose value in m may be this reference */ ! @SuppressWarnings("unchecked") // NEEDS API ! public TimedSoftReference(T o, Map m, Object k) { super(o, Utilities.activeReferenceQueue()); this.o = o; this.m = m; *************** *** 86,92 **** } } ! public Object get() { synchronized (m) { if (o == null) { o = super.get(); --- 87,93 ---- } } ! public T get() { synchronized (m) { if (o == null) { o = super.get(); Index: src/org/openide/util/datatransfer/ExTransferable.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/datatransfer/ExTransferable.java Base (1.2) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/datatransfer/ExTransferable.java Locally Modified (Based On 1.2) *************** *** 46,52 **** } /** hash map that assigns objects to dataflavors (DataFlavor, Single) */ ! private LinkedHashMap map; /** listeners */ private EventListenerList listeners; --- 46,52 ---- } /** hash map that assigns objects to dataflavors (DataFlavor, Single) */ ! private LinkedHashMap map; /** listeners */ private EventListenerList listeners; *************** *** 56,62 **** * @param o clipobard owner (or null) */ private ExTransferable(final Transferable t) { ! map = new LinkedHashMap(); final DataFlavor[] df = t.getTransferDataFlavors(); --- 56,62 ---- * @param o clipobard owner (or null) */ private ExTransferable(final Transferable t) { ! map = new LinkedHashMap(); final DataFlavor[] df = t.getTransferDataFlavors(); *************** *** 356,362 **** * @param array array of flavors */ public boolean areDataFlavorsSupported(DataFlavor[] array) { ! HashSet flav = new HashSet(); for (int i = 0; i < array.length; i++) { flav.add(array[i]); --- 356,362 ---- * @param array array of flavors */ public boolean areDataFlavorsSupported(DataFlavor[] array) { ! HashSet flav = new HashSet(); for (int i = 0; i < array.length; i++) { flav.add(array[i]); Index: src/org/openide/util/NbBundle.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/NbBundle.java Base (1.6) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/NbBundle.java Locally Modified (Based On 1.6) *************** *** 62,73 **** * Keeps only weak references to the class loaders. * @see "#9275" */ ! private static final Map localizedFileCache = new WeakHashMap(); // Map> /** * Cache of resource bundles. */ ! private static final Map bundleCache = new WeakHashMap(); // Map>> /** * Do not call. --- 62,73 ---- * Keeps only weak references to the class loaders. * @see "#9275" */ ! private static final Map> localizedFileCache = new WeakHashMap>(); /** * Cache of resource bundles. */ ! private static final Map>> bundleCache = new WeakHashMap>>(); /** * Do not call. *************** *** 154,167 **** // [PENDING] in the future, could maybe do something neat if // USE_DEBUG_LOADER and ext is "html" or "txt" etc... URL lookup = null; ! Iterator it = new LocaleIterator(locale); String cachePrefix = "[" + Integer.toString(loader.hashCode()) + "]"; // NOI18N ! List cacheCandidates = new ArrayList(10); // List String baseNameSlashes = baseName.replace('.', '/'); ! Map perLoaderCache = (Map) localizedFileCache.get(loader); if (perLoaderCache == null) { ! localizedFileCache.put(loader, perLoaderCache = new HashMap()); } // #31008: better use of domain cache priming. --- 154,167 ---- // [PENDING] in the future, could maybe do something neat if // USE_DEBUG_LOADER and ext is "html" or "txt" etc... URL lookup = null; ! Iterator it = new LocaleIterator(locale); String cachePrefix = "[" + Integer.toString(loader.hashCode()) + "]"; // NOI18N ! List cacheCandidates = new ArrayList(10); String baseNameSlashes = baseName.replace('.', '/'); ! Map perLoaderCache = localizedFileCache.get(loader); if (perLoaderCache == null) { ! localizedFileCache.put(loader, perLoaderCache = new HashMap()); } // #31008: better use of domain cache priming. *************** *** 441,453 **** * @return a resource bundle (locale- and branding-merged), or null if not found */ private static ResourceBundle getBundleFast(String name, Locale locale, ClassLoader loader) { ! Map m; synchronized (bundleCache) { ! m = (Map) bundleCache.get(loader); // Map> if (m == null) { ! bundleCache.put(loader, m = new HashMap()); } } --- 441,453 ---- * @return a resource bundle (locale- and branding-merged), or null if not found */ private static ResourceBundle getBundleFast(String name, Locale locale, ClassLoader loader) { ! Map> m; synchronized (bundleCache) { ! m = bundleCache.get(loader); if (m == null) { ! bundleCache.put(loader, m = new HashMap>()); } } *************** *** 480,487 **** String key = name + '/' + (brandingToken != null ? brandingToken : "-") + '/' + locale; // NOI18N */ synchronized (m) { ! Object o = m.get(key); ! ResourceBundle b = (o != null) ? (ResourceBundle) ((Reference) o).get() : null; if (b != null) { return b; --- 480,487 ---- String key = name + '/' + (brandingToken != null ? brandingToken : "-") + '/' + locale; // NOI18N */ synchronized (m) { ! Reference o = m.get(key); ! ResourceBundle b = o != null ? o.get() : null; if (b != null) { return b; *************** *** 489,495 **** b = loadBundle(name, locale, loader); if (b != null) { ! m.put(key, new TimedSoftReference(b, m, key)); } else { // Used to cache misses as well, to make the negative test faster. // However this caused problems: see #31578. --- 489,495 ---- b = loadBundle(name, locale, loader); if (b != null) { ! m.put(key, new TimedSoftReference(b, m, key)); } else { // Used to cache misses as well, to make the negative test faster. // However this caused problems: see #31578. *************** *** 509,516 **** */ private static ResourceBundle loadBundle(String name, Locale locale, ClassLoader loader) { String sname = name.replace('.', '/'); ! Iterator it = new LocaleIterator(locale); ! LinkedList l = new LinkedList(); while (it.hasNext()) { l.addFirst(it.next()); --- 509,516 ---- */ private static ResourceBundle loadBundle(String name, Locale locale, ClassLoader loader) { String sname = name.replace('.', '/'); ! Iterator it = new LocaleIterator(locale); ! LinkedList l = new LinkedList(); while (it.hasNext()) { l.addFirst(it.next()); *************** *** 555,566 **** first = false; } ! return new PBundle(p, locale); } /** * Load a class-based resource bundle. --- 555,571 ---- first = false; } ! return new PBundle(propsToStringMap(p), locale); } + /** Just converts the Properties to Map assuming the + * content is correct. + */ + @SuppressWarnings("unchecked") + private static Map propsToStringMap(Properties p) { + return (Map)p; + } + /** * Load a class-based resource bundle. * @param name the base name of the bundle, e.g. org.netbeans.modules.foo.Bundle *************** *** 769,775 **** * A resource bundle based on .properties files (or any map). */ private static final class PBundle extends ResourceBundle { ! private final Map m; // Map private final Locale locale; /** --- 777,783 ---- * A resource bundle based on .properties files (or any map). */ private static final class PBundle extends ResourceBundle { ! private final Map m; private final Locale locale; /** *************** *** 777,788 **** * @param m a map from resources keys to values (typically both strings) * @param locale the locale it represents (informational) */ ! public PBundle(Map m, Locale locale) { this.m = m; this.locale = locale; } ! public Enumeration getKeys() { return Collections.enumeration(m.keySet()); } --- 785,796 ---- * @param m a map from resources keys to values (typically both strings) * @param locale the locale it represents (informational) */ ! public PBundle(Map m, Locale locale) { this.m = m; this.locale = locale; } ! public Enumeration getKeys() { return Collections.enumeration(m.keySet()); } *************** *** 819,825 **** return loc; } ! public Enumeration getKeys() { return Enumerations.removeDuplicates(Enumerations.concat(sub1.getKeys(), sub2.getKeys())); } --- 827,834 ---- return loc; } ! @SuppressWarnings("unchecked") // NEEDS API ! public Enumeration getKeys() { return Enumerations.removeDuplicates(Enumerations.concat(sub1.getKeys(), sub2.getKeys())); } *************** *** 853,859 **** * Branding tokens with underscores are broken apart naturally: so e.g. * branding "f4j_ce" looks first for "f4j_ce" branding, then "f4j" branding, then none. */ ! private static class LocaleIterator extends Object implements Iterator { /** this flag means, if default locale is in progress */ private boolean defaultInProgress = false; --- 862,868 ---- * Branding tokens with underscores are broken apart naturally: so e.g. * branding "f4j_ce" looks first for "f4j_ce" branding, then "f4j" branding, then none. */ ! private static class LocaleIterator extends Object implements Iterator { /** this flag means, if default locale is in progress */ private boolean defaultInProgress = false; *************** *** 896,902 **** /** @return next sufix. * @exception NoSuchElementException if there is no more locale sufix. */ ! public Object next() throws NoSuchElementException { if (current == null) { throw new NoSuchElementException(); } --- 905,911 ---- /** @return next sufix. * @exception NoSuchElementException if there is no more locale sufix. */ ! public String next() throws NoSuchElementException { if (current == null) { throw new NoSuchElementException(); } *************** *** 981,990 **** /** indices of known bundles; needed since DebugLoader's can be collected * when softly reachable, but this should be transparent to the user */ ! private static final Map knownIDs = new HashMap(); // Map /** cache of existing debug loaders for regular loaders */ ! private static final Map existing = new WeakHashMap(); // Map> private DebugLoader(ClassLoader cl) { super(cl); --- 990,999 ---- /** indices of known bundles; needed since DebugLoader's can be collected * when softly reachable, but this should be transparent to the user */ ! private static final Map knownIDs = new HashMap(); /** cache of existing debug loaders for regular loaders */ ! private static final Map> existing = new WeakHashMap>(); private DebugLoader(ClassLoader cl) { super(cl); *************** *** 1025,1031 **** } ClassLoader dl = new DebugLoader(normal); ! existing.put(normal, new WeakReference(dl)); return dl; } --- 1034,1040 ---- } ClassLoader dl = new DebugLoader(normal); ! existing.put(normal, new WeakReference(dl)); return dl; } Index: src/org/openide/util/UtilitiesCompositeActionMap.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/UtilitiesCompositeActionMap.java Base (1.1) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/UtilitiesCompositeActionMap.java Locally Modified (Based On 1.1) *************** *** 76,82 **** } private Object[] keys(boolean all) { ! java.util.HashSet keys = new java.util.HashSet(); Component c = component; --- 76,82 ---- } private Object[] keys(boolean all) { ! java.util.HashSet keys = new java.util.HashSet(); Component c = component; *************** *** 85,91 **** javax.swing.ActionMap m = ((JComponent) c).getActionMap(); if (m != null) { ! java.util.List l; if (all) { l = java.util.Arrays.asList(m.allKeys()); --- 85,91 ---- javax.swing.ActionMap m = ((JComponent) c).getActionMap(); if (m != null) { ! java.util.List l; if (all) { l = java.util.Arrays.asList(m.allKeys()); Index: src/org/openide/util/WeakListenerImpl.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/WeakListenerImpl.java Base (1.4) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/WeakListenerImpl.java Locally Modified (Based On 1.4) *************** *** 29,34 **** --- 29,36 ---- import java.lang.reflect.Proxy; import java.util.EventListener; import java.util.EventObject; + import java.util.Map; + import java.util.WeakHashMap; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; *************** *** 49,55 **** Class listenerClass; /** weak reference to source */ ! private Reference source; /** * @param listenerClass class/interface of the listener --- 51,57 ---- Class listenerClass; /** weak reference to source */ ! private Reference source; /** * @param listenerClass class/interface of the listener *************** *** 81,87 **** if (source == null) { this.source = null; } else { ! this.source = new WeakReference(source); } } --- 83,89 ---- if (source == null) { this.source = null; } else { ! this.source = new WeakReference(source); } } *************** *** 343,349 **** private static Method equalsMth; /** Class -> Reference(Constructor) */ ! private static final java.util.WeakHashMap constructors = new java.util.WeakHashMap(); /** proxy generated for this listener */ public final Object proxy; --- 345,351 ---- private static Method equalsMth; /** Class -> Reference(Constructor) */ ! private static final Map> constructors = new WeakHashMap>(); /** proxy generated for this listener */ public final Object proxy; *************** *** 360,366 **** if (proxyConstructor == null) { Class proxyClass = Proxy.getProxyClass(c.getClassLoader(), new Class[] { c }); proxyConstructor = proxyClass.getConstructor(new Class[] { InvocationHandler.class }); ! constructors.put(c, new SoftReference(proxyConstructor)); } Object p; --- 362,368 ---- if (proxyConstructor == null) { Class proxyClass = Proxy.getProxyClass(c.getClassLoader(), new Class[] { c }); proxyConstructor = proxyClass.getConstructor(new Class[] { InvocationHandler.class }); ! constructors.put(c, new SoftReference(proxyConstructor)); } Object p; *************** *** 464,469 **** --- 466,472 ---- private static Object LOCK = new Object(); WeakListenerImpl weakListener; + @SuppressWarnings("unchecked") // NEED API public ListenerReference(Object ref, WeakListenerImpl weakListener) { super(ref, Utilities.activeReferenceQueue()); this.weakListener = weakListener; *************** *** 481,487 **** if (weakListener.source != source) { // plan new cleanup into the activeReferenceQueue with this listener and // provided source ! weakListener.source = new WeakReference(source) { ListenerReference doNotGCRef = new ListenerReference(new Object(), weakListener); }; } --- 484,490 ---- if (weakListener.source != source) { // plan new cleanup into the activeReferenceQueue with this listener and // provided source ! weakListener.source = new WeakReference (source) { ListenerReference doNotGCRef = new ListenerReference(new Object(), weakListener); }; } Index: src/org/openide/util/Mutex.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Mutex.java Base (1.6) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/Mutex.java Locally Modified (Based On 1.6) *************** *** 138,144 **** private /*final*/ Object LOCK; /** threads that - owns or waits for this mutex */ ! private /*final*/ Map registeredThreads; /** number of threads that holds S mode (readersNo == "count of threads in registeredThreads that holds S") */ --- 138,144 ---- private /*final*/ Object LOCK; /** threads that - owns or waits for this mutex */ ! private /*final*/ Map registeredThreads; /** number of threads that holds S mode (readersNo == "count of threads in registeredThreads that holds S") */ *************** *** 146,152 **** private int readersNo = 0; /** a queue of waiting threads for this mutex */ ! private List waiters; /** Enhanced constructor that permits specifying an object to use as a lock. * The lock is used on entry and exit to {@link #readAccess} and during the --- 146,152 ---- private int readersNo = 0; /** a queue of waiting threads for this mutex */ ! private List waiters; /** Enhanced constructor that permits specifying an object to use as a lock. * The lock is used on entry and exit to {@link #readAccess} and during the *************** *** 190,197 **** /** Initiates this Mutex */ private void init(Object lock) { this.LOCK = lock; ! this.registeredThreads = new HashMap(7); ! this.waiters = new LinkedList(); } /** Run an action only with read access. --- 190,197 ---- /** Initiates this Mutex */ private void init(Object lock) { this.LOCK = lock; ! this.registeredThreads = new HashMap(7); ! this.waiters = new LinkedList(); } /** Run an action only with read access. *************** *** 1307,1313 **** /** queue of runnable rquests that are to be executed (in X mode) right after S mode is left * deadlock avoidance technique */ ! List[] queues; /** value of counts[S] when the mode was upgraded * rsnapshot works as follows: --- 1307,1313 ---- /** queue of runnable rquests that are to be executed (in X mode) right after S mode is left * deadlock avoidance technique */ ! List[] queues; /** value of counts[S] when the mode was upgraded * rsnapshot works as follows: *************** *** 1323,1333 **** */ int rsnapshot; public ThreadInfo(Thread t, int mode) { this.t = t; this.mode = mode; this.counts = new int[MODE_COUNT]; ! this.queues = new List[MODE_COUNT]; counts[mode] = 1; } --- 1323,1334 ---- */ int rsnapshot; + @SuppressWarnings("unchecked") public ThreadInfo(Thread t, int mode) { this.t = t; this.mode = mode; this.counts = new int[MODE_COUNT]; ! this.queues = (List[])new List[MODE_COUNT]; counts[mode] = 1; } *************** *** 1338,1344 **** /** Adds the Runnable into the queue of waiting requests */ public void enqueue(int mode, Runnable run) { if (queues[mode] == null) { ! queues[mode] = new ArrayList(13); } queues[mode].add(run); --- 1339,1345 ---- /** Adds the Runnable into the queue of waiting requests */ public void enqueue(int mode, Runnable run) { if (queues[mode] == null) { ! queues[mode] = new ArrayList(13); } queues[mode].add(run); Index: src/org/openide/util/io/NbObjectOutputStream.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/io/NbObjectOutputStream.java Base (1.3) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/io/NbObjectOutputStream.java Locally Modified (Based On 1.3) *************** *** 37,43 **** */ public class NbObjectOutputStream extends ObjectOutputStream { private static final String SVUID = "serialVersionUID"; // NOI18N ! private static final Set alreadyReported = new WeakSet(); // Set static { // See below. --- 37,43 ---- */ public class NbObjectOutputStream extends ObjectOutputStream { private static final String SVUID = "serialVersionUID"; // NOI18N ! private static final Set alreadyReported = new WeakSet(); static { // See below. *************** *** 47,54 **** alreadyReported.add("java.awt.geom.AffineTransform"); // NOI18N } ! private static Map examinedClasses = new WeakHashMap(250); // Map ! private final List serializing = new ArrayList(50); // List /** Create a new object output. * @param os the underlying output stream --- 47,54 ---- alreadyReported.add("java.awt.geom.AffineTransform"); // NOI18N } ! private static Map examinedClasses = new WeakHashMap(250); ! private final List serializing = new ArrayList(50); /** Create a new object output. * @param os the underlying output stream *************** *** 134,140 **** String classname = cl.getName(); if (alreadyReported.add(classname)) { ! Set serializingUniq = new HashSet(); // Set StringBuffer b = new StringBuffer("Serializable class "); // NOI18N b.append(classname); b.append(" does not declare serialVersionUID field. Encountered while storing: ["); // NOI18N --- 134,140 ---- String classname = cl.getName(); if (alreadyReported.add(classname)) { ! Set serializingUniq = new HashSet(); StringBuffer b = new StringBuffer("Serializable class "); // NOI18N b.append(classname); b.append(" does not declare serialVersionUID field. Encountered while storing: ["); // NOI18N Index: src/org/openide/util/TopologicalSortException.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/TopologicalSortException.java Base (1.1) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/TopologicalSortException.java Locally Modified (Based On 1.1) *************** *** 37,43 **** private int counter; /** vertexes sorted by increasing value of y */ ! private Stack dualGraph = new Stack(); TopologicalSortException(Collection vertexes, Map edges) { this.vertexes = vertexes; --- 37,43 ---- private int counter; /** vertexes sorted by increasing value of y */ ! private Stack dualGraph = new Stack(); TopologicalSortException(Collection vertexes, Map edges) { this.vertexes = vertexes; *************** *** 49,58 **** * * @return list of partially sorted objects, the list can be freely modified */ public final List partialSort() { ! Set[] all = topologicalSets(); ! ArrayList res = new ArrayList(vertexes.size()); for (int i = 0; i < all.length; i++) { res.addAll(all[i]); --- 49,59 ---- * * @return list of partially sorted objects, the list can be freely modified */ + @SuppressWarnings("unchecked") // NEEDS API public final List partialSort() { ! Set[] all = topologicalSets(); ! ArrayList res = new ArrayList(vertexes.size()); for (int i = 0; i < all.length; i++) { res.addAll(all[i]); *************** *** 75,81 **** public final Set[] unsortableSets() { Set[] all = topologicalSets(); ! ArrayList unsort = new ArrayList(); for (int i = 0; i < all.length; i++) { if ((all[i].size() > 1) || !(all[i] instanceof HashSet)) { --- 76,82 ---- public final Set[] unsortableSets() { Set[] all = topologicalSets(); ! ArrayList unsort = new ArrayList(); for (int i = 0; i < all.length; i++) { if ((all[i].size() > 1) || !(all[i] instanceof HashSet)) { *************** *** 83,89 **** } } ! return (Set[]) unsort.toArray(new Set[0]); } /** Adds description why the graph cannot be sorted. --- 84,90 ---- } } ! return unsort.toArray(new Set[0]); } /** Adds description why the graph cannot be sorted. *************** *** 137,143 **** return result; } ! HashMap vertexInfo = new HashMap(); // computes value X and Y for each vertex counter = 0; --- 138,144 ---- return result; } ! HashMap vertexInfo = new HashMap(); // computes value X and Y for each vertex counter = 0; *************** *** 151,165 **** // now connect vertexes that cannot be sorted into own // sets // map from the original objects to ! Map objectsToSets = new HashMap(); ! ArrayList sets = new ArrayList(); while (!dualGraph.isEmpty()) { Vertex v = (Vertex) dualGraph.pop(); if (!v.visited) { ! Set set = new HashSet(); visitDualGraph(v, set); if ((set.size() == 1) && v.edgesFrom.contains(v)) { --- 152,166 ---- // now connect vertexes that cannot be sorted into own // sets // map from the original objects to ! Map objectsToSets = new HashMap(); ! ArrayList sets = new ArrayList(); while (!dualGraph.isEmpty()) { Vertex v = (Vertex) dualGraph.pop(); if (!v.visited) { ! Set set = new HashSet(); visitDualGraph(v, set); if ((set.size() == 1) && v.edgesFrom.contains(v)) { *************** *** 185,191 **** // now topologically sort the sets // 1. prepare the map ! HashMap edgesBetweenSets = new HashMap(); it = edges.entrySet().iterator(); while (it.hasNext()) { --- 186,192 ---- // now topologically sort the sets // 1. prepare the map ! HashMap> edgesBetweenSets = new HashMap>(); it = edges.entrySet().iterator(); while (it.hasNext()) { *************** *** 196,207 **** continue; } ! Set from = (Set) objectsToSets.get(entry.getKey()); ! Collection setsTo = (Collection) edgesBetweenSets.get(from); if (setsTo == null) { ! setsTo = new ArrayList(); edgesBetweenSets.put(from, setsTo); } --- 197,208 ---- continue; } ! Set from = objectsToSets.get(entry.getKey()); ! List setsTo = edgesBetweenSets.get(from); if (setsTo == null) { ! setsTo = new ArrayList(); edgesBetweenSets.put(from, setsTo); } *************** *** 208,214 **** Iterator convert = leadsTo.iterator(); while (convert.hasNext()) { ! Set to = (Set) objectsToSets.get(convert.next()); if (from != to) { // avoid self cycles --- 209,215 ---- Iterator convert = leadsTo.iterator(); while (convert.hasNext()) { ! Set to = objectsToSets.get(convert.next()); if (from != to) { // avoid self cycles *************** *** 216,225 **** } } } // 2. do the sort try { ! result = (Set[]) Utilities.topologicalSort(sets, edgesBetweenSets).toArray(new Set[0]); } catch (TopologicalSortException ex) { throw new IllegalStateException("Cannot happen"); // NOI18N } --- 217,231 ---- } } } + return sortSets(sets, edgesBetweenSets); + } + @SuppressWarnings("unchecked") // NEED API + private Set[] sortSets(final ArrayList sets, final HashMap> edgesBetweenSets) throws IllegalStateException { // 2. do the sort try { ! List listResult = Utilities.topologicalSort(sets, edgesBetweenSets); ! result = listResult.toArray(new Set[0]); } catch (TopologicalSortException ex) { throw new IllegalStateException("Cannot happen"); // NOI18N } *************** *** 232,238 **** * @param vertex current vertex * @param vertexInfo the info */ ! private Vertex constructDualGraph(int counter, Object vertex, HashMap vertexInfo) { Vertex info = (Vertex) vertexInfo.get(vertex); if (info == null) { --- 238,244 ---- * @param vertex current vertex * @param vertexInfo the info */ ! private Vertex constructDualGraph(int counter, Object vertex, HashMap vertexInfo) { Vertex info = (Vertex) vertexInfo.get(vertex); if (info == null) { *************** *** 269,275 **** * @param vertex vertex to start from * @param visited list of all objects that we've been to */ ! private void visitDualGraph(Vertex vertex, Collection visited) { if (vertex.visited) { return; } --- 275,281 ---- * @param vertex vertex to start from * @param visited list of all objects that we've been to */ ! private void visitDualGraph(Vertex vertex, Collection visited) { if (vertex.visited) { return; } *************** *** 289,300 **** * comparable by the value of Y, but only after the value is set, * so the sort has to be done latelly. */ ! private static final class Vertex implements Comparable { /** the found object */ public Object object; /** list of vertexes that point to this one */ ! public List edgesFrom = new ArrayList(); /** the counter state when we entered the vertex */ public final int x; --- 295,306 ---- * comparable by the value of Y, but only after the value is set, * so the sort has to be done latelly. */ ! private static final class Vertex implements Comparable { /** the found object */ public Object object; /** list of vertexes that point to this one */ ! public List edgesFrom = new ArrayList(); /** the counter state when we entered the vertex */ public final int x; *************** *** 331,340 **** * @return a negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ ! public int compareTo(Object o) { ! Vertex v = (Vertex) o; ! ! return v.y - y; } } } --- 337,344 ---- * @return a negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ ! public int compareTo(Vertex o) { ! return o.y - y; } } } Index: src/org/openide/util/WeakListeners.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/WeakListeners.java Base (1.1) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/WeakListeners.java Locally Modified (Based On 1.1) *************** *** 228,233 **** --- 228,234 ---- * calls to l. * @since 4.12 */ + @SuppressWarnings("unchecked") // NEEDS API public static EventListener create(Class lType, Class apiType, EventListener l, Object source) { if (!lType.isInterface()) { throw new IllegalArgumentException("Not interface: " + lType); Index: src/org/openide/util/RE13.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/RE13.java Base (1.1) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/RE13.java Locally Modified (Based On 1.1) *************** *** 116,122 **** /** Data structure to needed to store the */ public void init(String[] original, String[] newversion) { ! ArrayList root = new ArrayList(); for (int i = 0; i < original.length; i++) { placeString(root, original[i], i); --- 116,122 ---- /** Data structure to needed to store the */ public void init(String[] original, String[] newversion) { ! ArrayList root = new ArrayList(); for (int i = 0; i < original.length; i++) { placeString(root, original[i], i); *************** *** 131,137 **** * @param s string to place there * @param indx index to put at the end node */ ! private static void placeString(List item, String s, int indx) { if (s.length() == 0) { item.add(new Integer(indx)); --- 131,137 ---- * @param s string to place there * @param indx index to put at the end node */ ! private static void placeString(List item, String s, int indx) { if (s.length() == 0) { item.add(new Integer(indx)); *************** *** 140,146 **** char f = s.charAt(0); ! ListIterator it = item.listIterator(); while (it.hasNext()) { Object o = it.next(); --- 140,146 ---- char f = s.charAt(0); ! ListIterator it = item.listIterator(); while (it.hasNext()) { Object o = it.next(); *************** *** 159,165 **** // next is the list or null List listForPref = (List) it.next(); ! ArrayList switchList = new ArrayList(); it.set(switchList); switchList.add(pref.substring(i)); --- 159,165 ---- // next is the list or null List listForPref = (List) it.next(); ! ArrayList switchList = new ArrayList(); it.set(switchList); switchList.add(pref.substring(i)); *************** *** 168,174 **** if (i >= s.length()) { switchList.add(new Integer(indx)); } else { ! ArrayList terminalList = new ArrayList(); terminalList.add(new Integer(indx)); switchList.add(s.substring(i)); --- 168,174 ---- if (i >= s.length()) { switchList.add(new Integer(indx)); } else { ! ArrayList terminalList = new ArrayList(); terminalList.add(new Integer(indx)); switchList.add(s.substring(i)); *************** *** 182,188 **** // // the new string is longer than the existing recursive add // ! List switchList = (List) it.next(); placeString(switchList, s.substring(pref.length()), indx); return; --- 182,188 ---- // // the new string is longer than the existing recursive add // ! List switchList = nextList(it); placeString(switchList, s.substring(pref.length()), indx); return; *************** *** 193,208 **** // // ok new prefix in this item // ! ArrayList id = new ArrayList(); id.add(new Integer(indx)); item.add(s); item.add(id); } /** Compress tree of Lists into tree of Objects. */ --- 193,211 ---- // // ok new prefix in this item // ! ArrayList id = new ArrayList(); id.add(new Integer(indx)); item.add(s); item.add(id); } + @SuppressWarnings("unchecked") + private static List nextList(final ListIterator it) { + List switchList = (List) it.next(); + return switchList; + } + /** Compress tree of Lists into tree of Objects. */ private static Object[] compress(List item) { Index: src/org/openide/util/SharedClassObject.java *** /doma/jarda/netbeans-src/openide/util/src/org/openide/util/SharedClassObject.java Base (1.4) --- /doma/jarda/netbeans-src/openide/util/src/org/openide/util/SharedClassObject.java Locally Modified (Based On 1.4) *************** *** 50,56 **** private static final Object PROP_SUPPORT = new Object(); /** Map (Class, DataEntry) that maps Classes to maps of any objects */ ! private static final Map values = new WeakHashMap(4); /** A set of all classes for which we are currently inside createInstancePrivileged. * If a SCO constructor is called when an instance of that class already exists, normally --- 50,56 ---- private static final Object PROP_SUPPORT = new Object(); /** Map (Class, DataEntry) that maps Classes to maps of any objects */ ! private static final Map values = new WeakHashMap(37); /** A set of all classes for which we are currently inside createInstancePrivileged. * If a SCO constructor is called when an instance of that class already exists, normally *************** *** 60,71 **** * second instance (because it is nobody's fault and it will be handled OK). * Map from class name to nesting count. */ ! private static final Map instancesBeingCreated = new HashMap(3); // Map /** Set of classes to not warn about any more. * Names only. */ ! private static final Set alreadyWarnedAboutDupes = new HashSet(); // Set private static final ErrorManager err = ErrorManager.getDefault().getInstance("org.openide.util.SharedClassObject"); // NOI18N /** data entry for this class */ --- 60,71 ---- * second instance (because it is nobody's fault and it will be handled OK). * Map from class name to nesting count. */ ! private static final Map instancesBeingCreated = new HashMap(7); /** Set of classes to not warn about any more. * Names only. */ ! private static final Set alreadyWarnedAboutDupes = new HashSet(); // private static final ErrorManager err = ErrorManager.getDefault().getInstance("org.openide.util.SharedClassObject"); // NOI18N /** data entry for this class */ *************** *** 480,489 **** if ((obj == null) && create) { // try to create new instance ! PrivilegedExceptionAction action = new SetAccessibleAction(clazz); try { ! obj = (SharedClassObject) AccessController.doPrivileged(action); } catch (PrivilegedActionException e) { Exception ex = e.getException(); IllegalArgumentException newEx = new IllegalArgumentException(ex.toString()); --- 480,489 ---- if ((obj == null) && create) { // try to create new instance ! SetAccessibleAction action = new SetAccessibleAction(clazz); try { ! obj = AccessController.doPrivileged(action); } catch (PrivilegedActionException e) { Exception ex = e.getException(); IllegalArgumentException newEx = new IllegalArgumentException(ex.toString()); *************** *** 714,720 **** // make readResolve accessible (it can have any access modifier) resolveMethod.setAccessible(true); ! return resolveMethod.invoke(object, null); } catch (Exception ex) { // checked or runtime does not matter - we must survive String banner = "Skipping " + object.getClass() + " resolution:"; //NOI18N --- 714,720 ---- // make readResolve accessible (it can have any access modifier) resolveMethod.setAccessible(true); ! return resolveMethod.invoke(object); } catch (Exception ex) { // checked or runtime does not matter - we must survive String banner = "Skipping " + object.getClass() + " resolution:"; //NOI18N *************** *** 777,789 **** */ static final class DataEntry extends Object { /** The data */ ! private HashMap map; /** The reference counter */ private int count = 0; /** weak reference to an object of this class */ ! private WeakReference ref = new WeakReference(null); /** inited? */ private boolean initialized = false; --- 777,789 ---- */ static final class DataEntry extends Object { /** The data */ ! private HashMap map; /** The reference counter */ private int count = 0; /** weak reference to an object of this class */ ! private WeakReference ref = new WeakReference(null); /** inited? */ private boolean initialized = false; *************** *** 807,818 **** * @param obj the requestor object * @return the data */ ! Map getMap(SharedClassObject obj) { ensureValid(obj); if (map == null) { // to signal invalid state ! map = new HashMap(); } if (!initialized) { --- 807,818 ---- * @param obj the requestor object * @return the data */ ! Map getMap(SharedClassObject obj) { ensureValid(obj); if (map == null) { // to signal invalid state ! map = new HashMap(); } if (!initialized) { *************** *** 836,842 **** if (map == null) { // to signal invalid state ! map = new HashMap(); ret = null; } else { ret = map.get(key); --- 836,842 ---- if (map == null) { // to signal invalid state ! map = new HashMap(); ret = null; } else { ret = map.get(key); *************** *** 865,871 **** if (map == null) { // to signal invalid state ! map = new HashMap(); } return map; --- 865,871 ---- if (map == null) { // to signal invalid state ! map = new HashMap(); } return map; *************** *** 932,938 **** SharedClassObject s = (SharedClassObject) ref.get(); if (s == null) { ! ref = new WeakReference(obj); return obj; } else { --- 932,938 ---- SharedClassObject s = (SharedClassObject) ref.get(); if (s == null) { ! ref = new WeakReference(obj); return obj; } else { *************** *** 962,968 **** } } ! static final class SetAccessibleAction implements PrivilegedExceptionAction { Class klass; SetAccessibleAction(Class klass) { --- 962,968 ---- } } ! static final class SetAccessibleAction implements PrivilegedExceptionAction { Class klass; SetAccessibleAction(Class klass) { *************** *** 969,976 **** this.klass = klass; } ! public Object run() throws Exception { ! return createInstancePrivileged(klass); } } } --- 969,976 ---- this.klass = klass; } ! public SharedClassObject run() throws Exception { ! return SharedClassObject.class.cast(createInstancePrivileged(klass)); } } }