Calling Wrong Method

Gregory R. Warnes warnes@biostat.washington.edu
Fri May 19 07:27:00 GMT 2000


OK, I hardcoded all of the stull I was using gnuopt to set and ran the
program under gdb.  Now I have something *really*wierd* happening....

Method calls are being resolved to the WRONG METHOD !!!

When the code reaches
org.omegahat.Simulation.MCMC.Dissertation.Paper1.OneModeTarget.trueCov,
which is

public double[][] trueCov()
{
    return ((MVNormal) target).getCovariance();
}

The call ends up in:

org.omegahat.Probability.Distributions.MVNormal.PDF (this=@81fd580,
x=@8223420, mean=@82208c0, cov=@c)

public double PDF( double[] x, double[] mean, double[][] cov )
{
    checkConformity( x, mean, cov );
    
    return dnorm(x,mean,cov);
}


This is the WRONG METHOD!  Correct class, wrong name, wrong arguments.

BTW, I get the same method call problem when I'm not running under gdb.  
I can tell because checkConformity() checks its arguments, which are trash
and throws a RuntimeException resulting in a core dump and stack trace.


My only guess is that I'm overloading something in the compiler because
I'm doing a single massive compile command, passing all of the source
files to gcj at once.

I'm working on getting my stuff packed up so you can have the actual code
to work on....

-Greg


------------ GDB Backtrace

#0  org.omegahat.Probability.Distributions.MVNormal.PDF (this=@81fd580,
x=@8223420, mean=@82208c0, cov=@c) at
Probability/Distributions/MVNormal.java:394
#1  0x807852d in
org.omegahat.Simulation.MCMC.Dissertation.Paper1.OneModeTarget.trueCov
() at
org/omegahat/Simulation/MCMC/Dissertation/Paper1/OneModeTarget.java:46
#2  0x8080442 in
org.omegahat.Simulation.MCMC.Dissertation.Paper1.Simulate.setupTarget
() at org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:499
#3  0x80789f9 in
org.omegahat.Simulation.MCMC.Dissertation.Paper1.Simulate.Simulate () at
org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:974
#4  0x80799a6 in
org.omegahat.Simulation.MCMC.Dissertation.Paper1.Simulate.main () at
org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:1040
#5  0x4014dec5 in gnu::gcj::runtime::FirstThread::run (this=@81a5ea0) at
../../../libgcj/libjava/gnu/gcj/runtime/natFirstThread.cc:146
#6  0x40158a2b in java::lang::Thread::run_ (obj=@81a5ea0) at
../../../libgcj/libjava/java/lang/natThread.cc:263
#7  0x40168e7e in _Jv_ThreadStart (thread=@81a5ea0, meth=0x40158860
<java::lang::Thread::run_(java::lang::Object *) at
../../../libgcj/libjava/java/lang/natThread.cc:205>) at
../../../libgcj/libjava/no-threads.cc:28
#8  0x40158b60 in java::lang::Thread::start (this=@81a5ea0) at
../../../libgcj/libjava/java/lang/natThread.cc:294
#9  0x400afd8c in JvRunMain (klass=@814cc80, argc=1, argv=@bffff6e4) at
../../../libgcj/libjava/prims.cc:867
#10 0x812d9cd in main (argc=1, argv=@bffff6e4) at /tmp/ccveHkVGmain.i:11


------------- Runtime Exception

hydra:~/sandbox> ./Simulate 
Started at: Fri May 19 14:14:50 GMT 2000
java.lang.RuntimeException: Object passed to PDF does not conform to
length of mean vector.
   at 0x400fccf4: java::lang::Throwable::Throwable(java::lang::String
*) (/usr/lib/libgcj.so.1)
   at 0x400f0561: java::lang::Exception::Exception(java::lang::String
*) (/usr/lib/libgcj.so.1)
   at
0x400f5089: java::lang::RuntimeException::RuntimeException(java::lang::String
*) (/usr/lib/libgcj.so.1)
   at
0x0805f3f5: org::omegahat::Probability::Distributions::MVNormal::checkConformity(JArray<double>
*, JArray<double> *, JArray<JArray<double> *>
*) (/home/warnes/sandbox/Probability/Distributions/MVNormal.java:379)
   at
0x0805f4be: org::omegahat::Probability::Distributions::MVNormal::PDF(JArray<double>
*, JArray<double> *, JArray<JArray<double> *>
*) (/home/warnes/sandbox/Probability/Distributions/MVNormal.java:394)
   at
0x0807852d: org::omegahat::Simulation::MCMC::Dissertation::Paper1::OneModeTarget::trueCov(void) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/OneModeTarget.java:46)
   at
0x08080442: org::omegahat::Simulation::MCMC::Dissertation::Paper1::Simulate::setupTarget(void) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:499)
   at
0x080789f9: org::omegahat::Simulation::MCMC::Dissertation::Paper1::Simulate::Simulate(JArray<java::lang::String
*>
*) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:974)
   at
0x080799a6: org::omegahat::Simulation::MCMC::Dissertation::Paper1::Simulate::main(JArray<java::lang::String
*>
*) (/home/warnes/sandbox/org/omegahat/Simulation/MCMC/Dissertation/Paper1/Simulate.java:1040)
   at
0x4014dec5: gnu::gcj::runtime::FirstThread::run(void) (/usr/lib/libgcj.so.1)
   at 0x40158a2b: java::lang::Thread::run_(java::lang::Object
*) (/usr/lib/libgcj.so.1)
   at 0x40168e7e: _Jv_ThreadStart(java::lang::Thread *, int *, void
(*)(java::lang::Thread *)) (/usr/lib/libgcj.so.1)
   at 0x40158b60: java::lang::Thread::start(void) (/usr/lib/libgcj.so.1)
   at 0x400afd8c: JvRunMain (/usr/lib/libgcj.so.1)
   at 0x0812d9cd: main (/tmp/ccveHkVGmain.i:11)
   at 0x4028ba42: __libc_start_main (/lib/libc.so.6)
   at 0x0804c501: _start (??:0)










More information about the Java mailing list