IllegalStateException: Duplicate class

10 views
Skip to first unread message

Chris Cannam

unread,
Feb 25, 2013, 4:41:39 PM2/25/13
to yeti-lang
Since rev b0fbff31 (Avoid upper/lowercase dups on generated classes) I
am getting a duplicate class exception with (previously working) code
that defines a Java class with the same name as, but different case
from, a module name.

e.g. something like test.yeti

module test;
class Test(int n)
int getN()
n,
end;
newT n is number -> ~Test = new Test(n);
getN t is ~Test -> number = t#getN();
{ newT, getN }

will blow up with

java.lang.IllegalStateException: Duplicate class: Test
at yeti.lang.compiler.Compiler.addClass(Compiler.java:607)
at yeti.lang.compiler.Ctx.newClass(YetiCode.java:190)
at yeti.lang.compiler.JavaClass.gen(JavaClass.java:436)

etc.

Is this supposed to be allowed?

(For what it's worth, in my real code the Java class is hidden behind
an opaque typedef in the module interface -- it's not supposed to be
visible -- so I could just rename it in this instance if need be)


Chris

Madis

unread,
Feb 26, 2013, 6:47:40 AM2/26/13
to yeti-lang

On Mon, 25 Feb 2013, Chris Cannam wrote:

> Since rev b0fbff31 (Avoid upper/lowercase dups on generated classes) I
> am getting a duplicate class exception with (previously working) code
> that defines a Java class with the same name as, but different case
> from, a module name.

It's a bad idea to do it - on case-insensitive filesystem (like Windows
filesystems, and I guess MacOS X HFS+ also) it wouldn't work anyway.
That's the reason for the check (but the error message needs improving).

Chris Cannam

unread,
Feb 26, 2013, 6:50:17 AM2/26/13
to yeti...@googlegroups.com
On 26 February 2013 11:47, Madis <ma...@cyber.ee> wrote:
> It's a bad idea to do it - on case-insensitive filesystem (like Windows
> filesystems, and I guess MacOS X HFS+ also) it wouldn't work anyway.

Right-o. I'm not sure it's self-evident that Java classes and Yeti
modules will occupy the same filesystem namespace, but given that
that's the way it is, I'll just rename the class. Thanks!


Chris
Reply all
Reply to author
Forward
0 new messages