This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Case class with companion object gives error in Scala for Netbeans 2.8 RC1

4 replies
tolsen77
Joined: 2008-10-08,
User offline. Last seen 1 year 38 weeks ago.
Is there a known problem with adding companion objects to case classes in Scala 2.8.0? Scala for Netbeans currently flags this as an error saying it's a duplicate definition.

Error messages:
 - constructor definition not allowed here
 - constructor <classname> defined twice

My current install is:
 - Scala 2.8.0 beta1 rc2
 - Scala for Netbeans 6.8 1.1.0 rc1
 - Netbeans 6.8 rc1

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 1 hour ago.
Re: [netbeans] Case class with companion object gives error in

On Sunday 29 November 2009 05:21:09 Trond Olsen wrote:
> Is there a known problem with adding companion objects to case classes in
> Scala 2.8.0? Scala for Netbeans currently flags this as an error saying
> it's a duplicate definition.
>
> *Error messages:*
> - constructor definition not allowed here
> - constructor defined twice
>
> *My current install is:*
> - Scala 2.8.0 beta1 rc2
> - Scala for Netbeans 6.8 1.1.0 rc1
> - Netbeans 6.8 rc1
>

I have met the problem also (and have reported to Caoyuan).

(please, add [netbeans] to a subject for NB-related topics)

Andrew

Caoyuan
Joined: 2009-01-18,
User offline. Last seen 42 years 45 weeks ago.
Re: [netbeans] Case class with companion object gives error in
Caoyuan
Joined: 2009-01-18,
User offline. Last seen 42 years 45 weeks ago.
Re: [netbeans] Case class with companion object gives error in

BTW, you should be careful here since case class has a default
companion object.

On Sun, Nov 29, 2009 at 3:41 PM, Caoyuan wrote:
> This is a strange error that I encountered also when I tried to build
> scala trunk for jvm-5 on my Mac OSX. I'm not sure where is from yet,
> but, for NetBeans users, you can try to put the object code
> behind/below/after the class code as a quick tip.
>
>
> On Sun, Nov 29, 2009 at 3:22 PM, Andrew Gaydenko wrote:
>> On Sunday 29 November 2009 05:21:09 Trond Olsen wrote:
>>> Is there a known problem with adding companion objects to case classes in
>>> Scala 2.8.0? Scala for Netbeans currently flags this as an error saying
>>>  it's a duplicate definition.
>>>
>>> *Error messages:*
>>>  - constructor definition not allowed here
>>>  - constructor defined twice
>>>
>>> *My current install is:*
>>>  - Scala 2.8.0 beta1 rc2
>>>  - Scala for Netbeans 6.8 1.1.0 rc1
>>>  - Netbeans 6.8 rc1
>>>
>>
>> I have met the problem also (and have reported to Caoyuan).
>>
>> (please, add [netbeans] to a subject for NB-related topics)
>>
>>
>> Andrew
>>
>

tolsen77
Joined: 2008-10-08,
User offline. Last seen 1 year 38 weeks ago.
Re: [netbeans] Case class with companion object gives error in
Thanks. Changing the order of case class and companion object works fine.

Could the problem somehow be related to ticket #1015 when IDE support was integrated into the Scala 2.8.0 compiler?

On Sun, Nov 29, 2009 at 8:41 AM, Caoyuan <dcaoyuan@gmail.com> wrote:
This is a strange error that I encountered also when I tried to build
scala trunk for jvm-5 on my Mac OSX. I'm not sure where is from yet,
but, for NetBeans users, you can try to put the object code
behind/below/after the class code as a quick tip.


On Sun, Nov 29, 2009 at 3:22 PM, Andrew Gaydenko <a@gaydenko.com> wrote:
> On Sunday 29 November 2009 05:21:09 Trond Olsen wrote:
>> Is there a known problem with adding companion objects to case classes in
>> Scala 2.8.0? Scala for Netbeans currently flags this as an error saying
>>  it's a duplicate definition.
>>
>> *Error messages:*
>>  - constructor definition not allowed here
>>  - constructor <classname> defined twice
>>
>> *My current install is:*
>>  - Scala 2.8.0 beta1 rc2
>>  - Scala for Netbeans 6.8 1.1.0 rc1
>>  - Netbeans 6.8 rc1
>>
>
> I have met the problem also (and have reported to Caoyuan).
>
> (please, add [netbeans] to a subject for NB-related topics)
>
>
> Andrew
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland