R
rschmid-google
I have finally been allowed to upgrade to Java5 and I just finished
fixing some 1200 parameterization warnings which has really improved
the code. I have one, ONE, left and I'm not sure it can be fixed.
I have the following object heierarchy;
SourceMatch
CMatch extends SourceMatch
DMatch extends SourceMatch
SMatchService<T extends SourceMatch>
CMatchService extends SMatchService<CMatch>
DMatchService extends SMatchService<DMatch>
in SMatchService is the following method
public abstract List<T> getMatchingSources(args) {}
which is implemented in the subclass services thus;
public List<CMatch> getMatchingSources(args) {}
and
public List<DMatch> getMatchingSources(args) {}
yet the following code throws an unchecked conversion warning;
SMatchService sourceMatchService = null;
if (c) sourceMatchService = new CMatchService();
else if (d) sourceMatchService = new DMatchService();
List<SourceMatch> sourceList = =
sourceMatchService.getMatchingSources(args);
I have tried using wildcard parameters but my understanding is
imperfect at best.
I suspect that the problem is really architectural but I wanted to find
out if there is a way to make this work.
Any help is appreciated.
fixing some 1200 parameterization warnings which has really improved
the code. I have one, ONE, left and I'm not sure it can be fixed.
I have the following object heierarchy;
SourceMatch
CMatch extends SourceMatch
DMatch extends SourceMatch
SMatchService<T extends SourceMatch>
CMatchService extends SMatchService<CMatch>
DMatchService extends SMatchService<DMatch>
in SMatchService is the following method
public abstract List<T> getMatchingSources(args) {}
which is implemented in the subclass services thus;
public List<CMatch> getMatchingSources(args) {}
and
public List<DMatch> getMatchingSources(args) {}
yet the following code throws an unchecked conversion warning;
SMatchService sourceMatchService = null;
if (c) sourceMatchService = new CMatchService();
else if (d) sourceMatchService = new DMatchService();
List<SourceMatch> sourceList = =
sourceMatchService.getMatchingSources(args);
I have tried using wildcard parameters but my understanding is
imperfect at best.
I suspect that the problem is really architectural but I wanted to find
out if there is a way to make this work.
Any help is appreciated.