Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
import beast.base.core.Log;
import beast.base.evolution.alignment.Alignment;
import beast.base.evolution.alignment.TaxonSet;
import beast.base.evolution.tree.MRCAPrior;
import beast.base.evolution.tree.Node;
import beast.base.evolution.tree.TraitSet;
import beast.base.evolution.tree.Tree;
import beast.base.evolution.tree.coalescent.PopulationFunction;
import beast.base.inference.StateNode;
import beast.base.inference.StateNodeInitialiser;
import beast.base.inference.distribution.ParametricDistribution;
import beast.base.spec.domain.PositiveReal;
import beast.base.spec.evolution.tree.MRCAPrior;
import beast.base.spec.inference.distribution.ScalarDistribution;
import beast.base.spec.type.RealScalar;
import beast.base.util.HeapSort;
import beast.base.util.Randomizer;
Expand Down Expand Up @@ -87,7 +87,7 @@ public String toString() {
List<Set<String>> taxonSets;

// list of parametric distribution constraining the MRCA of taxon sets, null if not present
List<ParametricDistribution> distributions;
List<ScalarDistribution> distributions;

// hard bound for the set, if any
List<Bound> m_bounds;
Expand Down Expand Up @@ -224,7 +224,7 @@ public void initStateNodes() {
}
usedTaxa.add(taxonID);
}
final ParametricDistribution distr = prior.distInput.get();
final ScalarDistribution distr = prior.distInput.get();
final Bound bounds = new Bound();
if (distr != null) {
List<BEASTInterface> beastObjects = new ArrayList<>();
Expand All @@ -233,8 +233,8 @@ public void initStateNodes() {
beastObjects.get(i).initAndValidate();
}
try {
double tLow = distr.inverseCumulativeProbability(0.0);
double tHi = distr.inverseCumulativeProbability(1.0);
double tLow = ((Number) distr.inverseCumulativeProbability(0.0)).doubleValue();
double tHi = ((Number) distr.inverseCumulativeProbability(1.0)).doubleValue();
bounds.lower = getDate(tLow);
bounds.upper = getDate(tHi);
if (bounds.lower > bounds.upper && tLow < tHi) {
Expand Down
20 changes: 20 additions & 0 deletions beast-base/src/test/java/test/beast/core/LoggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,28 @@
public class LoggerTest {
Logger logger;

/**
* Logger.sampleOffset is protected static, so it is not reachable from this package
* directly; a subclass can reach it because protected static members are inherited
* regardless of package.
*/
private static class LoggerGlobals extends Logger {
static void reset() {
Logger.sampleOffset = -1;
}
}

@BeforeEach
public void setUp() throws Exception {
// file.name.prefix, Logger.FILE_MODE and Logger.sampleOffset are JVM-wide globals
// that the integration tests set and do not restore (see XMLPathUtil.setUpOutputDir
// and ResumeTest). Whether this class runs before or after them varies between
// surefire runs, which made testFileLog fail intermittently: a stale prefix sends
// the log to <prefix>beast.log while the assertions resolve "beast.log" against the
// working directory, and a stale sampleOffset is added to every logged sample.
System.clearProperty("file.name.prefix");
Logger.FILE_MODE = Logger.LogFileMode.only_new;
LoggerGlobals.reset();
logger = new Logger();
}

Expand Down
Loading