Skip to content

Commit 75ff1ab

Browse files
committed
Merge pull request #91 from emckee2006/master
Remove Compile warning in a case where we are subverting the type system
2 parents 0a81153 + d193131 commit 75ff1ab

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

biojava3-core/src/main/java/org/biojava3/core/sequence/ProteinSequence.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import org.biojava3.core.sequence.compound.AminoAcidCompound;
2626
import org.biojava3.core.sequence.compound.AminoAcidCompoundSet;
27+
import org.biojava3.core.sequence.compound.NucleotideCompound;
2728
import org.biojava3.core.sequence.loader.StringProxySequenceReader;
2829
import org.biojava3.core.sequence.template.AbstractSequence;
2930
import org.biojava3.core.sequence.template.CompoundSet;
@@ -83,7 +84,9 @@ public ProteinSequence(ProxySequenceReader<AminoAcidCompound> proxyLoader, Compo
8384
* @param begin
8485
* @param end
8586
*/
86-
public void setParentDNASequence(AbstractSequence parentDNASequence, Integer begin, Integer end) {
87+
//TODO - Someone needs to check if this is a bug. Shouldn't a parentDNASequence be something other then AminoAcid?
88+
//However, due to the derivation of this class, this is the only possible type argument for this parameter...
89+
public void setParentDNASequence(AbstractSequence<NucleotideCompound> parentDNASequence, Integer begin, Integer end) {
8790
this.setParentSequence(parentDNASequence);
8891
setBioBegin(begin);
8992
setBioEnd(end);

biojava3-core/src/main/java/org/biojava3/core/sequence/template/AbstractSequence.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public abstract class AbstractSequence<C extends Compound> implements Sequence<C
6262
private Collection<Object> userCollection;
6363
private Integer bioBegin = null;
6464
private Integer bioEnd = null;
65-
private AbstractSequence<C> parentSequence = null;
65+
private AbstractSequence<?> parentSequence = null;
6666
private String source = null;
6767
private ArrayList<String> notesList = new ArrayList<String>();
6868
private Double sequenceScore = null;
@@ -226,14 +226,14 @@ public void setOriginalHeader(String originalHeader) {
226226
/**
227227
* @return the parentSequence
228228
*/
229-
public AbstractSequence<C> getParentSequence() {
229+
public AbstractSequence<?> getParentSequence() {
230230
return parentSequence;
231231
}
232232

233233
/**
234234
* @param parentSequence the parentSequence to set
235235
*/
236-
public void setParentSequence(AbstractSequence<C> parentSequence) {
236+
public void setParentSequence(AbstractSequence<?> parentSequence) {
237237
this.parentSequence = parentSequence;
238238
}
239239

@@ -474,9 +474,13 @@ public CompoundSet<C> getCompoundSet() {
474474
if (compoundSet != null) {
475475
return compoundSet;
476476
}
477+
// This is invalid since the parentSequence isn't guaranteed to have the same compound set as this sequence,
478+
// e.g., the case where the parent sequence for a protein is a CDS.
479+
/*
477480
if (parentSequence != null) {
478481
return parentSequence.getCompoundSet();
479482
}
483+
*/
480484
return null;
481485

482486

@@ -495,9 +499,11 @@ private SequenceReader<C> getSequenceStorage() {
495499
if (sequenceStorage != null) {
496500
return sequenceStorage;
497501
}
502+
/*
498503
if (parentSequence != null) {
499504
return parentSequence.getSequenceStorage();
500505
}
506+
*/
501507
return null;
502508
}
503509

0 commit comments

Comments
 (0)