@@ -6,11 +6,15 @@ Retrolambda: Use Lambdas on Java 7
6
6
7
7
Just as there was [ Retroweaver] ( http://retroweaver.sourceforge.net/ ) et al.
8
8
for running Java 5 code with generics on Java 1.4, ** Retrolambda** lets you
9
- run Java 8 code with lambda expressions and method references on Java 7 or
10
- lower. It does this by transforming your Java 8 compiled bytecode so that
11
- it can run on a Java 7 runtime. After the transformation they are just a
12
- bunch of normal .class files, without any additional runtime dependencies.
13
- [ Read more details] ( #backported-language-features ) .
9
+ run Java 8 code with ** lambda expressions** and ** method references** on
10
+ Java 7 or lower. It does this by transforming your Java 8 compiled bytecode
11
+ so that it can run on a Java 7 runtime. After the transformation they are
12
+ just a bunch of normal .class files, without any additional runtime
13
+ dependencies. [ Read more details] ( #backported-language-features ) .
14
+
15
+ There is also [ limited support] ( #known-limitations ) for backporting
16
+ ** default methods** and ** static methods on interfaces** . This feature is
17
+ disabled by default.
14
18
15
19
Adventurous developers may use Retrolambda to backport lambda expressions
16
20
even to Java 6 or Java 5. And if you reach Java 5, there are [ other
@@ -101,9 +105,10 @@ Optional system properties:
101
105
Default value is 51 (i.e. Java 7)
102
106
103
107
retrolambda.defaultMethods
104
- Whether to backport default and static methods on interfaces.
108
+ Whether to backport default methods and static methods on interfaces.
105
109
LIMITATIONS: All backported interfaces and all classes which implement
106
- them must be backported together with one execution of Retrolambda.
110
+ them or call their static methods must be backported together,
111
+ with one execution of Retrolambda.
107
112
Disabled by default. Enable by setting to "true"
108
113
109
114
retrolambda.outputDir
@@ -156,13 +161,27 @@ expressions and they are backported in the same way.
156
161
If you would like the suppressed exceptions to be logged instead of
157
162
swallowed, please create a feature request and we'll make it configurable.
158
163
164
+ * Optionally also:*
165
+
166
+ ** Default methods** are backported by moving the default methods to a
167
+ companion class (interface name + "$") as static methods, and by adding the
168
+ necessary method implementations to all classes which implement that
169
+ interface.
170
+
171
+ ** Static methods on interfaces** are backported by moving the static
172
+ methods to a companion class (interface name + "$"), and by changing all
173
+ methods calls to call the new method location.
174
+
159
175
160
176
Known Limitations
161
177
-----------------
162
178
163
179
Does not backport Java 8 APIs.
164
180
165
- Does not backport Java 8 language features other than lambda expressions.
181
+ Backporting default methods and static methods on interfaces requires all
182
+ backported interfaces and all classes which implement them or call their
183
+ static methods to be backported together, with one execution of
184
+ Retrolambda.
166
185
167
186
May break if a future JDK 8 build stops generating a new class for each
168
187
` invokedynamic ` call. Retrolambda works so that it captures the bytecode
0 commit comments