Add docs for Java-style non-static inner class instantiation
diff --git a/src/spec/doc/core-differences-java.adoc b/src/spec/doc/core-differences-java.adoc
index 1170704..d61c6f1 100644
--- a/src/spec/doc/core-differences-java.adoc
+++ b/src/spec/doc/core-differences-java.adoc
@@ -186,7 +186,7 @@
include::{projectdir}/src/spec/test/DifferencesFromJavaTest.groovy[tags=innerclass_3_java,indent=0]
----------------------------------
-Groovy doesn't support the `y.new X()` syntax. Instead, you have to write `new X(y)`, like in the code below:
+Before 3.0.0, Groovy doesn't support the `y.new X()` syntax. Instead, you have to write `new X(y)`, like in the code below:
[source,groovy]
----------------------------------
@@ -201,6 +201,9 @@
example. Since this might also be the regular way we have not yet found
a good way to prevent this problem.
+[NOTE]
+Groovy 3.0.0 supports Java style syntax for creating instances of non-static inner classes.
+
== Lambda expressions and the method reference operator
Java 8+ supports lambda expressions and the method reference operator (`::`):
diff --git a/src/spec/doc/core-object-orientation.adoc b/src/spec/doc/core-object-orientation.adoc
index 0ff7be4..a4a3657 100644
--- a/src/spec/doc/core-object-orientation.adoc
+++ b/src/spec/doc/core-object-orientation.adoc
@@ -144,6 +144,22 @@
Note that the class `Inner2` is defined only to provide an implementation of the method `run` to class `Outer2`. Anonymous inner classes help to eliminate verbosity in this case.
+Since Groovy 3.0.0, Java syntax for non-static inner class instantiation is now supported, for example:
+
+[source,groovy]
+--------------------------------------
+class Computer {
+ class Cpu {
+ int coreNumber
+
+ Cpu(int coreNumber) {
+ this.coreNumber = coreNumber
+ }
+ }
+}
+
+assert 4 == new Computer().new Cpu(4).coreNumber
+--------------------------------------
===== Anonymous inner class