RFR: CODETOOLS-7902237: Fixing raw use of parameterized class

dmitry.bessonov at oracle.com dmitry.bessonov at oracle.com
Tue Jul 24 23:17:08 UTC 2018

On 24/07/2018 23:39, Jonathan Gibbons wrote:
> On 07/24/2018 07:48 AM, dmitry.bessonov at oracle.com wrote:
>> Please review the following fix related to "raw use of parameterized 
>> class" warning:
>> JBS: https://bugs.openjdk.java.net/browse/CODETOOLS-7902237
>> Webrev: http://cr.openjdk.java.net/~dbessono/7902237/webrev/
>> dmitry
> ReadAheadIterator
> You've declared it to "implement Iterator<TestResult>" but I don't see 
> any place where you
> rely on it being a TestResult ... 

RAI is used in class Harness.
With the fix at least in one place casting is not needed any more:

  727     public Object next() {
  728        TestResult tr = (TestResult) (raTestIter.next());

  727     public TestDescription next() {
  728        TestResult tr = raTestIter.next();

which is confirmed by the fact that
> you've had to newly-import
> TestResult.
> An arguably more abstract way of doing this would be to declare
>    36 public class ReadAheadIterator<T> implements Iterator<T>
> so that there is no unnecessary dependence on TestResult in this class.
> The dependence on TestResult can then be expressed at the use site.

Will implement as part of a follow-up pack of changes.


More information about the jtharness-dev mailing list