8016607: javac, avoid analyzing lambdas for source 7 compilation
Reviewed-by: jjg
Contributed-by: maurizio.cimadamore@oracle.com
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Mon Jun 17 20:29:31 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Jun 18 18:57:52 2013 +0100
@@ -1435,11 +1435,13 @@
env.tree = transTypes.translateTopLevelClass(env.tree, localMake);
compileStates.put(env, CompileState.TRANSTYPES);
- if (shouldStop(CompileState.UNLAMBDA))
- return;
+ if (source.allowLambda()) {
+ if (shouldStop(CompileState.UNLAMBDA))
+ return;
- env.tree = lambdaToMethod.translateTopLevelClass(env, env.tree, localMake);
- compileStates.put(env, CompileState.UNLAMBDA);
+ env.tree = lambdaToMethod.translateTopLevelClass(env, env.tree, localMake);
+ compileStates.put(env, CompileState.UNLAMBDA);
+ }
if (shouldStop(CompileState.LOWER))
return;