# Proposal to disallow class shadowing

**URL:** <https://contributors.scala-lang.org/t/proposal-to-disallow-class-shadowing/2831>\
**Category:** Scala Improvement Process\
**Created:** [February 11, 2019, 1:19pm UTC](https://contributors.scala-lang.org/t/proposal-to-disallow-class-shadowing/2831 "2019-02-11T13:19:39Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![AMatveev](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/amatveev/32/847_2.png) [@AMatveev](https://contributors.scala-lang.org/u/AMatveev)\
**Post date:** [February 22, 2019, 1:55pm UTC](https://contributors.scala-lang.org/t/proposal-to-disallow-class-shadowing/2831/12 "2019-02-22T13:55:43Z")

</div>

> [@odersky](#):
>
> That’s a good illustration of the point: They _don’t_ override each other, it just _looks this way_ .

Thank you, I have understood motivation.

> [@adriaanm](#):
>
> One question for clarification: will a name clash be allowed for a private class? Technically, those are handled differently (they are not inherited, obviously, and thus do not play part in overriding).

Would it be possible to implement ability which allows to disable inheritance but use such traits from others classes? for example:

```auto
class Bfb_InventoryOrderDvi extends View {

  isolated trait Default extends View.Default{
    
  }
  isolated trait List extends Default with View.List
}

class Bfb_InventoryOrderAvi extends Bfb_InventoryOrderDvi {
  import no_shadowing.{Bfb_InventoryOrderDvi => Super}
  isolated trait Default extends Super.Default{
  }
  isolated trait List extends Default with Super.List
}

```

Otherwise with such proposal we will have to add class name prefix to inner trait or use object. In any case it will not be very comfortable.

---

_[View the full topic](https://contributors.scala-lang.org/t/proposal-to-disallow-class-shadowing/2831)._
