Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616616
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:00:27+00:00 2026-05-22T02:00:27+00:00

I know that the are some changes planned regarding case classes, like disallowing inheritance

  • 0

I know that the are some changes planned regarding case classes, like disallowing inheritance between them:

scala> case class Foo()
defined class Foo

scala> case class Bar() extends Foo()
<console>:9: warning: case class `class Bar' has case ancestor `class Foo'.  Case-to-case inheritance has potentially dangerous bugs which are unlikely to be fixed.  You are strongly encouraged to instead use extractors to pattern match on non-leaf nodes.
       case class Bar() extends Foo()
                  ^
defined class Bar

or case classes without parameter list (not sure about that):

scala> case class Foo
<console>:1: warning: case classes without a parameter list have been deprecated;
use either case objects or case classes with `()' as parameter list.
       case class Foo
                     ^
<console>:7: warning: case classes without a parameter list have been deprecated;
use either case objects or case classes with `()' as parameter list.
       case class Foo
                     ^
defined class Foo

What else is currently @deprecated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:00:28+00:00Added an answer on May 22, 2026 at 2:00 am

    Every class in Scala must have at least one non-implicit parameter section. If you don’t include one, the compiler will add it for you.

    scala> class X
    defined class X
    
    scala> new X()
    res4: X = X@68003589
    
    scala> class Y
    defined class Y
    
    scala> new Y()
    res5: Y = Y@467f788b
    

    Case classes are no exception. But the interaction with pattern matching is a source of confusion and bugs, which motivates the deprecation.

    scala> case class A
    <console>:1: warning: case classes without a parameter list have been deprecated;
    use either case objects or case classes with `()' as parameter list.
           case class A
                       ^
    defined class A
    
    scala> val a = A()
    a: A = A()
    
    scala> (a: Any) match { case A => 1; case _ => 2 }
    res0: Int = 2
    
    scala> val companion = A
    companion: A.type = A
    
    scala> (companion: Any) match { case A => 1; case _ => 2 }
    res0: Int = 1
    

    As Dean suggests, it’s usually better to model this with a case object.

    I’m not aware of a timeline for removing support for empty-param list case classes. Case class inheritance was almost removed in 2.9.0, but that has been deferred until the next major release.

    Further Reading:

    Why can't the first parameter list of a class be implicit?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that Sql Server has some handy built-in quarterly stuff, but what about
I know that Internet Explorer has some proprietary extensions so that you can do
We all know that RAW pointers need to be wrapped in some form of
I know that this is subjective and all, but still, can you provide some
What libraries/methods do you know of that can do some basic HTML representation in
So, I know that try/catch does add some overhead and therefore isn't a good
I need to have some information about the scoping in JavaScript. I know that
I am working on some code coverage for my applications. Now, I know that
I received some text that is encoded, but I don't know what charset was
So a column will hold some text that beforehand I won't know how long

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.