DEV Community

Cover image for Huge changes in Java and C# planned for April 1st!
Mehran Davoudi
Mehran Davoudi

Posted on • Edited on

Huge changes in Java and C# planned for April 1st!

Finally, after a long discussion between C# language team and Java language team, they have decided to drop the support for the famous keyword: new.

// Not a valid code anymore.  
Person p = new Person();

// New dependency injection syntax.  
Person p = new.Resolve<Person>();
Enter fullscreen mode Exit fullscreen mode

Anders Hejlsberg and James Gosling both have told they are very happy about this, as it is the first time Java and C# language teams collaborate on a huge decision like this.

It is interesting to know that Jon Skeet has already started answering the related question on StackOverflow and gained another 200K even before the spec is fully finalized. After all, he is the only one who is a little familiar with both languages!

Rumors say that Eric Lippert is unhappy with this feature and is preparing a post on FAIC to describe why this was not a good decision to take.

BTW, as it is a huge breaking change and it's so difficult to notify all developers about it, Scott Hanselman is going to notify all developers on all planets by a tweet with his account.

As this decision is made on April 1st, the plan to deliver this feature is going to be as fast as possible for each language:

  • C#: As Visual Studio 2023 is going to ship on April 2nd, Mads Torgersen himself has added this feature to the compiler and it would be shipped with Visual Studio 2023. So, you can start using it tomorrow.
  • Java: As the compiler source code is in C++ it would take so much longer to implement. According to the plans, this feature will be released as a part of Java 25 which is planned to release somewhere in 2025.

For more detail on how this huge change would be applied on April 1st, Check this wiki page:

New spec for 'new' keyword on C# and Java

Top comments (0)