< prev index next >

src/com/sun/javatest/TestResult.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg

*** 948,959 **** public synchronized void setEnvironment(TestEnvironment environment) { if (!isMutable()) { throw new IllegalStateException( "This TestResult is no longer mutable!"); } ! for (Iterator i = environment.elementsUsed().iterator(); i.hasNext(); ) { ! TestEnvironment.Element elem = (TestEnvironment.Element) (i.next()); // this is stunningly inefficient and should be fixed env = PropertyArray.put(env, elem.getKey(), elem.getValue()); } } --- 948,959 ---- public synchronized void setEnvironment(TestEnvironment environment) { if (!isMutable()) { throw new IllegalStateException( "This TestResult is no longer mutable!"); } ! for (Iterator<TestEnvironment.Element> i = environment.elementsUsed().iterator(); i.hasNext(); ) { ! TestEnvironment.Element elem = i.next(); // this is stunningly inefficient and should be fixed env = PropertyArray.put(env, elem.getKey(), elem.getValue()); } }
*** 1299,1309 **** /** * Get the keys of the properties that this object has stored. * @return the keys of the properties that this object has stored */ ! public synchronized Enumeration getPropertyNames() { return PropertyArray.enumerate(props); } /** * Get the value of a property of this test result. --- 1299,1309 ---- /** * Get the keys of the properties that this object has stored. * @return the keys of the properties that this object has stored */ ! public synchronized Enumeration<String> getPropertyNames() { return PropertyArray.enumerate(props); } /** * Get the value of a property of this test result.
*** 1330,1340 **** * @return a copy of the environment that this object has stored * @throws TestResult.Fault if there is a problem * recreating data from the results file. * @see #setEnvironment */ ! public synchronized Map getEnvironment() throws Fault { if (env == null) { // reconstitute environment // this may result in a Fault, which is okay reload(); } --- 1330,1340 ---- * @return a copy of the environment that this object has stored * @throws TestResult.Fault if there is a problem * recreating data from the results file. * @see #setEnvironment */ ! public synchronized Map<String, String> getEnvironment() throws Fault { if (env == null) { // reconstitute environment // this may result in a Fault, which is okay reload(); }
*** 1980,1993 **** return Math.abs(cs); // ensure +ve, to avoid sign issues! } private static long computeChecksum(TestDescription td) { long cs = 0; ! for (Iterator i = td.getParameterKeys(); i.hasNext(); ) { // don't rely on enumeration in a particular order // so simply add the checksum products together ! String key = (String) (i.next()); cs += computeChecksum(key) * computeChecksum(td.getParameter(key)); } return cs; } --- 1980,1993 ---- return Math.abs(cs); // ensure +ve, to avoid sign issues! } private static long computeChecksum(TestDescription td) { long cs = 0; ! for (Iterator<String> i = td.getParameterKeys(); i.hasNext(); ) { // don't rely on enumeration in a particular order // so simply add the checksum products together ! String key = (i.next()); cs += computeChecksum(key) * computeChecksum(td.getParameter(key)); } return cs; }
*** 2555,2572 **** private void addToShrinkList() { synchronized (shrinkList) { // if this object is in the list; remove it; // if there are dead weak refs, remove them for (Iterator<WeakReference<TestResult>> iter = shrinkList.iterator(); iter.hasNext(); ) { ! WeakReference wref = iter.next(); Object o = wref.get(); if (o == null || o == this) iter.remove(); } while (shrinkList.size() >= maxShrinkListSize) { ! WeakReference wref = shrinkList.removeFirst(); ! TestResult tr = (TestResult) (wref.get()); if (tr != null) tr.shrink(); } shrinkList.addLast(new WeakReference<>(this)); } --- 2555,2572 ---- private void addToShrinkList() { synchronized (shrinkList) { // if this object is in the list; remove it; // if there are dead weak refs, remove them for (Iterator<WeakReference<TestResult>> iter = shrinkList.iterator(); iter.hasNext(); ) { ! WeakReference<TestResult> wref = iter.next(); Object o = wref.get(); if (o == null || o == this) iter.remove(); } while (shrinkList.size() >= maxShrinkListSize) { ! WeakReference<TestResult> wref = shrinkList.removeFirst(); ! TestResult tr = wref.get(); if (tr != null) tr.shrink(); } shrinkList.addLast(new WeakReference<>(this)); }
< prev index next >