FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 1199 : Confusing errors if a sketch defines a class with same name as the sketch
Last modified: 2009-11-29 08:40
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
ASSIGNED
Resolution:
-
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
cloister
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2009-03-11 13:13
This is with Processing 1.0.1 on Windows XP.
Repro:
1. Load Processing with a new sketch.
2. Add some code that defines a class:
void setup()
{
size(400,400);
}
void draw()
{
background(0);
stroke(255);
Foo f = new Foo(10);
point(f.getX(), f.getX());
}
class Foo
{
int x;
Foo(int X) { x = X; }
int getX() { return x; }
}
3. Run it to verify that it works.
4. Save As, and enter then name "Foo".
5. Exit Processing.
6. Navigate to My Documents\Processing\Foo, and double-click Foo.pde
7. Click the Run button.
Result:
"The constructor Foo(int) is undefined" shows up in the PDE's output bar above the
console area.
I can see why, in hindsight, this would happen. But it would be nice if the error
message were clearer ("Error: class Foo has same name as applet" or whatever), or if
the PDE issued a warning in the Save As process if you happen to choose that name.
Additional Comment
#1 From fry 2009-11-29 08:40
***
Bug 1294
has been marked as a duplicate of this bug. ***
This bug is now being tracked
here
.