MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Bug in JavaBlock (or in JavaBlock documentation)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56211] Bug in JavaBlock (or in JavaBlock documentation)
  • From: "J. McKenzie Alexander" <jalex at lse.ac.uk>
  • Date: Tue, 19 Apr 2005 04:55:18 -0400 (EDT)
  • References: <200504180708.DAA20033@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I think this is a bug in JavaBlock, but it could merely be a mistake in 
the documentation.

The docs for JavaBlock state: "JavaBlock[expr] causes all new Java 
objects returned to Mathematica during
the evaluation of expr to be released when expr finishes."  However, if 
you evaluate the following:

Scan[ReleaseJavaObject,PeekObjects[]];
JavaBlock[
   JavaNew["javax.swing.JProgressBar"]
   ]
PeekObjects[]

You'll see that the list of objects returned by PeekObjects[] contains 
exactly one object - the JProgressBar created by the one call to 
JavaNew, in which case it's not true that "all new Java objects 
returned to Mathematica during the evaluation of expr [are] released 
when expr finishes".

FWIW, I'd prefer JavaBlock behave the way it's described in the docs, 
since then one doesn't have to worry about the odd exception generated 
by having expr return a Java object instead of some other value.

Cheers,

Jason


  • References:
    • Bug in UI?
      • From: "Matt" <anonmous69@netscape.net>
  • Prev by Date: Re: Typesetting Mathematica code
  • Next by Date: Re: Integrate is driving me crazy, please help!
  • Previous by thread: Bug in UI?
  • Next by thread: Re: Bug in UI?