Hi Gerald,
On Fri, 15 Mar 2013, Gerald Ruiner Torgersen wrote:
> I started to use the Fiji version of ImageJ recently and am very satisfied
> with it. But suddenly I had a problem to compile some plugins I am working
> with. It seems that the class Line has disappeared. The files compile without
> problem in standard ImageJ. Here is the error message I get:
>
> C:\Program
> Files\ImageJ\plugins\RoengenologicalAttachmentLevelAnalyzer\RoengenologicalAttachmentLevelAnalyzer_.java:189:
> cannot find symbol
> symbol : constructor Line(double,double,double,double)
> location: class Line
> Line l = new Line(3.0, 3.0, 3.0, 3.0);
>
> Has anybody else noticed that?
We discussed this recently on fiji-devel, no? But maybe you fell out of
the Cc: list somewhere in the discussion. I am sorry if that was the case.
The problem is that the Volume_Viewer version 2.0 has a "Line" class that
is in the default package.
That is where evil imports come in: if you use "import ij.gui.*;", the
preference is still to take the Line class from the default package rather
than from the ij.gui package (because you cannot import classes explicitly
from the default package).
Wildcard imports are evil in another sense, too: you will get surprises
when a class vanished from its package but now another package's class of
the same name is used instead.
Take home message: only use wildcard imports for quick and dirty
programming, if you must. It incurs a technical debt (that will come back
to bite you, typically at the most inconvenient time) though, so you
really want to avoid them.
Ciao,
Johannes
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html