changeset 14547:86d8d242b0c4

8003280: Add lambda tests Summary: Turn on lambda expression, method reference and default method support Reviewed-by: jjg
author mcimadamore
date Sat, 17 Nov 2012 19:01:03 +0000
parents 7e2a1569de76
children aa687b312c97
files langtools/src/share/classes/com/sun/tools/javac/code/Flags.java langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java langtools/src/share/classes/com/sun/tools/javac/code/Types.java langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java langtools/src/share/classes/com/sun/tools/javac/comp/Check.java langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java langtools/src/share/classes/com/sun/tools/javac/util/Warner.java langtools/test/tools/javac/conditional/Conditional.java langtools/test/tools/javac/defaultMethods/ClassReaderTest/ClassReaderTest.java langtools/test/tools/javac/defaultMethods/Neg01.java langtools/test/tools/javac/defaultMethods/Neg02.java langtools/test/tools/javac/defaultMethods/Neg03.java langtools/test/tools/javac/defaultMethods/Neg04.java langtools/test/tools/javac/defaultMethods/Neg05.java langtools/test/tools/javac/defaultMethods/Neg06.java langtools/test/tools/javac/defaultMethods/Neg07.java langtools/test/tools/javac/defaultMethods/Neg08.java langtools/test/tools/javac/defaultMethods/Neg09.java langtools/test/tools/javac/defaultMethods/Neg10.java langtools/test/tools/javac/defaultMethods/Neg11.java langtools/test/tools/javac/defaultMethods/Neg12.java langtools/test/tools/javac/defaultMethods/Neg12.out langtools/test/tools/javac/defaultMethods/Neg13.java langtools/test/tools/javac/defaultMethods/Neg14.java langtools/test/tools/javac/defaultMethods/Neg15.java langtools/test/tools/javac/defaultMethods/Neg16.java langtools/test/tools/javac/defaultMethods/Pos01.java langtools/test/tools/javac/defaultMethods/Pos02.java langtools/test/tools/javac/defaultMethods/Pos04.java langtools/test/tools/javac/defaultMethods/Pos05.java langtools/test/tools/javac/defaultMethods/Pos06.java langtools/test/tools/javac/defaultMethods/Pos07.java langtools/test/tools/javac/defaultMethods/Pos08.java langtools/test/tools/javac/defaultMethods/Pos10.java langtools/test/tools/javac/defaultMethods/Pos11.java langtools/test/tools/javac/defaultMethods/Pos12.java langtools/test/tools/javac/defaultMethods/Pos13.java langtools/test/tools/javac/defaultMethods/Pos14.java langtools/test/tools/javac/defaultMethods/Pos15.java langtools/test/tools/javac/defaultMethods/Pos16.java langtools/test/tools/javac/defaultMethods/TestDefaultBody.java langtools/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java langtools/test/tools/javac/defaultMethods/fd/FDTest.java langtools/test/tools/javac/defaultMethods/separate/Separate.java langtools/test/tools/javac/defaultMethods/super/TestDefaultSuperCall.java langtools/test/tools/javac/defaultMethods/syntax/TestDefaultMethodsSyntax.java langtools/test/tools/javac/diags/examples/CantAccessArgTypeInFunctionalDesc.java langtools/test/tools/javac/diags/examples/CantAccessInnerClsConstr.java langtools/test/tools/javac/diags/examples/CantAccessReturnTypeInFunctionalDesc.java langtools/test/tools/javac/diags/examples/CantAccessThrownTypesInFunctionalDesc.java langtools/test/tools/javac/diags/examples/CantApplySymbolFragment.java langtools/test/tools/javac/diags/examples/CantApplySymbolsFragment.java langtools/test/tools/javac/diags/examples/CantRefNonEffectivelyFinalVar.java langtools/test/tools/javac/diags/examples/CantResolveLocationArgsFragment.java langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParamsFragment.java langtools/test/tools/javac/diags/examples/CantReturnValueForVoid.java langtools/test/tools/javac/diags/examples/ConditionalTargetCantBeVoid.java langtools/test/tools/javac/diags/examples/CyclicInference.java langtools/test/tools/javac/diags/examples/DefaultOverridesObjectMember.java langtools/test/tools/javac/diags/examples/IncompatibleAbstracts.java langtools/test/tools/javac/diags/examples/IncompatibleArgTypesInLambda.java langtools/test/tools/javac/diags/examples/IncompatibleDescsInFunctionalIntf.java langtools/test/tools/javac/diags/examples/IncompatibleRetTypeInLambda.java langtools/test/tools/javac/diags/examples/IncompatibleRetTypeInMref.java langtools/test/tools/javac/diags/examples/IncompatibleThrownTypesInLambda.java langtools/test/tools/javac/diags/examples/IncompatibleThrownTypesInMref.java langtools/test/tools/javac/diags/examples/IncompatibleTypesInConditional.java langtools/test/tools/javac/diags/examples/InvalidGenericDescInFunctionalInterface.java langtools/test/tools/javac/diags/examples/LocalVarNeedsFinal.java langtools/test/tools/javac/diags/examples/MissingReturnValue.java langtools/test/tools/javac/diags/examples/MissingReturnValueFragment.java langtools/test/tools/javac/diags/examples/NoAbstracts.java langtools/test/tools/javac/diags/examples/NoSuitableFunctionalIntfInst.java langtools/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java langtools/test/tools/javac/diags/examples/NotAFunctionalIntf.java langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessFragment.java langtools/test/tools/javac/diags/examples/OverriddenDefault.java langtools/test/tools/javac/diags/examples/PotentialLambdaFound.java langtools/test/tools/javac/diags/examples/RedundantSupertype.java langtools/test/tools/javac/diags/examples/RefAmbiguousFragment.java langtools/test/tools/javac/diags/examples/TypesIncompatibleAbstractDefault.java langtools/test/tools/javac/diags/examples/TypesIncompatibleUnrelatedDefaults.java langtools/test/tools/javac/diags/examples/UnexpectedLambda.java langtools/test/tools/javac/diags/examples/UnexpectedMref.java langtools/test/tools/javac/diags/examples/UnexpectedReturnValue.java langtools/test/tools/javac/generics/7022054/T7022054pos1.java langtools/test/tools/javac/generics/7022054/T7022054pos1.out langtools/test/tools/javac/generics/7022054/T7022054pos2.java langtools/test/tools/javac/generics/7022054/T7022054pos2.out langtools/test/tools/javac/lambda/BadAccess.java langtools/test/tools/javac/lambda/BadAccess.out langtools/test/tools/javac/lambda/BadAccess02.java langtools/test/tools/javac/lambda/BadAccess02.out langtools/test/tools/javac/lambda/BadAccess03.java langtools/test/tools/javac/lambda/BadAccess03.out langtools/test/tools/javac/lambda/BadBreakContinue.java langtools/test/tools/javac/lambda/BadBreakContinue.out langtools/test/tools/javac/lambda/BadConv03.java langtools/test/tools/javac/lambda/BadConv03.out langtools/test/tools/javac/lambda/BadConv04.java langtools/test/tools/javac/lambda/BadConv04.out langtools/test/tools/javac/lambda/BadExpressionLambda.java langtools/test/tools/javac/lambda/BadExpressionLambda.out langtools/test/tools/javac/lambda/BadLambdaExpr.java langtools/test/tools/javac/lambda/BadLambdaPos.java langtools/test/tools/javac/lambda/BadLambdaPos.out langtools/test/tools/javac/lambda/BadMethodCall.java langtools/test/tools/javac/lambda/BadMethodCall.out langtools/test/tools/javac/lambda/BadRecovery.java langtools/test/tools/javac/lambda/BadRecovery.out langtools/test/tools/javac/lambda/BadReturn.java langtools/test/tools/javac/lambda/BadReturn.out langtools/test/tools/javac/lambda/BadStatementInLambda.java langtools/test/tools/javac/lambda/BadStatementInLambda.out langtools/test/tools/javac/lambda/BadStatementInLambda02.java langtools/test/tools/javac/lambda/BadStatementInLambda02.out langtools/test/tools/javac/lambda/BadTargetType.java langtools/test/tools/javac/lambda/BadTargetType.out langtools/test/tools/javac/lambda/Conditional01.java langtools/test/tools/javac/lambda/Conditional02.java langtools/test/tools/javac/lambda/Conditional03.java langtools/test/tools/javac/lambda/Conformance01.java langtools/test/tools/javac/lambda/Defender01.java langtools/test/tools/javac/lambda/DisjunctiveTypeTest.java langtools/test/tools/javac/lambda/EffectivelyFinal01.java langtools/test/tools/javac/lambda/EffectivelyFinal01.out langtools/test/tools/javac/lambda/EffectivelyFinalTest.java langtools/test/tools/javac/lambda/EffectivelyFinalTest01.out langtools/test/tools/javac/lambda/EffectivelyFinalTest02.out langtools/test/tools/javac/lambda/ErroneousArg.java langtools/test/tools/javac/lambda/ErroneousArg.out langtools/test/tools/javac/lambda/ErroneousLambdaExpr.java langtools/test/tools/javac/lambda/InnerConstructor.java langtools/test/tools/javac/lambda/LambdaCapture01.java langtools/test/tools/javac/lambda/LambdaCapture02.java langtools/test/tools/javac/lambda/LambdaCapture03.java langtools/test/tools/javac/lambda/LambdaCapture04.java langtools/test/tools/javac/lambda/LambdaCapture05.java langtools/test/tools/javac/lambda/LambdaCapture06.java langtools/test/tools/javac/lambda/LambdaConv01.java langtools/test/tools/javac/lambda/LambdaConv03.java langtools/test/tools/javac/lambda/LambdaConv05.java langtools/test/tools/javac/lambda/LambdaConv06.java langtools/test/tools/javac/lambda/LambdaConv08.java langtools/test/tools/javac/lambda/LambdaConv09.java langtools/test/tools/javac/lambda/LambdaConv09.out langtools/test/tools/javac/lambda/LambdaConv10.java langtools/test/tools/javac/lambda/LambdaConv10.out langtools/test/tools/javac/lambda/LambdaConv11.java langtools/test/tools/javac/lambda/LambdaConv12.java langtools/test/tools/javac/lambda/LambdaConv13.java langtools/test/tools/javac/lambda/LambdaConv16.java langtools/test/tools/javac/lambda/LambdaConv17.java langtools/test/tools/javac/lambda/LambdaConv18.java langtools/test/tools/javac/lambda/LambdaConv18.out langtools/test/tools/javac/lambda/LambdaConv19.java langtools/test/tools/javac/lambda/LambdaConv20.java langtools/test/tools/javac/lambda/LambdaConv21.java langtools/test/tools/javac/lambda/LambdaConv21.out langtools/test/tools/javac/lambda/LambdaConv22.java langtools/test/tools/javac/lambda/LambdaConv23.java langtools/test/tools/javac/lambda/LambdaConv24.java langtools/test/tools/javac/lambda/LambdaConversionTest.java langtools/test/tools/javac/lambda/LambdaEffectivelyFinalTest.java langtools/test/tools/javac/lambda/LambdaEffectivelyFinalTest.out langtools/test/tools/javac/lambda/LambdaExpr01.java langtools/test/tools/javac/lambda/LambdaExpr02.java langtools/test/tools/javac/lambda/LambdaExpr04.java langtools/test/tools/javac/lambda/LambdaExpr05.java langtools/test/tools/javac/lambda/LambdaExpr06.java langtools/test/tools/javac/lambda/LambdaExpr07.java langtools/test/tools/javac/lambda/LambdaExpr08.java langtools/test/tools/javac/lambda/LambdaExpr09.java langtools/test/tools/javac/lambda/LambdaExpr10.java langtools/test/tools/javac/lambda/LambdaExpr10.out langtools/test/tools/javac/lambda/LambdaExpr11.java langtools/test/tools/javac/lambda/LambdaExpr12.java langtools/test/tools/javac/lambda/LambdaExpr13.java langtools/test/tools/javac/lambda/LambdaExpr14.java langtools/test/tools/javac/lambda/LambdaExpr15.java langtools/test/tools/javac/lambda/LambdaExpr16.java langtools/test/tools/javac/lambda/LambdaExpr17.java langtools/test/tools/javac/lambda/LambdaExpr18.java langtools/test/tools/javac/lambda/LambdaExpr19.java langtools/test/tools/javac/lambda/LambdaExpr19.out langtools/test/tools/javac/lambda/LambdaExpr20.java langtools/test/tools/javac/lambda/LambdaExprNotVoid.java langtools/test/tools/javac/lambda/LambdaExprNotVoid.out langtools/test/tools/javac/lambda/LambdaParserTest.java langtools/test/tools/javac/lambda/LambdaScope01.java langtools/test/tools/javac/lambda/LambdaScope02.java langtools/test/tools/javac/lambda/LambdaScope03.java langtools/test/tools/javac/lambda/LambdaScope04.java langtools/test/tools/javac/lambda/LambdaScope04.out langtools/test/tools/javac/lambda/LocalBreakAndContinue.java langtools/test/tools/javac/lambda/MethodReference01.java langtools/test/tools/javac/lambda/MethodReference02.java langtools/test/tools/javac/lambda/MethodReference03.java langtools/test/tools/javac/lambda/MethodReference04.java langtools/test/tools/javac/lambda/MethodReference04.out langtools/test/tools/javac/lambda/MethodReference05.java langtools/test/tools/javac/lambda/MethodReference06.java langtools/test/tools/javac/lambda/MethodReference07.java langtools/test/tools/javac/lambda/MethodReference08.java langtools/test/tools/javac/lambda/MethodReference08.out langtools/test/tools/javac/lambda/MethodReference09.java langtools/test/tools/javac/lambda/MethodReference09.out langtools/test/tools/javac/lambda/MethodReference10.java langtools/test/tools/javac/lambda/MethodReference11.java langtools/test/tools/javac/lambda/MethodReference12.java langtools/test/tools/javac/lambda/MethodReference13.java langtools/test/tools/javac/lambda/MethodReference14.java langtools/test/tools/javac/lambda/MethodReference15.java langtools/test/tools/javac/lambda/MethodReference16.java langtools/test/tools/javac/lambda/MethodReference17.java langtools/test/tools/javac/lambda/MethodReference18.java langtools/test/tools/javac/lambda/MethodReference19.java langtools/test/tools/javac/lambda/MethodReference20.java langtools/test/tools/javac/lambda/MethodReference20.out langtools/test/tools/javac/lambda/MethodReference21.java langtools/test/tools/javac/lambda/MethodReference21.out langtools/test/tools/javac/lambda/MethodReference22.java langtools/test/tools/javac/lambda/MethodReference22.out langtools/test/tools/javac/lambda/MethodReference23.java langtools/test/tools/javac/lambda/MethodReference23.out langtools/test/tools/javac/lambda/MethodReference24.java langtools/test/tools/javac/lambda/MethodReference25.java langtools/test/tools/javac/lambda/MethodReference26.java langtools/test/tools/javac/lambda/MethodReference26.out langtools/test/tools/javac/lambda/MethodReference27.java langtools/test/tools/javac/lambda/MethodReference28.java langtools/test/tools/javac/lambda/MethodReference28.out langtools/test/tools/javac/lambda/MethodReference29.java langtools/test/tools/javac/lambda/MethodReference30.java langtools/test/tools/javac/lambda/MethodReference31.java langtools/test/tools/javac/lambda/MethodReference32.java langtools/test/tools/javac/lambda/MethodReference32.out langtools/test/tools/javac/lambda/MethodReference33.java langtools/test/tools/javac/lambda/MethodReference34.java langtools/test/tools/javac/lambda/MethodReference35.java langtools/test/tools/javac/lambda/MethodReference36.java langtools/test/tools/javac/lambda/MethodReference37.java langtools/test/tools/javac/lambda/MethodReference37.out langtools/test/tools/javac/lambda/MethodReference38.java langtools/test/tools/javac/lambda/MethodReference38.out langtools/test/tools/javac/lambda/MethodReference39.java langtools/test/tools/javac/lambda/MethodReference39.out langtools/test/tools/javac/lambda/MethodReference40.java langtools/test/tools/javac/lambda/MethodReference40.out langtools/test/tools/javac/lambda/MethodReference41.java langtools/test/tools/javac/lambda/MethodReference42.java langtools/test/tools/javac/lambda/MethodReference43.java langtools/test/tools/javac/lambda/MethodReference44.java langtools/test/tools/javac/lambda/MethodReference45.java langtools/test/tools/javac/lambda/MethodReference45.out langtools/test/tools/javac/lambda/MethodReference46.java langtools/test/tools/javac/lambda/MethodReference47.java langtools/test/tools/javac/lambda/MethodReference47.out langtools/test/tools/javac/lambda/MethodReference48.java langtools/test/tools/javac/lambda/MethodReference49.java langtools/test/tools/javac/lambda/MethodReference50.java langtools/test/tools/javac/lambda/MethodReference50.out langtools/test/tools/javac/lambda/MethodReference51.java langtools/test/tools/javac/lambda/MethodReference51.out langtools/test/tools/javac/lambda/MethodReference52.java langtools/test/tools/javac/lambda/MethodReference52.out langtools/test/tools/javac/lambda/MethodReference53.java langtools/test/tools/javac/lambda/MethodReference53.out langtools/test/tools/javac/lambda/MethodReference54.java langtools/test/tools/javac/lambda/MethodReference54.out langtools/test/tools/javac/lambda/MethodReferenceParserTest.java langtools/test/tools/javac/lambda/MostSpecific01.java langtools/test/tools/javac/lambda/MostSpecific01.out langtools/test/tools/javac/lambda/MostSpecific02.java langtools/test/tools/javac/lambda/MostSpecific02.out langtools/test/tools/javac/lambda/MostSpecific03.java langtools/test/tools/javac/lambda/MostSpecific03.out langtools/test/tools/javac/lambda/MostSpecific04.java langtools/test/tools/javac/lambda/MostSpecific05.java langtools/test/tools/javac/lambda/MostSpecific06.java langtools/test/tools/javac/lambda/MostSpecific06.out langtools/test/tools/javac/lambda/MostSpecific07.java langtools/test/tools/javac/lambda/MostSpecific07.out langtools/test/tools/javac/lambda/NakedThis.java langtools/test/tools/javac/lambda/SourceLevelTest.java langtools/test/tools/javac/lambda/SourceLevelTest.out langtools/test/tools/javac/lambda/TargetType01.java langtools/test/tools/javac/lambda/TargetType02.java langtools/test/tools/javac/lambda/TargetType03.java langtools/test/tools/javac/lambda/TargetType04.java langtools/test/tools/javac/lambda/TargetType04.out langtools/test/tools/javac/lambda/TargetType05.java langtools/test/tools/javac/lambda/TargetType06.java langtools/test/tools/javac/lambda/TargetType06.out langtools/test/tools/javac/lambda/TargetType07.java langtools/test/tools/javac/lambda/TargetType08.java langtools/test/tools/javac/lambda/TargetType10.java langtools/test/tools/javac/lambda/TargetType10.out langtools/test/tools/javac/lambda/TargetType11.java langtools/test/tools/javac/lambda/TargetType11.out langtools/test/tools/javac/lambda/TargetType12.java langtools/test/tools/javac/lambda/TargetType13.java langtools/test/tools/javac/lambda/TargetType13.out langtools/test/tools/javac/lambda/TargetType14.java langtools/test/tools/javac/lambda/TargetType14.out langtools/test/tools/javac/lambda/TargetType15.java langtools/test/tools/javac/lambda/TargetType16.java langtools/test/tools/javac/lambda/TargetType16.out langtools/test/tools/javac/lambda/TargetType17.java langtools/test/tools/javac/lambda/TargetType17.out langtools/test/tools/javac/lambda/TargetType18.java langtools/test/tools/javac/lambda/TargetType19.java langtools/test/tools/javac/lambda/TargetType19.out langtools/test/tools/javac/lambda/TargetType20.java langtools/test/tools/javac/lambda/TargetType20.out langtools/test/tools/javac/lambda/TargetType21.java langtools/test/tools/javac/lambda/TargetType21.out langtools/test/tools/javac/lambda/TargetType22.java langtools/test/tools/javac/lambda/TargetType22.out langtools/test/tools/javac/lambda/TargetType23.java langtools/test/tools/javac/lambda/TargetType23.out langtools/test/tools/javac/lambda/TargetType24.java langtools/test/tools/javac/lambda/TargetType24.out langtools/test/tools/javac/lambda/TargetType25.java langtools/test/tools/javac/lambda/TargetType26.java langtools/test/tools/javac/lambda/TargetType26.out langtools/test/tools/javac/lambda/TargetType27.java langtools/test/tools/javac/lambda/TargetType27.out langtools/test/tools/javac/lambda/TargetType28.java langtools/test/tools/javac/lambda/TargetType28.out langtools/test/tools/javac/lambda/TargetType29.java langtools/test/tools/javac/lambda/TargetType30.java langtools/test/tools/javac/lambda/TargetType31.java langtools/test/tools/javac/lambda/TargetType32.java langtools/test/tools/javac/lambda/TargetType33.java langtools/test/tools/javac/lambda/TargetType33.out langtools/test/tools/javac/lambda/TargetType34.java langtools/test/tools/javac/lambda/TargetType35.java langtools/test/tools/javac/lambda/TargetType36.java langtools/test/tools/javac/lambda/TargetType37.java langtools/test/tools/javac/lambda/TargetType38.java langtools/test/tools/javac/lambda/TargetType38.out langtools/test/tools/javac/lambda/TargetType39.java langtools/test/tools/javac/lambda/TargetType39.out langtools/test/tools/javac/lambda/TargetType40.java langtools/test/tools/javac/lambda/TargetType40.out langtools/test/tools/javac/lambda/TargetType41.java langtools/test/tools/javac/lambda/TargetType41.out langtools/test/tools/javac/lambda/TargetType42.java langtools/test/tools/javac/lambda/TargetType43.java langtools/test/tools/javac/lambda/TargetType43.out langtools/test/tools/javac/lambda/TargetType44.java langtools/test/tools/javac/lambda/TargetType44.out langtools/test/tools/javac/lambda/TargetType45.java langtools/test/tools/javac/lambda/TargetType45.out langtools/test/tools/javac/lambda/TargetType46.java langtools/test/tools/javac/lambda/TargetType46.out langtools/test/tools/javac/lambda/TargetType47.java langtools/test/tools/javac/lambda/TargetType48.java langtools/test/tools/javac/lambda/TargetType49.java langtools/test/tools/javac/lambda/TargetType49.out langtools/test/tools/javac/lambda/TargetType50.java langtools/test/tools/javac/lambda/TargetType50.out langtools/test/tools/javac/lambda/TestInvokeDynamic.java langtools/test/tools/javac/lambda/TestSelfRef.java langtools/test/tools/javac/lambda/VoidCompatibility.java langtools/test/tools/javac/lambda/VoidCompatibility.out langtools/test/tools/javac/lambda/abort/Abort.java langtools/test/tools/javac/lambda/badMemberRefBytecode/Main.java langtools/test/tools/javac/lambda/badMemberRefBytecode/TestBadMemberRefBytecode.java langtools/test/tools/javac/lambda/badMemberRefBytecode/Use.java langtools/test/tools/javac/lambda/funcInterfaces/Helper.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest1.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest1_neg1.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest1_neg1.out langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest1_neg2.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest1_neg2.out langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest1_neg3.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest1_neg3.out langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest2_SAM1.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest2_SAM2.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest2_SAM3.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.java langtools/test/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.out langtools/test/tools/javac/lambda/funcInterfaces/NonSAM1.java langtools/test/tools/javac/lambda/funcInterfaces/NonSAM1.out langtools/test/tools/javac/lambda/funcInterfaces/NonSAM2.java langtools/test/tools/javac/lambda/funcInterfaces/NonSAM2.out langtools/test/tools/javac/lambda/funcInterfaces/NonSAM3.java langtools/test/tools/javac/lambda/funcInterfaces/NonSAM3.out langtools/test/tools/javac/lambda/lambdaExpression/AbstractClass_neg.java langtools/test/tools/javac/lambda/lambdaExpression/AbstractClass_neg.out langtools/test/tools/javac/lambda/lambdaExpression/AccessNonStatic_neg.java langtools/test/tools/javac/lambda/lambdaExpression/AccessNonStatic_neg.out langtools/test/tools/javac/lambda/lambdaExpression/EffectivelyFinal_neg.java langtools/test/tools/javac/lambda/lambdaExpression/EffectivelyFinal_neg.out langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression1.java langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression1.out langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression3.java langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression3.out langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression4.java langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression4.out langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression5.java langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression5.out langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression6.java langtools/test/tools/javac/lambda/lambdaExpression/InvalidExpression6.out langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest1.java langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest2.java langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest3.java langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest4.java langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest5.java langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest6.java langtools/test/tools/javac/lambda/lambdaExpression/SamConversion.java langtools/test/tools/javac/lambda/lambdaExpression/SamConversionComboTest.java langtools/test/tools/javac/lambda/methodReference/BridgeMethod.java langtools/test/tools/javac/lambda/methodReference/MethodRef1.java langtools/test/tools/javac/lambda/methodReference/MethodRef2.java langtools/test/tools/javac/lambda/methodReference/MethodRef3.java langtools/test/tools/javac/lambda/methodReference/MethodRef4.java langtools/test/tools/javac/lambda/methodReference/MethodRef5.java langtools/test/tools/javac/lambda/methodReference/MethodRef6.java langtools/test/tools/javac/lambda/methodReference/MethodRef7.java langtools/test/tools/javac/lambda/methodReference/MethodRef_neg.java langtools/test/tools/javac/lambda/methodReference/MethodRef_neg.out langtools/test/tools/javac/lambda/methodReference/SamConversion.java langtools/test/tools/javac/lambda/methodReference/SamConversionComboTest.java langtools/test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java langtools/test/tools/javac/lambda/speculative/A.java langtools/test/tools/javac/lambda/speculative/DiamondFinder.java langtools/test/tools/javac/lambda/speculative/Main.java langtools/test/tools/javac/lambda/speculative/Main.out langtools/test/tools/javac/lambda/typeInference/InferenceTest11.java langtools/test/tools/javac/lambda/typeInference/InferenceTest2.java langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java langtools/test/tools/javac/lambda/typeInference/InferenceTest3.java langtools/test/tools/javac/lambda/typeInference/InferenceTest4.java langtools/test/tools/javac/lambda/typeInference/InferenceTest5.java langtools/test/tools/javac/lambda/typeInference/InferenceTest789.java langtools/test/tools/javac/lambda/typeInference/InferenceTest_neg1_2.java langtools/test/tools/javac/lambda/typeInference/InferenceTest_neg1_2.out langtools/test/tools/javac/lambda/typeInference/InferenceTest_neg5.java langtools/test/tools/javac/lambda/typeInference/InferenceTest_neg5.out langtools/test/tools/javac/lambda/typeInference/combo/TypeInferenceComboTest.java langtools/test/tools/javac/typeAnnotations/newlocations/BasicTest.out
diffstat 455 files changed, 15540 insertions(+), 595 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java	Sat Nov 17 19:01:03 2012 +0000
@@ -67,6 +67,7 @@
         if ((mask&NATIVE) != 0) flags.add(Flag.NATIVE);
         if ((mask&INTERFACE) != 0) flags.add(Flag.INTERFACE);
         if ((mask&ABSTRACT) != 0) flags.add(Flag.ABSTRACT);
+        if ((mask&DEFAULT) != 0) flags.add(Flag.DEFAULT);
         if ((mask&STRICTFP) != 0) flags.add(Flag.STRICTFP);
         if ((mask&BRIDGE) != 0) flags.add(Flag.BRIDGE);
         if ((mask&SYNTHETIC) != 0) flags.add(Flag.SYNTHETIC);
@@ -261,7 +262,7 @@
      * Flag that marks class as auxiliary, ie a non-public class following
      * the public class in a source file, that could block implicit compilation.
      */
-    public static final long AUXILIARY = 1L<<43;
+    public static final long AUXILIARY = 1L<<44;
 
     /** Modifier masks.
      */
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Sat Nov 17 19:01:03 2012 +0000
@@ -438,7 +438,8 @@
     }
 
     public Set<Modifier> getModifiers() {
-        return Flags.asModifierSet(flags());
+        long flags = flags();
+        return Flags.asModifierSet((flags & DEFAULT) != 0 ? flags & ~ABSTRACT : flags);
     }
 
     public Name getSimpleName() {
@@ -475,6 +476,7 @@
         public String toString() { return other.toString(); }
         public Symbol location() { return other.location(); }
         public Symbol location(Type site, Types types) { return other.location(site, types); }
+        public Symbol baseSymbol() { return other; }
         public Type erasure(Types types) { return other.erasure(types); }
         public Type externalType(Types types) { return other.externalType(types); }
         public boolean isLocal() { return other.isLocal(); }
@@ -1192,7 +1194,7 @@
 
             // check for an inherited implementation
             if ((flags() & ABSTRACT) != 0 ||
-                    (other.flags() & ABSTRACT) == 0 ||
+                    ((other.flags() & ABSTRACT) == 0 && (other.flags() & DEFAULT) == 0) ||
                     !other.isOverridableIn(origin) ||
                     !this.isMemberOf(origin, types))
                 return false;
@@ -1202,7 +1204,7 @@
             Type ot = types.memberType(origin.type, other);
             return
                 types.isSubSignature(mt, ot) &&
-                (!checkResult || types.resultSubtype(mt, ot, Warner.noWarnings));
+                (!checkResult || types.resultSubtype(mt, ot, types.noWarnings));
         }
 
         private boolean isOverridableIn(TypeSymbol origin) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Sat Nov 17 19:01:03 2012 +0000
@@ -83,6 +83,8 @@
     final Name capturedName;
     private final FunctionDescriptorLookupError functionDescriptorLookupError;
 
+    public final Warner noWarnings;
+
     // <editor-fold defaultstate="collapsed" desc="Instantiating">
     public static Types instance(Context context) {
         Types instance = context.get(typesKey);
@@ -106,6 +108,7 @@
         messages = JavacMessages.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         functionDescriptorLookupError = new FunctionDescriptorLookupError();
+        noWarnings = new Warner(null);
     }
     // </editor-fold>
 
@@ -296,7 +299,7 @@
      * convertions to s?
      */
     public boolean isConvertible(Type t, Type s) {
-        return isConvertible(t, s, Warner.noWarnings);
+        return isConvertible(t, s, noWarnings);
     }
     // </editor-fold>
 
@@ -394,15 +397,10 @@
 
             @Override
             public boolean accepts(Symbol sym) {
-                    return sym.kind == Kinds.MTH &&
-                            (sym.flags() & ABSTRACT) != 0 &&
-                            !overridesObjectMethod(origin, sym) &&
-                            notOverridden(sym);
-            }
-
-            private boolean notOverridden(Symbol msym) {
-                Symbol impl = ((MethodSymbol)msym).implementation(origin, Types.this, false);
-                return impl == null || (impl.flags() & ABSTRACT) != 0;
+                return sym.kind == Kinds.MTH &&
+                        (sym.flags() & (ABSTRACT | DEFAULT)) == ABSTRACT &&
+                        !overridesObjectMethod(origin, sym) &&
+                        (interfaceCandidates(origin.type, (MethodSymbol)sym).head.flags() & DEFAULT) == 0;
             }
         };
 
@@ -593,7 +591,7 @@
      * Is t an unchecked subtype of s?
      */
     public boolean isSubtypeUnchecked(Type t, Type s) {
-        return isSubtypeUnchecked(t, s, Warner.noWarnings);
+        return isSubtypeUnchecked(t, s, noWarnings);
     }
     /**
      * Is t an unchecked subtype of s?
@@ -1196,7 +1194,7 @@
 
     // <editor-fold defaultstate="collapsed" desc="isCastable">
     public boolean isCastable(Type t, Type s) {
-        return isCastable(t, s, Warner.noWarnings);
+        return isCastable(t, s, noWarnings);
     }
 
     /**
@@ -1259,7 +1257,7 @@
                     return true;
 
                 if (s.tag == TYPEVAR) {
-                    if (isCastable(t, s.getUpperBound(), Warner.noWarnings)) {
+                    if (isCastable(t, s.getUpperBound(), noWarnings)) {
                         warnStack.head.warn(LintCategory.UNCHECKED);
                         return true;
                     } else {
@@ -1269,7 +1267,7 @@
 
                 if (t.isCompound()) {
                     Warner oldWarner = warnStack.head;
-                    warnStack.head = Warner.noWarnings;
+                    warnStack.head = noWarnings;
                     if (!visit(supertype(t), s))
                         return false;
                     for (Type intf : interfaces(t)) {
@@ -1368,7 +1366,7 @@
                 case BOT:
                     return true;
                 case TYPEVAR:
-                    if (isCastable(s, t, Warner.noWarnings)) {
+                    if (isCastable(s, t, noWarnings)) {
                         warnStack.head.warn(LintCategory.UNCHECKED);
                         return true;
                     } else {
@@ -1396,7 +1394,7 @@
                 case TYPEVAR:
                     if (isSubtype(t, s)) {
                         return true;
-                    } else if (isCastable(t.bound, s, Warner.noWarnings)) {
+                    } else if (isCastable(t.bound, s, noWarnings)) {
                         warnStack.head.warn(LintCategory.UNCHECKED);
                         return true;
                     } else {
@@ -1535,7 +1533,7 @@
             TypeVar tv = (TypeVar) t;
             return !isCastable(tv.bound,
                                relaxBound(s),
-                               Warner.noWarnings);
+                               noWarnings);
         }
         if (s.tag != WILDCARD)
             s = upperBound(s);
@@ -1838,7 +1836,7 @@
 
     // <editor-fold defaultstate="collapsed" desc="isAssignable">
     public boolean isAssignable(Type t, Type s) {
-        return isAssignable(t, s, Warner.noWarnings);
+        return isAssignable(t, s, noWarnings);
     }
 
     /**
@@ -2149,9 +2147,9 @@
             }
         };
 
-    public boolean isDirectSuperInterface(Type t, TypeSymbol tsym) {
-        for (Type t2 : interfaces(tsym.type)) {
-            if (isSameType(t, t2)) return true;
+    public boolean isDirectSuperInterface(TypeSymbol isym, TypeSymbol origin) {
+        for (Type i2 : interfaces(origin.type)) {
+            if (isym == i2.tsym) return true;
         }
         return false;
     }
@@ -2224,7 +2222,9 @@
      * Return list of bounds of the given type variable.
      */
     public List<Type> getBounds(TypeVar t) {
-        if (t.bound.isErroneous() || !t.bound.isCompound())
+                if (t.bound.hasTag(NONE))
+            return List.nil();
+        else if (t.bound.isErroneous() || !t.bound.isCompound())
             return List.of(t.bound);
         else if ((erasure(t).tsym.flags() & INTERFACE) == 0)
             return interfaces(t).prepend(supertype(t));
@@ -2319,10 +2319,6 @@
         return false;
     }
 
-    public boolean overridesObjectMethod(Symbol msym) {
-        return ((MethodSymbol)msym).implementation(syms.objectType.tsym, this, true) != null;
-    }
-
     // <editor-fold defaultstate="collapsed" desc="Determining method implementation in given site">
     class ImplementationCache {
 
@@ -2471,11 +2467,7 @@
 
     //where
     public List<MethodSymbol> interfaceCandidates(Type site, MethodSymbol ms) {
-        return interfaceCandidates(site, ms, false);
-    }
-
-    public List<MethodSymbol> interfaceCandidates(Type site, MethodSymbol ms, boolean intfOnly) {
-        Filter<Symbol> filter = new MethodFilter(ms, site, intfOnly);
+        Filter<Symbol> filter = new MethodFilter(ms, site);
         List<MethodSymbol> candidates = List.nil();
         for (Symbol s : membersClosure(site, false).getElements(filter)) {
             if (!site.tsym.isInterface() && !s.owner.isInterface()) {
@@ -2514,17 +2506,14 @@
 
                 Symbol msym;
                 Type site;
-                boolean intfOnly;
-
-                MethodFilter(Symbol msym, Type site, boolean intfOnly) {
+
+                MethodFilter(Symbol msym, Type site) {
                     this.msym = msym;
                     this.site = site;
-                    this.intfOnly = intfOnly;
                 }
 
                 public boolean accepts(Symbol s) {
                     return s.kind == Kinds.MTH &&
-                            (!intfOnly || s.owner.isInterface()) &&
                             s.name == msym.name &&
                             s.isInheritedIn(site.tsym, Types.this) &&
                             overrideEquivalent(memberType(site, s), memberType(site, msym));
@@ -3462,11 +3451,11 @@
      */
     public boolean returnTypeSubstitutable(Type r1, Type r2) {
         if (hasSameArgs(r1, r2))
-            return resultSubtype(r1, r2, Warner.noWarnings);
+            return resultSubtype(r1, r2, noWarnings);
         else
             return covariantReturnType(r1.getReturnType(),
                                        erasure(r2.getReturnType()),
-                                       Warner.noWarnings);
+                                       noWarnings);
     }
 
     public boolean returnTypeSubstitutable(Type r1,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Sat Nov 17 19:01:03 2012 +0000
@@ -133,7 +133,7 @@
         allowCovariantReturns = source.allowCovariantReturns();
         allowAnonOuterThis = source.allowAnonOuterThis();
         allowStringsInSwitch = source.allowStringsInSwitch();
-        allowPoly = source.allowPoly() && options.isSet("allowPoly");
+        allowPoly = source.allowPoly();
         allowLambda = source.allowLambda();
         allowDefaultMethods = source.allowDefaultMethods();
         sourceName = source.name;
@@ -179,14 +179,14 @@
      */
     boolean allowCovariantReturns;
 
+    /** Switch: support lambda expressions ?
+     */
+    boolean allowLambda;
+
     /** Switch: support default methods ?
      */
     boolean allowDefaultMethods;
 
-    /** Switch: support lambda expressions ?
-     */
-    boolean allowLambda;
-
     /** Switch: allow references to surrounding object from anonymous
      * objects during constructor call?
      */
@@ -524,6 +524,10 @@
         protected ResultInfo dup(Type newPt) {
             return new ResultInfo(pkind, newPt, checkContext);
         }
+
+        protected ResultInfo dup(CheckContext newContext) {
+            return new ResultInfo(pkind, pt, newContext);
+        }
     }
 
     class RecoveryInfo extends ResultInfo {
@@ -540,7 +544,7 @@
                 }
                 @Override
                 public void report(DiagnosticPosition pos, JCDiagnostic details) {
-                    //do nothing
+                    chk.basicHandler.report(pos, details);
                 }
             });
         }
@@ -595,8 +599,10 @@
             this.env = env;
             this.resultInfo = resultInfo;
             tree.accept(this);
-            if (tree == breakTree)
+            if (tree == breakTree &&
+                    resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
                 throw new BreakAttr(env);
+            }
             return result;
         } catch (CompletionFailure ex) {
             tree.type = syms.errType;
@@ -903,7 +909,7 @@
 
             localEnv.info.lint = lint;
 
-            if (isDefaultMethod && types.overridesObjectMethod(m)) {
+            if (isDefaultMethod && types.overridesObjectMethod(m.enclClass(), m)) {
                 log.error(tree, "default.overrides.object.member", m.name, Kinds.kindName(m.location()), m.location());
             }
 
@@ -1390,13 +1396,14 @@
 
         if (!standaloneConditional && resultInfo.pt.hasTag(VOID)) {
             //cannot get here (i.e. it means we are returning from void method - which is already an error)
+            resultInfo.checkContext.report(tree, diags.fragment("conditional.target.cant.be.void"));
             result = tree.type = types.createErrorType(resultInfo.pt);
             return;
         }
 
         ResultInfo condInfo = standaloneConditional ?
                 unknownExprInfo :
-                new ResultInfo(VAL, pt(), new Check.NestedCheckContext(resultInfo.checkContext) {
+                resultInfo.dup(new Check.NestedCheckContext(resultInfo.checkContext) {
                     //this will use enclosing check context to check compatibility of
                     //subexpression against target type; if we are in a method check context,
                     //depending on whether boxing is allowed, we could have incompatibilities
@@ -1419,11 +1426,11 @@
         result = check(tree, owntype, VAL, resultInfo);
     }
     //where
-        @SuppressWarnings("fallthrough")
         private boolean isBooleanOrNumeric(Env<AttrContext> env, JCExpression tree) {
             switch (tree.getTag()) {
                 case LITERAL: return ((JCLiteral)tree).typetag.isSubRangeOf(DOUBLE) ||
-                              ((JCLiteral)tree).typetag == BOOLEAN;
+                              ((JCLiteral)tree).typetag == BOOLEAN ||
+                              ((JCLiteral)tree).typetag == BOT;
                 case LAMBDA: case REFERENCE: return false;
                 case PARENS: return isBooleanOrNumeric(env, ((JCParens)tree).expr);
                 case CONDEXPR:
@@ -1612,19 +1619,23 @@
             // it conforms to result type of enclosing method.
             if (tree.expr != null) {
                 if (env.info.returnResult.pt.hasTag(VOID)) {
-                    log.error(tree.expr.pos(),
-                              "cant.ret.val.from.meth.decl.void");
+                    env.info.returnResult.checkContext.report(tree.expr.pos(),
+                              diags.fragment("unexpected.ret.val"));
                 }
                 attribTree(tree.expr, env, env.info.returnResult);
             } else if (!env.info.returnResult.pt.hasTag(VOID)) {
-                log.error(tree.pos(), "missing.ret.val");
+                env.info.returnResult.checkContext.report(tree.pos(),
+                              diags.fragment("missing.ret.val"));
             }
         }
         result = null;
     }
 
     public void visitThrow(JCThrow tree) {
-        attribExpr(tree.expr, env, syms.throwableType);
+        Type owntype = attribExpr(tree.expr, env, allowPoly ? Type.noType : syms.throwableType);
+        if (allowPoly) {
+            chk.checkType(tree, owntype, syms.throwableType);
+        }
         result = null;
     }
 
@@ -2068,7 +2079,7 @@
                             resultInfo.checkContext.inferenceContext().free(resultInfo.pt) ? Type.noType : pt());
                     Type inferred = deferredAttr.attribSpeculative(tree, env, findDiamondResult).type;
                     if (!inferred.isErroneous() &&
-                        types.isAssignable(inferred, pt().hasTag(NONE) ? syms.objectType : pt(), Warner.noWarnings)) {
+                        types.isAssignable(inferred, pt().hasTag(NONE) ? syms.objectType : pt(), types.noWarnings)) {
                         String key = types.isSameType(clazztype, inferred) ?
                             "diamond.redundant.args" :
                             "diamond.redundant.args.1";
@@ -2172,7 +2183,7 @@
         }
         //create an environment for attribution of the lambda expression
         final Env<AttrContext> localEnv = lambdaEnv(that, env);
-        boolean needsRecovery = resultInfo.checkContext.deferredAttrContext() == deferredAttr.emptyDeferredAttrContext ||
+        boolean needsRecovery =
                 resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK;
         try {
             List<Type> explicitParamTypes = null;
@@ -2182,10 +2193,16 @@
                 explicitParamTypes = TreeInfo.types(that.params);
             }
 
-            Type target = infer.instantiateFunctionalInterface(that, pt(), explicitParamTypes, resultInfo.checkContext);
-            Type lambdaType = (target == Type.recoveryType) ?
-                    fallbackDescriptorType(that) :
-                    types.findDescriptorType(target);
+            Type target;
+            Type lambdaType;
+            if (pt() != Type.recoveryType) {
+                target = infer.instantiateFunctionalInterface(that, pt(), explicitParamTypes, resultInfo.checkContext);
+                lambdaType = types.findDescriptorType(target);
+                chk.checkFunctionalInterface(that, target);
+            } else {
+                target = Type.recoveryType;
+                lambdaType = fallbackDescriptorType(that);
+            }
 
             if (!TreeInfo.isExplicitLambda(that)) {
                 //add param type info in the AST
@@ -2250,7 +2267,7 @@
             checkLambdaCompatible(that, lambdaType, resultInfo.checkContext, isSpeculativeRound);
 
             if (!isSpeculativeRound) {
-                checkAccessibleFunctionalDescriptor(that, localEnv, resultInfo.checkContext.inferenceContext(), lambdaType);
+                checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), lambdaType, target);
             }
             result = check(that, target, VAL, resultInfo);
         } catch (Types.FunctionDescriptorLookupError ex) {
@@ -2285,17 +2302,22 @@
             return null;
         }
 
-        private void checkAccessibleFunctionalDescriptor(final DiagnosticPosition pos,
-                final Env<AttrContext> env, final InferenceContext inferenceContext, final Type desc) {
-            if (inferenceContext.free(desc)) {
-                inferenceContext.addFreeTypeListener(List.of(desc), new FreeTypeListener() {
+        private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env, final InferenceContext inferenceContext, final Type... ts) {
+            checkAccessibleTypes(pos, env, inferenceContext, List.from(ts));
+        }
+
+        private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env, final InferenceContext inferenceContext, final List<Type> ts) {
+            if (inferenceContext.free(ts)) {
+                inferenceContext.addFreeTypeListener(ts, new FreeTypeListener() {
                     @Override
                     public void typesInferred(InferenceContext inferenceContext) {
-                        checkAccessibleFunctionalDescriptor(pos, env, inferenceContext, inferenceContext.asInstType(desc, types));
+                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts, types));
                     }
                 });
             } else {
-                chk.checkAccessibleFunctionalDescriptor(pos, env, desc);
+                for (Type t : ts) {
+                    rs.checkAccessibleType(env, t);
+                }
             }
         }
 
@@ -2411,15 +2433,20 @@
                 typeargtypes = attribTypes(that.typeargs, localEnv);
             }
 
-            Type target = infer.instantiateFunctionalInterface(that, pt(), null, resultInfo.checkContext);
-            Type desc = (target == Type.recoveryType) ?
-                    fallbackDescriptorType(that) :
-                    types.findDescriptorType(target);
+            Type target;
+            Type desc;
+            if (pt() != Type.recoveryType) {
+                target = infer.instantiateFunctionalInterface(that, pt(), null, resultInfo.checkContext);
+                desc = types.findDescriptorType(target);
+                chk.checkFunctionalInterface(that, target);
+            } else {
+                target = Type.recoveryType;
+                desc = fallbackDescriptorType(that);
+            }
 
             List<Type> argtypes = desc.getParameterTypes();
 
             boolean allowBoxing =
-                    resultInfo.checkContext.deferredAttrContext() == deferredAttr.emptyDeferredAttrContext ||
                     resultInfo.checkContext.deferredAttrContext().phase.isBoxingRequired();
             Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = rs.resolveMemberReference(that.pos(), localEnv, that,
                     that.expr.type, that.name, argtypes, typeargtypes, allowBoxing);
@@ -2455,18 +2482,25 @@
                 JCDiagnostic diag = diags.create(diagKind, log.currentSource(), that,
                         "invalid.mref", Kinds.kindName(that.getMode()), detailsDiag);
 
-                if (targetError) {
-                    resultInfo.checkContext.report(that, diag);
+                if (targetError && target == Type.recoveryType) {
+                    //a target error doesn't make sense during recovery stage
+                    //as we don't know what actual parameter types are
+                    result = that.type = target;
+                    return;
                 } else {
-                    log.report(diag);
+                    if (targetError) {
+                        resultInfo.checkContext.report(that, diag);
+                    } else {
+                        log.report(diag);
+                    }
+                    result = that.type = types.createErrorType(target);
+                    return;
                 }
-                result = that.type = types.createErrorType(target);
-                return;
             }
 
             if (desc.getReturnType() == Type.recoveryType) {
                 // stop here
-                result = that.type = types.createErrorType(target);
+                result = that.type = target;
                 return;
             }
 
@@ -2492,7 +2526,7 @@
                     resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.SPECULATIVE;
             checkReferenceCompatible(that, desc, refType, resultInfo.checkContext, isSpeculativeRound);
             if (!isSpeculativeRound) {
-                checkAccessibleFunctionalDescriptor(that, localEnv, resultInfo.checkContext.inferenceContext(), desc);
+                checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), desc, target);
             }
             result = check(that, target, VAL, resultInfo);
         } catch (Types.FunctionDescriptorLookupError ex) {
@@ -2526,7 +2560,7 @@
 
         if (!returnType.hasTag(VOID) && !resType.hasTag(VOID)) {
             if (resType.isErroneous() ||
-                    new LambdaReturnContext(checkContext).compatible(resType, returnType, Warner.noWarnings)) {
+                    new LambdaReturnContext(checkContext).compatible(resType, returnType, types.noWarnings)) {
                 incompatibleReturnType = null;
             }
         }
@@ -3039,15 +3073,52 @@
                      Symbol sym,
                      Env<AttrContext> env,
                      ResultInfo resultInfo) {
-            Type pt = resultInfo.pt.hasTag(FORALL) || resultInfo.pt.hasTag(METHOD) ?
-                    resultInfo.pt.map(deferredAttr.new DeferredTypeMap(AttrMode.SPECULATIVE, sym, env.info.pendingResolutionPhase)) :
-                    resultInfo.pt;
-
-            DeferredAttr.DeferredTypeMap recoveryMap =
-                    deferredAttr.new RecoveryDeferredTypeMap(AttrMode.CHECK, sym, env.info.pendingResolutionPhase);
-
+            return (resultInfo.pt.hasTag(FORALL) || resultInfo.pt.hasTag(METHOD)) ?
+                    checkMethodId(tree, site, sym, env, resultInfo) :
+                    checkIdInternal(tree, site, sym, resultInfo.pt, env, resultInfo);
+        }
+
+        Type checkMethodId(JCTree tree,
+                     Type site,
+                     Symbol sym,
+                     Env<AttrContext> env,
+                     ResultInfo resultInfo) {
+            boolean isPolymorhicSignature =
+                sym.kind == MTH && ((MethodSymbol)sym.baseSymbol()).isSignaturePolymorphic(types);
+            return isPolymorhicSignature ?
+                    checkSigPolyMethodId(tree, site, sym, env, resultInfo) :
+                    checkMethodIdInternal(tree, site, sym, env, resultInfo);
+        }
+
+        Type checkSigPolyMethodId(JCTree tree,
+                     Type site,
+                     Symbol sym,
+                     Env<AttrContext> env,
+                     ResultInfo resultInfo) {
+            //recover original symbol for signature polymorphic methods
+            checkMethodIdInternal(tree, site, sym.baseSymbol(), env, resultInfo);
+            env.info.pendingResolutionPhase = Resolve.MethodResolutionPhase.BASIC;
+            return sym.type;
+        }
+
+        Type checkMethodIdInternal(JCTree tree,
+                     Type site,
+                     Symbol sym,
+                     Env<AttrContext> env,
+                     ResultInfo resultInfo) {
+            Type pt = resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.SPECULATIVE, sym, env.info.pendingResolutionPhase));
+            Type owntype = checkIdInternal(tree, site, sym, pt, env, resultInfo);
+            resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.CHECK, sym, env.info.pendingResolutionPhase));
+            return owntype;
+        }
+
+        Type checkIdInternal(JCTree tree,
+                     Type site,
+                     Symbol sym,
+                     Type pt,
+                     Env<AttrContext> env,
+                     ResultInfo resultInfo) {
             if (pt.isErroneous()) {
-                Type.map(resultInfo.pt.getParameterTypes(), recoveryMap);
                 return types.createErrorType(site);
             }
             Type owntype; // The computed type of this identifier occurrence.
@@ -3132,7 +3203,6 @@
                 break;
             }
             case PCK: case ERR:
-                Type.map(resultInfo.pt.getParameterTypes(), recoveryMap);
                 owntype = sym.type;
                 break;
             default:
@@ -3288,21 +3358,21 @@
             }
         }
 
-        if (env.info.defaultSuperCallSite != null &&
-                !types.interfaceCandidates(env.enclClass.type, (MethodSymbol)sym, true).contains(sym)) {
-            Symbol ovSym = null;
-            for (MethodSymbol msym : types.interfaceCandidates(env.enclClass.type, (MethodSymbol)sym, true)) {
-                if (msym.overrides(sym, msym.enclClass(), types, true)) {
-                    for (Type i : types.interfaces(env.enclClass.type)) {
-                        if (i.tsym.isSubClass(msym.owner, types)) {
-                            ovSym = i.tsym;
-                            break;
-                        }
-                    }
+        if (env.info.defaultSuperCallSite != null) {
+            for (Type sup : types.interfaces(env.enclClass.type).prepend(types.supertype((env.enclClass.type)))) {
+                if (!sup.tsym.isSubClass(sym.enclClass(), types) ||
+                        types.isSameType(sup, env.info.defaultSuperCallSite)) continue;
+                List<MethodSymbol> icand_sup =
+                        types.interfaceCandidates(sup, (MethodSymbol)sym);
+                if (icand_sup.nonEmpty() &&
+                        icand_sup.head != sym &&
+                        icand_sup.head.overrides(sym, icand_sup.head.enclClass(), types, true)) {
+                    log.error(env.tree.pos(), "illegal.default.super.call", env.info.defaultSuperCallSite,
+                        diags.fragment("overridden.default", sym, sup));
+                    break;
                 }
             }
-            log.error(env.tree.pos(), "illegal.default.super.call", env.info.defaultSuperCallSite,
-                    diags.fragment("overridden.default", sym, ovSym));
+            env.info.defaultSuperCallSite = null;
         }
 
         // Compute the identifier's instantiated type.
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Sat Nov 17 19:01:03 2012 +0000
@@ -120,8 +120,7 @@
         allowCovariantReturns = source.allowCovariantReturns();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
         allowDefaultMethods = source.allowDefaultMethods();
-        allowStrictMethodClashCheck = source.allowStrictMethodClashCheck() &&
-                options.isSet("strictMethodClashCheck"); //pre-lambda guard
+        allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
         complexInference = options.isSet("complexinference");
         warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
         suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
@@ -451,8 +450,6 @@
         public Infer.InferenceContext inferenceContext();
 
         public DeferredAttr.DeferredAttrContext deferredAttrContext();
-
-        public boolean allowBoxing();
     }
 
     /**
@@ -487,10 +484,6 @@
         public DeferredAttrContext deferredAttrContext() {
             return enclosingContext.deferredAttrContext();
         }
-
-        public boolean allowBoxing() {
-            return enclosingContext.allowBoxing();
-        }
     }
 
     /**
@@ -515,10 +508,6 @@
         public DeferredAttrContext deferredAttrContext() {
             return deferredAttr.emptyDeferredAttrContext;
         }
-
-        public boolean allowBoxing() {
-            return true;
-        }
     };
 
     /** Check that a given type is assignable to a given proto-type.
@@ -625,7 +614,7 @@
              a = types.upperBound(a);
              return types.isSubtype(a, bound);
          } else if (a.isExtendsBound()) {
-             return types.isCastable(bound, types.upperBound(a), Warner.noWarnings);
+             return types.isCastable(bound, types.upperBound(a), types.noWarnings);
          } else if (a.isSuperBound()) {
              return !types.notSoftSubtype(types.lowerBound(a), bound);
          }
@@ -909,19 +898,21 @@
                                   "unchecked.generic.array.creation",
                                   argtype);
             }
-            Type elemtype = types.elemtype(argtype);
-            switch (tree.getTag()) {
-                case APPLY:
-                    ((JCMethodInvocation) tree).varargsElement = elemtype;
-                    break;
-                case NEWCLASS:
-                    ((JCNewClass) tree).varargsElement = elemtype;
-                    break;
-                case REFERENCE:
-                    ((JCMemberReference) tree).varargsElement = elemtype;
-                    break;
-                default:
-                    throw new AssertionError(""+tree);
+            if (!((MethodSymbol)sym.baseSymbol()).isSignaturePolymorphic(types)) {
+                Type elemtype = types.elemtype(argtype);
+                switch (tree.getTag()) {
+                    case APPLY:
+                        ((JCMethodInvocation) tree).varargsElement = elemtype;
+                        break;
+                    case NEWCLASS:
+                        ((JCNewClass) tree).varargsElement = elemtype;
+                        break;
+                    case REFERENCE:
+                        ((JCMemberReference) tree).varargsElement = elemtype;
+                        break;
+                    default:
+                        throw new AssertionError(""+tree);
+                }
             }
          }
          return owntype;
@@ -937,65 +928,6 @@
                 return;
         }
 
-        void checkAccessibleFunctionalDescriptor(DiagnosticPosition pos, Env<AttrContext> env, Type desc) {
-            AccessChecker accessChecker = new AccessChecker(env);
-            //check args accessibility (only if implicit parameter types)
-            for (Type arg : desc.getParameterTypes()) {
-                if (!accessChecker.visit(arg)) {
-                    log.error(pos, "cant.access.arg.type.in.functional.desc", arg);
-                    return;
-                }
-            }
-            //check return type accessibility
-            if (!accessChecker.visit(desc.getReturnType())) {
-                log.error(pos, "cant.access.return.in.functional.desc", desc.getReturnType());
-                return;
-            }
-            //check thrown types accessibility
-            for (Type thrown : desc.getThrownTypes()) {
-                if (!accessChecker.visit(thrown)) {
-                    log.error(pos, "cant.access.thrown.in.functional.desc", thrown);
-                    return;
-                }
-            }
-        }
-
-        class AccessChecker extends Types.UnaryVisitor<Boolean> {
-
-            Env<AttrContext> env;
-
-            AccessChecker(Env<AttrContext> env) {
-                this.env = env;
-            }
-
-            Boolean visit(List<Type> ts) {
-                for (Type t : ts) {
-                    if (!visit(t))
-                        return false;
-                }
-                return true;
-            }
-
-            public Boolean visitType(Type t, Void s) {
-                return true;
-            }
-
-            @Override
-            public Boolean visitArrayType(ArrayType t, Void s) {
-                return visit(t.elemtype);
-            }
-
-            @Override
-            public Boolean visitClassType(ClassType t, Void s) {
-                return rs.isAccessible(env, t, true) &&
-                        visit(t.getTypeArguments());
-            }
-
-            @Override
-            public Boolean visitWildcardType(WildcardType t, Void s) {
-                return visit(t.type);
-            }
-        };
     /**
      * Check that type 't' is a valid instantiation of a generic class
      * (see JLS 4.5)
@@ -1919,8 +1851,8 @@
                         types.isSameType(rt1, rt2) ||
                         !rt1.isPrimitiveOrVoid() &&
                         !rt2.isPrimitiveOrVoid() &&
-                        (types.covariantReturnType(rt1, rt2, Warner.noWarnings) ||
-                         types.covariantReturnType(rt2, rt1, Warner.noWarnings)) ||
+                        (types.covariantReturnType(rt1, rt2, types.noWarnings) ||
+                         types.covariantReturnType(rt2, rt1, types.noWarnings)) ||
                          checkCommonOverriderIn(s1,s2,site);
                     if (!compat) {
                         log.error(pos, "types.incompatible.diff.ret",
@@ -1965,8 +1897,8 @@
                     boolean compat =
                         !rt13.isPrimitiveOrVoid() &&
                         !rt23.isPrimitiveOrVoid() &&
-                        (types.covariantReturnType(rt13, rt1, Warner.noWarnings) &&
-                         types.covariantReturnType(rt23, rt2, Warner.noWarnings));
+                        (types.covariantReturnType(rt13, rt1, types.noWarnings) &&
+                         types.covariantReturnType(rt23, rt2, types.noWarnings));
                     if (compat)
                         return true;
                 }
@@ -2280,19 +2212,33 @@
         c.flags_field |= ACYCLIC;
     }
 
+    /**
+     * Check that functional interface methods would make sense when seen
+     * from the perspective of the implementing class
+     */
+    void checkFunctionalInterface(JCTree tree, Type funcInterface) {
+        ClassType c = new ClassType(Type.noType, List.<Type>nil(), null);
+        ClassSymbol csym = new ClassSymbol(0, names.empty, c, syms.noSymbol);
+        c.interfaces_field = List.of(funcInterface);
+        c.supertype_field = syms.objectType;
+        c.tsym = csym;
+        csym.members_field = new Scope(csym);
+        csym.completer = null;
+        checkImplementations(tree, csym, csym);
+    }
+
     /** Check that all methods which implement some
      *  method conform to the method they implement.
      *  @param tree         The class definition whose members are checked.
      */
     void checkImplementations(JCClassDecl tree) {
-        checkImplementations(tree, tree.sym);
+        checkImplementations(tree, tree.sym, tree.sym);
     }
 //where
         /** Check that all methods which implement some
          *  method in `ic' conform to the method they implement.
          */
-        void checkImplementations(JCClassDecl tree, ClassSymbol ic) {
-            ClassSymbol origin = tree.sym;
+        void checkImplementations(JCTree tree, ClassSymbol origin, ClassSymbol ic) {
             for (List<Type> l = types.closure(ic.type); l.nonEmpty(); l = l.tail) {
                 ClassSymbol lc = (ClassSymbol)l.head.tsym;
                 if ((allowGenerics || origin != lc) && (lc.flags() & ABSTRACT) != 0) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Sat Nov 17 19:01:03 2012 +0000
@@ -38,14 +38,13 @@
 import javax.tools.JavaFileObject;
 
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Queue;
 import java.util.Set;
 import java.util.WeakHashMap;
 
-import static com.sun.tools.javac.code.TypeTag.DEFERRED;
-import static com.sun.tools.javac.code.TypeTag.NONE;
+import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /**
@@ -137,19 +136,6 @@
             }
 
             /**
-             * Clone a speculative cache entry as a fresh entry associated
-             * with a new method (this maybe required to fixup speculative cache
-             * misses after Resolve.access())
-             */
-            void dupAllTo(Symbol from, Symbol to) {
-                Assert.check(cache.get(to) == null);
-                List<Entry> entries = cache.get(from);
-                if (entries != null) {
-                    cache.put(to, entries);
-                }
-            }
-
-            /**
              * Retrieve a speculative cache entry corresponding to given symbol
              * and resolution phase
              */
@@ -194,7 +180,7 @@
             DeferredAttrContext deferredAttrContext =
                     resultInfo.checkContext.deferredAttrContext();
             Assert.check(deferredAttrContext != emptyDeferredAttrContext);
-            List<Type> stuckVars = stuckVars(tree, resultInfo);
+            List<Type> stuckVars = stuckVars(tree, env, resultInfo);
             if (stuckVars.nonEmpty()) {
                 deferredAttrContext.addDeferredAttrNode(this, resultInfo, stuckVars);
                 return Type.noType;
@@ -275,6 +261,10 @@
             @Override
             public void visitClassDef(JCClassDecl tree) {
                 ClassSymbol csym = tree.sym;
+                //if something went wrong during method applicability check
+                //it is possible that nested expressions inside argument expression
+                //are left unchecked - in such cases there's nothing to clean up.
+                if (csym == null) return;
                 enter.typeEnvs.remove(csym);
                 chk.compiled.remove(csym.flatname);
                 syms.classes.remove(csym.flatname);
@@ -333,7 +323,7 @@
          */
         void complete() {
             while (!deferredAttrNodes.isEmpty()) {
-                Set<Type> stuckVars = new HashSet<Type>();
+                Set<Type> stuckVars = new LinkedHashSet<Type>();
                 boolean progress = false;
                 //scan a defensive copy of the node list - this is because a deferred
                 //attribution round can add new nodes to the list
@@ -407,7 +397,7 @@
 
     /** an empty deferred attribution context - all methods throw exceptions */
     final DeferredAttrContext emptyDeferredAttrContext =
-            new DeferredAttrContext(null, null, null, null) {
+            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null) {
                 @Override
                 void addDeferredAttrNode(DeferredType dt, ResultInfo ri, List<Type> stuckVars) {
                     Assert.error("Empty deferred context!");
@@ -471,13 +461,13 @@
     public class RecoveryDeferredTypeMap extends DeferredTypeMap {
 
         public RecoveryDeferredTypeMap(AttrMode mode, Symbol msym, MethodResolutionPhase phase) {
-            super(mode, msym, phase);
+            super(mode, msym, phase != null ? phase : MethodResolutionPhase.BOX);
         }
 
         @Override
         protected Type typeOf(DeferredType dt) {
             Type owntype = super.typeOf(dt);
-            return owntype.hasTag(NONE) ?
+            return owntype == Type.noType ?
                         recover(dt) : owntype;
         }
 
@@ -495,16 +485,7 @@
          */
         private Type recover(DeferredType dt) {
             dt.check(attr.new RecoveryInfo(deferredAttrContext));
-            switch (TreeInfo.skipParens(dt.tree).getTag()) {
-                case LAMBDA:
-                case REFERENCE:
-                case CONDEXPR:
-                    //propagate those deferred types to the
-                    //diagnostic formatter
-                    return dt;
-                default:
-                    return super.apply(dt);
-            }
+            return super.apply(dt);
         }
     }
 
@@ -513,11 +494,11 @@
      * an AST node can be type-checked
      */
     @SuppressWarnings("fallthrough")
-    List<Type> stuckVars(JCTree tree, ResultInfo resultInfo) {
-        if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
+    List<Type> stuckVars(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
+                if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
             return List.nil();
         } else {
-            StuckChecker sc = new StuckChecker(resultInfo);
+            StuckChecker sc = new StuckChecker(resultInfo, env);
             sc.scan(tree);
             return List.from(sc.stuckVars);
         }
@@ -534,7 +515,8 @@
         Type pt;
         Filter<JCTree> treeFilter;
         Infer.InferenceContext inferenceContext;
-        Set<Type> stuckVars = new HashSet<Type>();
+        Set<Type> stuckVars = new LinkedHashSet<Type>();
+        Env<AttrContext> env;
 
         final Filter<JCTree> argsFilter = new Filter<JCTree>() {
             public boolean accepts(JCTree t) {
@@ -563,10 +545,11 @@
             }
         };
 
-        StuckChecker(ResultInfo resultInfo) {
+        StuckChecker(ResultInfo resultInfo, Env<AttrContext> env) {
             this.pt = resultInfo.pt;
             this.inferenceContext = resultInfo.checkContext.inferenceContext();
             this.treeFilter = argsFilter;
+            this.env = env;
         }
 
         @Override
@@ -616,6 +599,7 @@
             if (!types.isFunctionalInterface(pt.tsym)) {
                 return;
             }
+
             Type descType = types.findDescriptorType(pt);
             List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
             stuckVars.addAll(freeArgVars);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Sat Nov 17 19:01:03 2012 +0000
@@ -272,9 +272,7 @@
         Source source = Source.instance(context);
         allowImprovedRethrowAnalysis = source.allowImprovedRethrowAnalysis();
         allowImprovedCatchAnalysis = source.allowImprovedCatchAnalysis();
-        Options options = Options.instance(context);
-        allowEffectivelyFinalInInnerClasses = source.allowEffectivelyFinalInInnerClasses() &&
-                options.isSet("allowEffectivelyFinalInInnerClasses"); //pre-lambda guard
+        allowEffectivelyFinalInInnerClasses = source.allowEffectivelyFinalInInnerClasses();
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Sat Nov 17 19:01:03 2012 +0000
@@ -501,10 +501,10 @@
                 }
                 for (Type t : funcInterfaceContext.undetvars) {
                     UndetVar uv = (UndetVar)t;
-                    minimizeInst(uv, Warner.noWarnings);
+                    minimizeInst(uv, types.noWarnings);
                     if (uv.inst == null &&
                             Type.filter(uv.getBounds(InferenceBound.UPPER), boundFilter).nonEmpty()) {
-                        maximizeInst(uv, Warner.noWarnings);
+                        maximizeInst(uv, types.noWarnings);
                     }
                 }
 
@@ -801,7 +801,7 @@
             for (Type t : varsToSolve) {
                 UndetVar uv = (UndetVar)asFree(t, types);
                 if (uv.inst == null) {
-                    infer.minimizeInst(uv, Warner.noWarnings);
+                    infer.minimizeInst(uv, types.noWarnings);
                     if (uv.inst != null) {
                         progress = true;
                     }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Sat Nov 17 19:01:03 2012 +0000
@@ -682,7 +682,7 @@
     /** Look up a method in a given scope.
      */
     private MethodSymbol lookupMethod(DiagnosticPosition pos, Name name, Type qual, List<Type> args) {
-        return rs.resolveInternalMethod(pos, attrEnv, qual, name, args, null);
+        return rs.resolveInternalMethod(pos, attrEnv, qual, name, args, List.<Type>nil());
     }
 
     /** Look up a constructor.
@@ -3636,13 +3636,13 @@
         boolean qualifiedSuperAccess =
             tree.selected.hasTag(SELECT) &&
             TreeInfo.name(tree.selected) == names._super &&
-            !types.isDirectSuperInterface(((JCFieldAccess)tree.selected).selected.type, currentClass);
+            !types.isDirectSuperInterface(((JCFieldAccess)tree.selected).selected.type.tsym, currentClass);
         tree.selected = translate(tree.selected);
         if (tree.name == names._class) {
             result = classOf(tree.selected);
         }
         else if (tree.name == names._super &&
-                types.isDirectSuperInterface(tree.selected.type, currentClass)) {
+                types.isDirectSuperInterface(tree.selected.type.tsym, currentClass)) {
             //default super call!! Not a classic qualified super call
             TypeSymbol supSym = tree.selected.type.tsym;
             Assert.checkNonNull(types.asSuper(currentClass.type, supSym));
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Sat Nov 17 19:01:03 2012 +0000
@@ -427,6 +427,60 @@
             return c != null;
         }
 
+    /**
+     * Performs a recursive scan of a type looking for accessibility problems
+     * from current attribution environment
+     */
+    void checkAccessibleType(Env<AttrContext> env, Type t) {
+        accessibilityChecker.visit(t, env);
+    }
+
+    /**
+     * Accessibility type-visitor
+     */
+    Types.SimpleVisitor<Void, Env<AttrContext>> accessibilityChecker =
+            new Types.SimpleVisitor<Void, Env<AttrContext>>() {
+
+        void visit(List<Type> ts, Env<AttrContext> env) {
+            for (Type t : ts) {
+                visit(t, env);
+            }
+        }
+
+        public Void visitType(Type t, Env<AttrContext> env) {
+            return null;
+        }
+
+        @Override
+        public Void visitArrayType(ArrayType t, Env<AttrContext> env) {
+            visit(t.elemtype, env);
+            return null;
+        }
+
+        @Override
+        public Void visitClassType(ClassType t, Env<AttrContext> env) {
+            visit(t.getTypeArguments(), env);
+            if (!isAccessible(env, t, true)) {
+                accessBase(new AccessError(t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
+            }
+            return null;
+        }
+
+        @Override
+        public Void visitWildcardType(WildcardType t, Env<AttrContext> env) {
+            visit(t.type, env);
+            return null;
+        }
+
+        @Override
+        public Void visitMethodType(MethodType t, Env<AttrContext> env) {
+            visit(t.getParameterTypes(), env);
+            visit(t.getReturnType(), env);
+            visit(t.getThrownTypes(), env);
+            return null;
+        }
+    };
+
     /** Try to instantiate the type of a method so that it fits
      *  given type arguments and argument types. If succesful, return
      *  the method's instantiated type, else return null.
@@ -750,10 +804,6 @@
         public boolean compatible(Type found, Type req, Warner warn) {
             return types.isSubtypeUnchecked(found, inferenceContext.asFree(req, types), warn);
         }
-
-        public boolean allowBoxing() {
-            return false;
-        }
     }
 
     /**
@@ -770,10 +820,6 @@
         public boolean compatible(Type found, Type req, Warner warn) {
             return types.isConvertible(found, inferenceContext.asFree(req, types), warn);
         }
-
-        public boolean allowBoxing() {
-            return true;
-        }
     }
 
     /**
@@ -792,7 +838,7 @@
 
         DeferredAttr.DeferredAttrContext deferredAttrContext;
 
-        public MethodResultInfo(Type pt, MethodCheckContext checkContext, DeferredAttr.DeferredAttrContext deferredAttrContext) {
+        public MethodResultInfo(Type pt, CheckContext checkContext, DeferredAttr.DeferredAttrContext deferredAttrContext) {
             attr.super(VAL, pt, checkContext);
             this.deferredAttrContext = deferredAttrContext;
         }
@@ -809,7 +855,12 @@
 
         @Override
         protected MethodResultInfo dup(Type newPt) {
-            return new MethodResultInfo(newPt, (MethodCheckContext)checkContext, deferredAttrContext);
+            return new MethodResultInfo(newPt, checkContext, deferredAttrContext);
+        }
+
+        @Override
+        protected ResultInfo dup(CheckContext newContext) {
+            return new MethodResultInfo(pt, newContext, deferredAttrContext);
         }
     }
 
@@ -1020,7 +1071,7 @@
         Assert.check(sym.kind < AMBIGUOUS);
         try {
             Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes,
-                               allowBoxing, useVarargs, Warner.noWarnings);
+                               allowBoxing, useVarargs, types.noWarnings);
             if (!operator)
                 currentResolutionContext.addApplicableCandidate(sym, mt);
         } catch (InapplicableMethodException ex) {
@@ -1921,28 +1972,31 @@
                         (typeargtypes == null || !Type.isErroneous(typeargtypes));
         }
         public List<Type> getArgumentTypes(ResolveError errSym, Symbol accessedSym, Name name, List<Type> argtypes) {
-            if (syms.operatorNames.contains(name)) {
-                return argtypes;
-            } else {
-                Symbol msym = errSym.kind == WRONG_MTH ?
-                        ((InapplicableSymbolError)errSym).errCandidate().sym : accessedSym;
-
-                List<Type> argtypes2 = Type.map(argtypes,
-                        deferredAttr.new RecoveryDeferredTypeMap(AttrMode.SPECULATIVE, msym, currentResolutionContext.step));
-
-                if (msym != accessedSym) {
-                    //fixup deferred type caches - this 'hack' is required because the symbol
-                    //returned by InapplicableSymbolError.access() will hide the candidate
-                    //method symbol that can be used for lookups in the speculative cache,
-                    //causing problems in Attr.checkId()
-                    for (Type t : argtypes) {
-                        if (t.hasTag(DEFERRED)) {
-                            DeferredType dt = (DeferredType)t;
-                            dt.speculativeCache.dupAllTo(msym, accessedSym);
-                        }
+            return (syms.operatorNames.contains(name)) ?
+                    argtypes :
+                    Type.map(argtypes, new ResolveDeferredRecoveryMap(accessedSym));
+        }
+
+        class ResolveDeferredRecoveryMap extends DeferredAttr.RecoveryDeferredTypeMap {
+
+            public ResolveDeferredRecoveryMap(Symbol msym) {
+                deferredAttr.super(AttrMode.SPECULATIVE, msym, currentResolutionContext.step);
+            }
+
+            @Override
+            protected Type typeOf(DeferredType dt) {
+                Type res = super.typeOf(dt);
+                if (!res.isErroneous()) {
+                    switch (TreeInfo.skipParens(dt.tree).getTag()) {
+                        case LAMBDA:
+                        case REFERENCE:
+                            return dt;
+                        case CONDEXPR:
+                            return res == Type.recoveryType ?
+                                    dt : res;
                     }
                 }
-                return argtypes2;
+                return res;
             }
         }
     };
@@ -2069,7 +2123,6 @@
                 } else if (allowMethodHandles) {
                     MethodSymbol msym = (MethodSymbol)sym;
                     if (msym.isSignaturePolymorphic(types)) {
-                        env.info.pendingResolutionPhase = BASIC;
                         return findPolymorphicSignatureInstance(env, sym, argtypes);
                     }
                 }
@@ -2086,7 +2139,7 @@
      *  @param argtypes  The required argument types
      */
     Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
-                                            Symbol spMethod,
+                                            final Symbol spMethod,
                                             List<Type> argtypes) {
         Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
                 (MethodSymbol)spMethod, currentResolutionContext, argtypes);
@@ -2098,7 +2151,12 @@
 
         // create the desired method
         long flags = ABSTRACT | HYPOTHETICAL | spMethod.flags() & Flags.AccessFlags;
-        Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner);
+        Symbol msym = new MethodSymbol(flags, spMethod.name, mtype, spMethod.owner) {
+            @Override
+            public Symbol baseSymbol() {
+                return spMethod;
+            }
+        };
         polymorphicSignatureScope.enter(msym);
         return msym;
     }
@@ -2707,7 +2765,7 @@
         }
         if (allowDefaultMethods && c.isInterface() &&
                 name == names._super && !isStatic(env) &&
-                types.isDirectSuperInterface(c.type, env.enclClass.sym)) {
+                types.isDirectSuperInterface(c, env.enclClass.sym)) {
             //this might be a default super call if one of the superinterfaces is 'c'
             for (Type t : pruneInterfaces(env.enclClass.type)) {
                 if (t.tsym == c) {
@@ -3150,7 +3208,7 @@
                         "cant.apply.symbols",
                         name == names.init ? KindName.CONSTRUCTOR : absentKind(kind),
                         name == names.init ? site.tsym.name : name,
-                        argtypes);
+                        methodArguments(argtypes));
                 return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
             } else {
                 return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Sat Nov 17 19:01:03 2012 +0000
@@ -133,7 +133,7 @@
     JCExpression coerce(JCExpression tree, Type target) {
         Type btarget = target.baseType();
         if (tree.type.isPrimitive() == target.isPrimitive()) {
-            return types.isAssignable(tree.type, btarget, Warner.noWarnings)
+            return types.isAssignable(tree.type, btarget, types.noWarnings)
                 ? tree
                 : cast(tree, btarget);
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Sat Nov 17 19:01:03 2012 +0000
@@ -941,18 +941,6 @@
 
             new AttributeReader(names.Code, V45_3, MEMBER_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
-                    if (currentOwner.isInterface() &&
-                            (sym.flags_field & ABSTRACT) == 0 && !name.equals(names.clinit)) {
-                        if (majorVersion > Target.JDK1_8.majorVersion ||
-                                //todo replace with Target.Version when available
-                                (majorVersion == Target.JDK1_8.majorVersion && minorVersion >= Target.JDK1_8.minorVersion)) {
-                            currentOwner.flags_field |= DEFAULT;
-                            sym.flags_field |= DEFAULT | ABSTRACT;
-                        } else {
-                            //protect against ill-formed classfiles
-                            throw new CompletionFailure(currentOwner, "default method found in pre JDK 8 classfile");
-                        }
-                    }
                     if (readAllOfClassFile || saveParameterNames)
                         ((MethodSymbol)sym).code = readCode(sym);
                     else
@@ -1753,6 +1741,17 @@
         long flags = adjustMethodFlags(nextChar());
         Name name = readName(nextChar());
         Type type = readType(nextChar());
+        if (currentOwner.isInterface() &&
+                (flags & ABSTRACT) == 0 && !name.equals(names.clinit)) {
+            if (majorVersion > Target.JDK1_8.majorVersion ||
+                    (majorVersion == Target.JDK1_8.majorVersion && minorVersion >= Target.JDK1_8.minorVersion)) {
+                currentOwner.flags_field |= DEFAULT;
+                flags |= DEFAULT | ABSTRACT;
+            } else {
+                //protect against ill-formed classfiles
+                throw new CompletionFailure(currentOwner, "default method found in pre JDK 8 classfile");
+            }
+        }
         if (name == names.init && currentOwner.hasOuterInstance()) {
             // Sometimes anonymous classes don't have an outer
             // instance, however, there is no reliable way to tell so
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Sat Nov 17 19:01:03 2012 +0000
@@ -95,10 +95,7 @@
      *  package.  Return the object's index in the pool.
      */
     public int put(Object value) {
-        if (value instanceof MethodSymbol)
-            value = new Method((MethodSymbol)value);
-        else if (value instanceof VarSymbol)
-            value = new Variable((VarSymbol)value);
+        value = makePoolValue(value);
 //      assert !(value instanceof Type.TypeVar);
         Integer index = indices.get(value);
         if (index == null) {
@@ -115,6 +112,18 @@
         return index.intValue();
     }
 
+    Object makePoolValue(Object o) {
+        if (o instanceof DynamicMethodSymbol) {
+            return new DynamicMethod((DynamicMethodSymbol)o);
+        } else if (o instanceof MethodSymbol) {
+            return new Method((MethodSymbol)o);
+        } else if (o instanceof VarSymbol) {
+            return new Variable((VarSymbol)o);
+        } else {
+            return o;
+        }
+    }
+
     /** Return the given object's index in the pool,
      *  or -1 if object is not in there.
      */
@@ -145,6 +154,36 @@
         }
     }
 
+    static class DynamicMethod extends Method {
+
+        DynamicMethod(DynamicMethodSymbol m) {
+            super(m);
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (!super.equals(other)) return false;
+            if (!(other instanceof DynamicMethod)) return false;
+            DynamicMethodSymbol dm1 = (DynamicMethodSymbol)m;
+            DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)other).m;
+            return dm1.bsm == dm2.bsm &&
+                        dm1.bsmKind == dm2.bsmKind &&
+                        Arrays.equals(dm1.staticArgs, dm2.staticArgs);
+        }
+
+        @Override
+        public int hashCode() {
+            int hash = super.hashCode();
+            DynamicMethodSymbol dm = (DynamicMethodSymbol)m;
+            hash += dm.bsmKind * 7 +
+                    dm.bsm.hashCode() * 11;
+            for (int i = 0; i < dm.staticArgs.length; i++) {
+                hash += (dm.staticArgs[i].hashCode() * 23);
+            }
+            return hash;
+        }
+    }
+
     static class Variable extends DelegatedSymbol {
         VarSymbol v;
         Variable(VarSymbol v) {
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Sat Nov 17 19:01:03 2012 +0000
@@ -121,12 +121,9 @@
         this.allowDiamond = source.allowDiamond();
         this.allowMulticatch = source.allowMulticatch();
         this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true);
-        this.allowLambda = source.allowLambda() &&
-                fac.options.isSet("allowLambda"); //pre-lambda guard
-        this.allowMethodReferences = source.allowMethodReferences() &&
-                fac.options.isSet("allowMethodReferences"); //pre-lambda guard
-        this.allowDefaultMethods = source.allowDefaultMethods() &&
-                fac.options.isSet("allowDefaultMethods"); //pre-lambda guard
+        this.allowLambda = source.allowLambda();
+        this.allowMethodReferences = source.allowMethodReferences();
+        this.allowDefaultMethods = source.allowDefaultMethods();
         this.keepDocComments = keepDocComments;
         docComments = newDocCommentTable(keepDocComments, fac);
         this.keepLineMap = keepLineMap;
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Sat Nov 17 19:01:03 2012 +0000
@@ -170,19 +170,6 @@
 compiler.misc.cant.apply.symbols=\
     no suitable {0} found for {1}({2})
 
-
-# 0: type
-compiler.err.cant.access.arg.type.in.functional.desc=\
-    cannot access parameter type {0} in target functional descriptor
-
-# 0: type
-compiler.err.cant.access.return.in.functional.desc=\
-    cannot access return type {0} in target functional descriptor
-
-# 0: type
-compiler.err.cant.access.thrown.in.functional.desc=\
-    cannot access thrown type {0} in target functional descriptor
-
 # 0: symbol kind, 1: symbol
 compiler.misc.no.abstracts=\
     no abstract method found in {0} {1}
@@ -257,9 +244,6 @@
 compiler.err.cant.ref.before.ctor.called=\
     cannot reference {0} before supertype constructor has been called
 
-compiler.err.cant.ret.val.from.meth.decl.void=\
-    cannot return a value from method whose result type is void
-
 compiler.err.cant.select.static.class.from.param.type=\
     cannot select a static class from a parameterized type
 
@@ -661,8 +645,8 @@
 compiler.misc.missing.ret.val=\
     missing return value
 
-compiler.err.missing.ret.val=\
-    missing return value
+compiler.misc.unexpected.ret.val=\
+    unexpected return value
 
 # 0: set of modifier
 compiler.err.mod.not.allowed.here=\
@@ -708,6 +692,9 @@
 compiler.misc.incompatible.type.in.conditional=\
     bad type in conditional expression; {0}
 
+compiler.misc.conditional.target.cant.be.void=\
+    target-type for conditional expression cannot be void
+
 # 0: type
 compiler.misc.incompatible.ret.type.in.lambda=\
     bad return type in lambda expression\n\
@@ -960,7 +947,7 @@
 
 # 0: symbol, 1: type
 compiler.misc.overridden.default=\
-    method {0} is overridden in {2}
+    method {0} is overridden in {1}
 
 # 0: symbol, 1: symbol
 compiler.misc.redundant.supertype=\
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1110,7 +1110,7 @@
     public void visitReference(JCMemberReference tree) {
         try {
             printExpr(tree.expr);
-            print("#");
+            print("::");
             if (tree.typeargs != null) {
                 print("<");
                 printExprs(tree.typeargs);
--- a/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Sat Nov 17 19:01:03 2012 +0000
@@ -525,7 +525,8 @@
                     bound = ((ErrorType)bound).getOriginalType();
                 //retrieve the bound list - if the type variable
                 //has not been attributed the bound is not set
-                List<Type> bounds = bound != null ?
+                List<Type> bounds = (bound != null) &&
+                        (bound.hasTag(CLASS) || bound.hasTag(TYPEVAR)) ?
                     types.getBounds(t) :
                     List.<Type>nil();
 
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Warner.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Warner.java	Sat Nov 17 19:01:03 2012 +0000
@@ -39,7 +39,6 @@
  * deletion without notice.</b>
  */
 public class Warner {
-    public static final Warner noWarnings = new Warner();
 
     private DiagnosticPosition pos = null;
     protected boolean warned = false;
--- a/langtools/test/tools/javac/conditional/Conditional.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/conditional/Conditional.java	Sat Nov 17 19:01:03 2012 +0000
@@ -27,8 +27,8 @@
  * @summary Conditional operator applies assignment conversion
  * @author Tim Hanson, BEA
  *
- * @compile -XDallowPoly Conditional.java
- * @compile/fail Conditional.java
+ * @compile Conditional.java
+ * @compile/fail -source 7 Conditional.java
  */
 
 import java.util.*;
--- a/langtools/test/tools/javac/defaultMethods/ClassReaderTest/ClassReaderTest.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/ClassReaderTest/ClassReaderTest.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary check that default methods don't cause ClassReader to complete classes recursively
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods pkg/Foo.java
+ * @compile pkg/Foo.java
  * @compile ClassReaderTest.java
  */
 
--- a/langtools/test/tools/javac/defaultMethods/Neg01.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary negative test for ambiguous defaults
- * @compile/fail/ref=Neg01.out -XDallowDefaultMethods -XDrawDiagnostics Neg01.java
+ * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java
  */
 
 class Neg01 {
--- a/langtools/test/tools/javac/defaultMethods/Neg02.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that ill-formed MI hierarchies do not compile
- * @compile/fail/ref=Neg02.out -XDallowDefaultMethods -XDrawDiagnostics Neg02.java
+ * @compile/fail/ref=Neg02.out -XDrawDiagnostics Neg02.java
  */
 
 class Neg02 {
--- a/langtools/test/tools/javac/defaultMethods/Neg03.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg03.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that re-abstraction works properly
- * @compile/fail/ref=Neg03.out -XDallowDefaultMethods -XDrawDiagnostics Neg03.java
+ * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
  */
 
 class Neg03 {
--- a/langtools/test/tools/javac/defaultMethods/Neg04.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg04.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that default method must have most specific return type
- * @compile/fail/ref=Neg04.out -XDallowDefaultMethods -XDrawDiagnostics Neg04.java
+ * @compile/fail/ref=Neg04.out -XDrawDiagnostics Neg04.java
  */
 
 class Neg04 {
--- a/langtools/test/tools/javac/defaultMethods/Neg05.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg05.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that abstract methods are compatible with inherited defaults
- * @compile/fail/ref=Neg05.out -XDallowDefaultMethods -XDrawDiagnostics Neg05.java
+ * @compile/fail/ref=Neg05.out -XDrawDiagnostics Neg05.java
  */
 
 class Neg05 {
--- a/langtools/test/tools/javac/defaultMethods/Neg06.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg06.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary flow analysis is not run on inlined default bodies
- * @compile/fail/ref=Neg06.out -XDallowDefaultMethods -XDrawDiagnostics Neg06.java
+ * @compile/fail/ref=Neg06.out -XDrawDiagnostics Neg06.java
  */
 
 class Neg06 {
--- a/langtools/test/tools/javac/defaultMethods/Neg07.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg07.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that default overrides are properly type-checked
- * @compile/fail/ref=Neg07.out -XDallowDefaultMethods -XDrawDiagnostics Neg07.java
+ * @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java
  */
 
 class Neg07 {
--- a/langtools/test/tools/javac/defaultMethods/Neg08.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg08.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that default overrides are properly type-checked
- * @compile/fail/ref=Neg08.out -XDallowDefaultMethods -XDrawDiagnostics Neg08.java
+ * @compile/fail/ref=Neg08.out -XDrawDiagnostics Neg08.java
  */
 class Neg08 {
     interface I {
--- a/langtools/test/tools/javac/defaultMethods/Neg09.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg09.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that default overrides are properly type-checked
- * @compile/fail/ref=Neg09.out -Werror -Xlint:unchecked -XDallowDefaultMethods -XDrawDiagnostics Neg09.java
+ * @compile/fail/ref=Neg09.out -Werror -Xlint:unchecked -XDrawDiagnostics Neg09.java
  */
 import java.util.List;
 
--- a/langtools/test/tools/javac/defaultMethods/Neg10.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg10.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that default overrides are properly type-checked
- * @compile/fail/ref=Neg10.out -Werror -Xlint:unchecked -XDallowDefaultMethods -XDrawDiagnostics Neg10.java
+ * @compile/fail/ref=Neg10.out -Werror -Xlint:unchecked -XDrawDiagnostics Neg10.java
  */
 class Neg10 {
     interface I<X extends Exception> {
--- a/langtools/test/tools/javac/defaultMethods/Neg11.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg11.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that default overrides are properly type-checked
- * @compile/fail/ref=Neg11.out -XDallowDefaultMethods -XDrawDiagnostics Neg11.java
+ * @compile/fail/ref=Neg11.out -XDrawDiagnostics Neg11.java
  */
 class Neg11 {
     interface I {
--- a/langtools/test/tools/javac/defaultMethods/Neg12.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg12.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that abstract methods are discarded in overload resolution diags
- * @compile/fail/ref=Neg12.out -XDallowDefaultMethods -XDrawDiagnostics Neg12.java
+ * @compile/fail/ref=Neg12.out -XDrawDiagnostics Neg12.java
  */
 class Neg12 {
 
--- a/langtools/test/tools/javac/defaultMethods/Neg12.out	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg12.out	Sat Nov 17 19:01:03 2012 +0000
@@ -1,4 +1,4 @@
 Neg12.java:21:12: compiler.err.does.not.override.abstract: Neg12.D, m(java.lang.String), Neg12.I2
-Neg12.java:24:10: compiler.err.cant.apply.symbols: kindname.method, m, ,{(compiler.misc.inapplicable.method: kindname.method, Neg12.I1, m(java.lang.String), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, Neg12.B, m(java.lang.Integer), (compiler.misc.arg.length.mismatch))}
+Neg12.java:24:10: compiler.err.cant.apply.symbols: kindname.method, m, compiler.misc.no.args,{(compiler.misc.inapplicable.method: kindname.method, Neg12.I1, m(java.lang.String), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, Neg12.B, m(java.lang.Integer), (compiler.misc.arg.length.mismatch))}
 Neg12.java:25:10: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Integer, compiler.misc.no.args, kindname.class, Neg12.B, (compiler.misc.arg.length.mismatch)
 3 errors
--- a/langtools/test/tools/javac/defaultMethods/Neg13.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg13.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that default method overriding object members are flagged as error
- * @compile/fail/ref=Neg13.out -XDallowDefaultMethods -XDrawDiagnostics Neg13.java
+ * @compile/fail/ref=Neg13.out -XDrawDiagnostics Neg13.java
  */
 interface Neg13 {
     default protected Object clone() { return null; } //protected not allowed here
--- a/langtools/test/tools/javac/defaultMethods/Neg14.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg14.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that a class cannot have two sibling interfaces with a default and abstract method
- * @compile/fail/ref=Neg14.out -XDallowDefaultMethods -XDrawDiagnostics Neg14.java
+ * @compile/fail/ref=Neg14.out -XDrawDiagnostics Neg14.java
  */
 class Neg14 {
     interface IA { int m(); }
--- a/langtools/test/tools/javac/defaultMethods/Neg15.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg15.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that level skipping in default super calls is correctly rejected
- * @compile/fail/ref=Neg15.out -XDallowDefaultMethods -XDrawDiagnostics Neg15.java
+ * @compile/fail/ref=Neg15.out -XDrawDiagnostics Neg15.java
  */
 class Neg15 {
     interface I { default void m() {  } }
--- a/langtools/test/tools/javac/defaultMethods/Neg16.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Neg16.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,7 +1,7 @@
 /*
  * @test /nodynamiccopyright/
  * @summary check that level skipping in default super calls is correctly rejected
- * @compile/fail/ref=Neg16.out -XDallowDefaultMethods -XDrawDiagnostics Neg16.java
+ * @compile/fail/ref=Neg16.out -XDrawDiagnostics Neg16.java
  */
 class Neg16 {
     interface I { default void m() {  } }
--- a/langtools/test/tools/javac/defaultMethods/Pos01.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,14 +24,12 @@
 /*
  * @test
  * @summary basic test for default methods
- * @ignore awaits lambda support
  * @author  Maurizio Cimadamore
- * @compile -XDallowLambda -XDallowPoly -XDallowDefaultMethods Pos01.java
  */
 
 import java.util.*;
 
-class Pos01 {
+public class Pos01 {
 
     interface Mapper<T> {
         T map(T in);
--- a/langtools/test/tools/javac/defaultMethods/Pos02.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary test for explicit resolution of ambiguous default methods
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods Pos02.java
+ * @compile Pos02.java
  */
 
 class Pos02 {
--- a/langtools/test/tools/javac/defaultMethods/Pos04.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos04.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary test for overriding with default method
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods Pos04.java
+ * @compile Pos04.java
  */
 
 class Pos04 {
--- a/langtools/test/tools/javac/defaultMethods/Pos05.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos05.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary check that indirectly inherited default methods are discovered during resolution
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods Pos05.java
+ * @compile Pos05.java
  */
 
 class Pos05  {
--- a/langtools/test/tools/javac/defaultMethods/Pos06.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos06.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary check that well-formed MI hierarchies behaves well w.r.t. method resolution (i.e. no ambiguities)
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods Pos06.java
+ * @compile Pos06.java
  */
 
 class Pos06 {
--- a/langtools/test/tools/javac/defaultMethods/Pos07.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos07.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary check that compilation order does not matter
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods Pos07.java
+ * @compile Pos07.java
  */
 
 class Pos07 {
--- a/langtools/test/tools/javac/defaultMethods/Pos08.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos08.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary check that common overrider solves default method conflicts
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods Pos08.java
+ * @compile Pos08.java
  */
 
 class Pos08 {
--- a/langtools/test/tools/javac/defaultMethods/Pos10.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos10.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary check that type-variables in generic extension decl can be accessed from default impl
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods Pos10.java
+ * @compile Pos10.java
  */
 
 class Pos10 {
--- a/langtools/test/tools/javac/defaultMethods/Pos11.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos11.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,7 +25,7 @@
  * @test
  * @summary complex test with conflict resolution via overriding
  * @author  Brian Goetz
- * @compile -XDallowDefaultMethods Pos11.java
+ * @compile Pos11.java
  */
 
 class Pos11 {
--- a/langtools/test/tools/javac/defaultMethods/Pos12.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos12.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary check that 'this' can be used from within an extension method
- * @compile -XDallowDefaultMethods Pos12.java
+ * @compile Pos12.java
  */
 
 interface Pos12 {
--- a/langtools/test/tools/javac/defaultMethods/Pos13.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos13.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary qualified 'this' inside default method causes StackOverflowException
- * @compile -XDallowDefaultMethods Pos13.java
+ * @compile Pos13.java
  */
 
 public class Pos13 {
--- a/langtools/test/tools/javac/defaultMethods/Pos14.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos14.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary check that overload resolution selects most specific signature
- * @compile -XDallowDefaultMethods Pos14.java
+ * @compile Pos14.java
  */
 
 class Pos14 {
--- a/langtools/test/tools/javac/defaultMethods/Pos15.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos15.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary check that overload resolution selects most specific signature
- * @compile -XDallowDefaultMethods Pos15.java
+ * @compile Pos15.java
  */
 
 class Pos15 {
--- a/langtools/test/tools/javac/defaultMethods/Pos16.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Pos16.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,7 @@
 /*
  * @test
  * @summary 'class wins' should not short-circuit overload resolution
- * @compile -XDallowDefaultMethods Pos16.java
+ * @compile Pos16.java
  */
 
 class Pos16 {
--- a/langtools/test/tools/javac/defaultMethods/TestDefaultBody.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/TestDefaultBody.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,10 +23,7 @@
 
 /*
  * @test
- * @ignore awaits for VM support
  * @summary  check that code attributed for default methods is correctly generated
- * @compile -XDallowDefaultMethods TestDefaultBody.java
- * @run main TestDefaultBody
  */
 
 import com.sun.tools.classfile.AccessFlags;
--- a/langtools/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,8 +25,6 @@
  * @test
  * @ignore awaits for VM support
  * @summary  check that javac does not generate bridge methods for defaults
- * @compile -XDallowDefaultMethods TestNoBridgeOnDefaults.java
- * @run main TestNoBridgeOnDefaults
  */
 
 import com.sun.tools.classfile.ClassFile;
--- a/langtools/test/tools/javac/defaultMethods/fd/FDTest.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/fd/FDTest.java	Sat Nov 17 19:01:03 2012 +0000
@@ -82,7 +82,7 @@
 
     void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
         JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
-                Arrays.asList("-XDallowDefaultMethods"), null, Arrays.asList(source));
+                null, null, Arrays.asList(source));
         try {
             ct.analyze();
         } catch (Throwable ex) {
--- a/langtools/test/tools/javac/defaultMethods/separate/Separate.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/separate/Separate.java	Sat Nov 17 19:01:03 2012 +0000
@@ -25,8 +25,8 @@
  * @test
  * @summary smoke test for separate compilation of default methods
  * @author  Maurizio Cimadamore
- * @compile -XDallowDefaultMethods pkg1/A.java
- * @compile -XDallowDefaultMethods Separate.java
+ * @compile  pkg1/A.java
+ * @compile  Separate.java
  */
 
 import pkg1.A;
--- a/langtools/test/tools/javac/defaultMethods/super/TestDefaultSuperCall.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/super/TestDefaultSuperCall.java	Sat Nov 17 19:01:03 2012 +0000
@@ -323,7 +323,7 @@
 
     void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
         JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
-                Arrays.asList("-XDallowDefaultMethods"), null, Arrays.asList(source));
+                null, null, Arrays.asList(source));
         try {
             ct.analyze();
         } catch (Throwable ex) {
--- a/langtools/test/tools/javac/defaultMethods/syntax/TestDefaultMethodsSyntax.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/defaultMethods/syntax/TestDefaultMethodsSyntax.java	Sat Nov 17 19:01:03 2012 +0000
@@ -54,7 +54,7 @@
         }
 
         List<String> getOptions() {
-            return Arrays.asList("-XDallowDefaultMethods", "-source", versionString);
+            return Arrays.asList("-source", versionString);
         }
     }
 
--- a/langtools/test/tools/javac/diags/examples/CantAccessArgTypeInFunctionalDesc.java	Fri Nov 16 18:27:36 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.cant.access.arg.type.in.functional.desc
-// key: compiler.err.report.access
-// options: -XDallowLambda
-
-interface SAM_InaccessibleArg {
-    void m(Foo.Bar bar);
-    static class Foo { private class Bar { } }
-}
-
-class CantAccessArgTypeInFunctionalDesc {
-    SAM_InaccessibleArg s = x-> { };
-}
--- a/langtools/test/tools/javac/diags/examples/CantAccessInnerClsConstr.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantAccessInnerClsConstr.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.cant.access.inner.cls.constr
 // key: compiler.misc.invalid.mref
-// options: -XDallowMethodReferences
 
 class CantAccessInnerClsConstructor {
 
--- a/langtools/test/tools/javac/diags/examples/CantAccessReturnTypeInFunctionalDesc.java	Fri Nov 16 18:27:36 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.cant.access.return.in.functional.desc
-// options: -XDallowLambda
-
-interface SAM_InaccessibleRet {
-    Foo.Bar m();
-    static class Foo { private class Bar { } }
-}
-
-class CantAccessReturnTypeInFunctionalDesc {
-    SAM_InaccessibleRet s = ()->null;
-}
--- a/langtools/test/tools/javac/diags/examples/CantAccessThrownTypesInFunctionalDesc.java	Fri Nov 16 18:27:36 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.cant.access.thrown.in.functional.desc
-// options: -XDallowLambda
-
-interface SAM_InaccessibleThrown {
-    void m() throws Foo.Bar;
-    static class Foo { private class Bar extends Exception { } }
-}
-
-class CantAccessThrownTypesInFunctionalDesc {
-    SAM_InaccessibleThrown s = ()-> { };
-}
--- a/langtools/test/tools/javac/diags/examples/CantApplySymbolFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantApplySymbolFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -26,7 +26,6 @@
 // key: compiler.misc.no.conforming.assignment.exists
 // key: compiler.misc.cant.apply.symbol
 // key: compiler.misc.invalid.mref
-// options: -XDallowMethodReferences
 
 class CantApplySymbolFragment {
 
--- a/langtools/test/tools/javac/diags/examples/CantApplySymbolsFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantApplySymbolsFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -28,7 +28,6 @@
 // key: compiler.misc.inapplicable.method
 // key: compiler.misc.cant.apply.symbols
 // key: compiler.misc.invalid.mref
-// options: -XDallowMethodReferences
 
 class CantApplySymbolsFragment {
 
--- a/langtools/test/tools/javac/diags/examples/CantRefNonEffectivelyFinalVar.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantRefNonEffectivelyFinalVar.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.cant.ref.non.effectively.final.var
 // key: compiler.misc.inner.cls
 // key: compiler.misc.lambda
-// options: -XDallowLambda -XDallowEffectivelyFinalInInnerClasses
 
 class CantRefNonEffectivelyFinalVar {
     void test() {
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.misc.cant.resolve.location.args
 // key: compiler.misc.location
 // key: compiler.err.invalid.mref
-// options: -XDallowMethodReferences
 
 class CantResolveLocationArgsFragment {
 
--- a/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParamsFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantResolveLocationArgsParamsFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.misc.cant.resolve.location.args.params
 // key: compiler.misc.location
 // key: compiler.err.invalid.mref
-// options: -XDallowMethodReferences
 
 class CantResolveLocationArgsParamsFragment {
 
--- a/langtools/test/tools/javac/diags/examples/CantReturnValueForVoid.java	Fri Nov 16 18:27:36 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.cant.ret.val.from.meth.decl.void
-
-class CantReturnValueForVoid {
-    void m() {
-        return 3;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ConditionalTargetCantBeVoid.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.prob.found.req
+// key: compiler.misc.incompatible.ret.type.in.lambda
+// key: compiler.misc.conditional.target.cant.be.void
+
+class ConditionalTargetCantBeVoid {
+
+    interface SAM {
+        void m();
+    }
+
+    void test(boolean cond, Object o1, Object o2) {
+        SAM s = ()-> cond ? o1 : o2;
+    }
+}
--- a/langtools/test/tools/javac/diags/examples/CyclicInference.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/CyclicInference.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,7 +23,6 @@
 
 // key: compiler.err.cant.apply.symbol
 // key: compiler.misc.cyclic.inference
-// options: -XDallowLambda -XDallowPoly
 
 class CyclicInference {
     interface SAM<X> {
--- a/langtools/test/tools/javac/diags/examples/DefaultOverridesObjectMember.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/DefaultOverridesObjectMember.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,6 @@
  */
 
 // key: compiler.err.default.overrides.object.member
-// options: -XDallowDefaultMethods
 
 interface DefaultOverridesObjectMember {
     default String toString() { return ""; }
--- a/langtools/test/tools/javac/diags/examples/IncompatibleAbstracts.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleAbstracts.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.not.a.functional.intf.1
 // key: compiler.misc.incompatible.abstracts
-// options: -XDallowLambda
 
 class IncompatibleAbstracts {
 
--- a/langtools/test/tools/javac/diags/examples/IncompatibleArgTypesInLambda.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleArgTypesInLambda.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,7 +23,6 @@
 
 // key: compiler.err.prob.found.req
 // key: compiler.misc.incompatible.arg.types.in.lambda
-// options: -XDallowLambda -XDallowPoly
 
 class IncompatibleArgTypesInLambda {
     interface SAM {
--- a/langtools/test/tools/javac/diags/examples/IncompatibleDescsInFunctionalIntf.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleDescsInFunctionalIntf.java	Sat Nov 17 19:01:03 2012 +0000
@@ -26,7 +26,6 @@
 // key: compiler.misc.incompatible.descs.in.functional.intf
 // key: compiler.misc.descriptor
 // key: compiler.misc.descriptor.throws
-// options: -XDallowLambda
 
 class IncompatibleDescsInFunctionalIntf {
     interface A {
--- a/langtools/test/tools/javac/diags/examples/IncompatibleRetTypeInLambda.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleRetTypeInLambda.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.inconvertible.types
 // key: compiler.misc.incompatible.ret.type.in.lambda
-// options: -XDallowLambda -XDallowPoly
 
 class IncompatibleRetTypeInLambda {
     interface SAM {
--- a/langtools/test/tools/javac/diags/examples/IncompatibleRetTypeInMref.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleRetTypeInMref.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.inconvertible.types
 // key: compiler.misc.incompatible.ret.type.in.mref
-// options: -XDallowMethodReferences -XDallowPoly
 
 class IncompatibleRetTypeInMref {
     interface SAM {
--- a/langtools/test/tools/javac/diags/examples/IncompatibleThrownTypesInLambda.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleThrownTypesInLambda.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,6 @@
  */
 
 // key: compiler.err.incompatible.thrown.types.in.lambda
-// options: -XDallowLambda
 
 class IncompatibleThrownTypesInLambda {
     interface SAM {
--- a/langtools/test/tools/javac/diags/examples/IncompatibleThrownTypesInMref.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleThrownTypesInMref.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,6 @@
  */
 
 // key: compiler.err.incompatible.thrown.types.in.mref
-// options: -XDallowMethodReferences
 
 class IncompatibleThrownTypesInMref {
     interface SAM {
--- a/langtools/test/tools/javac/diags/examples/IncompatibleTypesInConditional.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/IncompatibleTypesInConditional.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.incompatible.type.in.conditional
 // key: compiler.misc.inconvertible.types
-// options: -XDallowPoly
 
 class IncompatibleTypesInConditional {
 
--- a/langtools/test/tools/javac/diags/examples/InvalidGenericDescInFunctionalInterface.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidGenericDescInFunctionalInterface.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,7 +23,6 @@
 
 // key: compiler.err.prob.found.req
 // key: compiler.misc.invalid.generic.desc.in.functional.intf
-// options: -XDallowLambda
 
 class InvalidGenericDescInFunctionalIntf {
 
--- a/langtools/test/tools/javac/diags/examples/LocalVarNeedsFinal.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/LocalVarNeedsFinal.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,6 +22,7 @@
  */
 
 // key: compiler.err.local.var.accessed.from.icls.needs.final
+// options: -Xlint:-options -source 7
 
 class LocalVarNeedsFinal {
     Runnable m() {
--- a/langtools/test/tools/javac/diags/examples/MissingReturnValue.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/MissingReturnValue.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,8 @@
  * questions.
  */
 
-// key: compiler.err.missing.ret.val
+// key: compiler.err.prob.found.req
+// key: compiler.misc.missing.ret.val
 
 class MissingReturnValue {
     int m() {
--- a/langtools/test/tools/javac/diags/examples/MissingReturnValueFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/MissingReturnValueFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.incompatible.ret.type.in.lambda
 // key: compiler.misc.missing.ret.val
-// options: -XDallowLambda
 
 class MissingReturnValueFragment {
     interface SAM {
--- a/langtools/test/tools/javac/diags/examples/NoAbstracts.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoAbstracts.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.not.a.functional.intf.1
 // key: compiler.misc.no.abstracts
-// options: -XDallowLambda
 
 class NoAbstracts {
 
--- a/langtools/test/tools/javac/diags/examples/NoSuitableFunctionalIntfInst.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/NoSuitableFunctionalIntfInst.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,7 +23,6 @@
 
 // key: compiler.err.prob.found.req
 // key: compiler.misc.no.suitable.functional.intf.inst
-// options: -XDallowLambda
 
 class NoSuitableFunctionalIntfInst {
 
--- a/langtools/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.non-static.cant.be.ref
 // key: compiler.misc.invalid.mref
-// options: -XDallowMethodReferences
 
 class NonStaticCantBeRefFragment {
 
--- a/langtools/test/tools/javac/diags/examples/NotAFunctionalIntf.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotAFunctionalIntf.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,7 +23,6 @@
 
 // key: compiler.err.prob.found.req
 // key: compiler.misc.not.a.functional.intf
-// options: -XDallowLambda
 
 class NotAFunctionalIntf {
 
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.not.def.access.class.intf.cant.access
 // key: compiler.misc.invalid.mref
-// options: -XDallowMethodReferences
 
 class NotDefAccessClassIntfCantAccessFragment {
 
--- a/langtools/test/tools/javac/diags/examples/OverriddenDefault.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/OverriddenDefault.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,7 +23,6 @@
 
 // key: compiler.err.illegal.default.super.call
 // key: compiler.misc.overridden.default
-// options: -XDallowDefaultMethods
 
 class OverriddenDefault {
     interface I { default void m() {  } }
@@ -33,4 +32,4 @@
     static class C implements J, K {
         void foo() { K.super.m(); }
     }
-}
\ No newline at end of file
+}
--- a/langtools/test/tools/javac/diags/examples/PotentialLambdaFound.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/PotentialLambdaFound.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.note.potential.lambda.found
-// options: -XDallowLambda -XDidentifyLambdaCandidate=true
+// options: -XDidentifyLambdaCandidate=true
 
 class PotentialLambdaFound {
 
--- a/langtools/test/tools/javac/diags/examples/RedundantSupertype.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/RedundantSupertype.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,7 +23,6 @@
 
 // key: compiler.err.illegal.default.super.call
 // key: compiler.misc.redundant.supertype
-// options: -XDallowDefaultMethods
 
 class RedundantSupertype {
     interface I { default void m() {  } }
--- a/langtools/test/tools/javac/diags/examples/RefAmbiguousFragment.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/RefAmbiguousFragment.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,6 @@
 // key: compiler.err.prob.found.req
 // key: compiler.misc.ref.ambiguous
 // key: compiler.misc.invalid.mref
-// options: -XDallowMethodReferences
 
 class RefAmbiguousFragment {
 
--- a/langtools/test/tools/javac/diags/examples/TypesIncompatibleAbstractDefault.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypesIncompatibleAbstractDefault.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,6 @@
  */
 
 // key: compiler.err.types.incompatible.abstract.default
-// options: -XDallowDefaultMethods
 
 class TypesIncompatibleAbstractDefault {
     interface A {
--- a/langtools/test/tools/javac/diags/examples/TypesIncompatibleUnrelatedDefaults.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/TypesIncompatibleUnrelatedDefaults.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,6 @@
  */
 
 // key: compiler.err.types.incompatible.unrelated.defaults
-// options: -XDallowDefaultMethods
 
 class TypesIncompatibleUnrelatedDefaults {
     interface A {
--- a/langtools/test/tools/javac/diags/examples/UnexpectedLambda.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnexpectedLambda.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,6 @@
  */
 
 // key: compiler.err.unexpected.lambda
-// options: -XDallowLambda
 
 class UnexpectedLambda {
     { (()-> { })++; }
--- a/langtools/test/tools/javac/diags/examples/UnexpectedMref.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnexpectedMref.java	Sat Nov 17 19:01:03 2012 +0000
@@ -22,7 +22,6 @@
  */
 
 // key: compiler.err.unexpected.mref
-// options: -XDallowMethodReferences
 
 class UnexpectedLambda {
     { (Foo::bar)++; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/UnexpectedReturnValue.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.prob.found.req
+// key: compiler.misc.unexpected.ret.val
+
+class UnexpectedReturnValue {
+    void m() {
+        return 3;
+    }
+}
--- a/langtools/test/tools/javac/generics/7022054/T7022054pos1.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/generics/7022054/T7022054pos1.java	Sat Nov 17 19:01:03 2012 +0000
@@ -27,7 +27,7 @@
  *
  * @summary  Invalid compiler error on covariant overriding methods with the same erasure
  * @compile -source 7 T7022054pos1.java
- * @compile/fail -XDstrictMethodClashCheck T7022054pos1.java
+ * @compile/fail/ref=T7022054pos1.out -XDrawDiagnostics T7022054pos1.java
  *
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/7022054/T7022054pos1.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+T7022054pos1.java:39:25: compiler.err.name.clash.same.erasure.no.override: <X>m(java.lang.String), T7022054pos1.B, m(java.lang.String), T7022054pos1.A, <X>m(java.lang.String), T7022054pos1.B
+1 error
--- a/langtools/test/tools/javac/generics/7022054/T7022054pos2.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/generics/7022054/T7022054pos2.java	Sat Nov 17 19:01:03 2012 +0000
@@ -27,7 +27,7 @@
  *
  * @summary  Invalid compiler error on covariant overriding methods with the same erasure
  * @compile -source 7 T7022054pos2.java
- * @compile/fail -XDstrictMethodClashCheck T7022054pos2.java
+ * @compile/fail/ref=T7022054pos2.out -XDrawDiagnostics T7022054pos2.java
  */
 
 class T7022054pos2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/7022054/T7022054pos2.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+T7022054pos2.java:38:32: compiler.err.name.clash.same.erasure.no.hide: <X>m(java.lang.String), T7022054pos2.B, m(java.lang.String), T7022054pos2.A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadAccess.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,30 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that non-static variables are not accessible from static lambdas
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadAccess.out -XDrawDiagnostics BadAccess.java
+ */
+
+public class BadAccess {
+
+    int i;
+    static int I;
+
+    interface SAM {
+        int m();
+    }
+
+    static void test1() {
+        int l = 0; //effectively final
+        final int L = 0;
+        SAM s = ()-> i + I + l + L;
+    }
+
+    void test2() {
+        int l = 0; //effectively final
+        final int L = 0;
+        SAM s = ()-> i + I + l + L;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadAccess.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+BadAccess.java:22:22: compiler.err.non-static.cant.be.ref: kindname.variable, i
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadAccess02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,31 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check lambda can access only effectively-final locals
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadAccess02.out -XDrawDiagnostics BadAccess02.java
+ */
+
+public class BadAccess02 {
+
+    interface SAM {
+        int m(int h);
+    }
+
+    static void test1() {
+        int l = 0; //effectively final
+        int j = 0; //non-effectively final
+        j = 2;
+        final int L = 0;
+        SAM s = (int h) -> { int k = 0; return h + j + l + L; };
+    }
+
+    void test2() {
+        int l = 0; //effectively final
+        int j = 0; //non-effectively final
+        j = 2;
+        final int L = 0;
+        SAM s = (int h) -> { int k = 0; return h + k + j + l + L; };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadAccess02.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,3 @@
+BadAccess02.java:21:52: compiler.err.cant.ref.non.effectively.final.var: j, (compiler.misc.lambda)
+BadAccess02.java:29:56: compiler.err.cant.ref.non.effectively.final.var: j, (compiler.misc.lambda)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadAccess03.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check lambda cannot assign non-effectively final locals
+ * @compile/fail/ref=BadAccess03.out -XDrawDiagnostics BadAccess03.java
+ */
+
+class BadAccess03 {
+    void test() {
+        int k = 0;
+        int n = 2; //effectively final variable
+        Runnable r = ()-> { k = n; }; //error
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadAccess03.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+BadAccess03.java:13:29: compiler.err.cant.ref.non.effectively.final.var: k, (compiler.misc.lambda)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadBreakContinue.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,44 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that break/continue is disallowed in lambda expressions
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadBreakContinue.out -XDrawDiagnostics BadBreakContinue.java
+ */
+
+class BadBreakContinue {
+
+    static interface SAM {
+       void m();
+    }
+
+    SAM s1 = ()-> { break; };
+    SAM s2 = ()-> { continue; };
+    SAM s3 = ()-> {
+        SAM s3_1 = ()-> { break; };
+        SAM s3_2 = ()-> { continue; };
+    };
+
+    void testLabelled() {
+        loop: while (true) {
+            SAM s1 = ()-> { break loop; };
+            SAM s2 = ()-> { continue loop; };
+            SAM s3 = ()-> {
+                SAM s3_1 = ()-> { break loop; };
+                SAM s3_2 = ()-> { continue loop; };
+            };
+        }
+    }
+
+    void testNonLabelled() {
+        while (true) {
+            SAM s1 = ()-> { break; };
+            SAM s2 = ()-> { continue; };
+            SAM s3 = ()-> {
+                SAM s3_1 = ()-> { break; };
+                SAM s3_2 = ()-> { continue; };
+            };
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadBreakContinue.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,13 @@
+BadBreakContinue.java:16:21: compiler.err.break.outside.switch.loop
+BadBreakContinue.java:17:21: compiler.err.cont.outside.loop
+BadBreakContinue.java:19:27: compiler.err.break.outside.switch.loop
+BadBreakContinue.java:20:27: compiler.err.cont.outside.loop
+BadBreakContinue.java:25:29: compiler.err.undef.label: loop
+BadBreakContinue.java:26:29: compiler.err.undef.label: loop
+BadBreakContinue.java:28:35: compiler.err.undef.label: loop
+BadBreakContinue.java:29:35: compiler.err.undef.label: loop
+BadBreakContinue.java:36:29: compiler.err.break.outside.switch.loop
+BadBreakContinue.java:37:29: compiler.err.cont.outside.loop
+BadBreakContinue.java:39:35: compiler.err.break.outside.switch.loop
+BadBreakContinue.java:40:35: compiler.err.cont.outside.loop
+12 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadConv03.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  NPE while checking if subinterface is a SAM type
+ * @compile/fail/ref=BadConv03.out -XDrawDiagnostics BadConv03.java
+ */
+
+class BadConv03 {
+
+    interface A {
+        void a();
+    }
+
+    interface B extends A { //not a SAM (2 non-override equivalent abstracts!)
+        void a(int i);
+    }
+
+    B b = ()-> { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadConv03.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+BadConv03.java:19:11: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, BadConv03.B))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadConv04.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,22 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that ill-formed SAM type generates right diagnostic when SAM converted
+ * @compile/fail/ref=BadConv04.out -XDrawDiagnostics BadConv04.java
+ */
+
+class BadConv04 {
+
+    interface I1 {
+        int m();
+    }
+
+    interface I2 {
+        long m();
+    }
+
+    interface SAM extends I1, I2 {}
+
+    SAM s = ()-> { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadConv04.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,3 @@
+BadConv04.java:19:5: compiler.err.types.incompatible.diff.ret: BadConv04.I2, BadConv04.I1, m()
+BadConv04.java:21:13: compiler.err.prob.found.req: (compiler.misc.incompatible.descs.in.functional.intf: kindname.interface, BadConv04.SAM,{(compiler.misc.descriptor: m, , long, ),(compiler.misc.descriptor: m, , int, )})
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadExpressionLambda.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that a conditonal can't be void
+ * @compile/fail/ref=BadExpressionLambda.out -XDrawDiagnostics BadExpressionLambda.java
+ */
+
+class BadExpressionLambda {
+
+    interface SAM {
+        void invoke();
+    }
+
+    public static void m() {}
+
+    void test() {
+        SAM sam1 = () -> m(); //ok
+        SAM sam2 = () -> true ? m() : m(); //not ok
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadExpressionLambda.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+BadExpressionLambda.java:19:31: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.conditional.target.cant.be.void))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadLambdaExpr.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  compile crashes on partial lambda expressions
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class BadLambdaExpr {
+
+    static int checkCount = 0;
+
+    enum ParameterListKind {
+        ZERO_ARY("()"),
+        UNARY("(#P)"),
+        TWO_ARY("(#P, #P)"),
+        THREE_ARY("(#P, #P, #P)");
+
+        String parametersTemplateStr;
+
+        ParameterListKind(String parametersTemplateStr) {
+            this.parametersTemplateStr = parametersTemplateStr;
+        }
+
+        String getParameterString(ParameterKind pk) {
+            return parametersTemplateStr.replaceAll("#P", pk.parameterStr);
+        }
+    }
+
+    enum ParameterKind {
+        IMPLICIT("a"),
+        EXPLIICT("A a");
+
+        String parameterStr;
+
+        ParameterKind(String parameterStr) {
+            this.parameterStr = parameterStr;
+        }
+    }
+
+    enum ArrowKind {
+        NONE(""),
+        SEMI("-"),
+        FULL("->");
+
+        String arrowStr;
+
+        ArrowKind(String arrowStr) {
+            this.arrowStr = arrowStr;
+        }
+    }
+
+    enum ExprKind {
+        NONE("#P#A"),
+        METHOD_CALL("m(#P#A)"),
+        CONSTR_CALL("new Foo(#P#A)");
+
+        String expressionTemplate;
+
+        ExprKind(String expressionTemplate) {
+            this.expressionTemplate = expressionTemplate;
+        }
+
+        String expressionString(ParameterListKind plk, ParameterKind pk,
+                ArrowKind ak) {
+            return expressionTemplate.replaceAll("#P", plk.getParameterString(pk))
+                    .replaceAll("#A", ak.arrowStr);
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (ParameterListKind plk : ParameterListKind.values()) {
+            for (ParameterKind pk : ParameterKind.values()) {
+                for (ArrowKind ak : ArrowKind.values()) {
+                    for (ExprKind ek : ExprKind.values()) {
+                        new BadLambdaExpr(plk, pk, ak, ek).run(comp, fm);
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    ParameterListKind plk;
+    ParameterKind pk;
+    ArrowKind ak;
+    ExprKind ek;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    BadLambdaExpr(ParameterListKind plk, ParameterKind pk, ArrowKind ak, ExprKind ek) {
+        this.plk = plk;
+        this.pk = pk;
+        this.ak = ak;
+        this.ek = ek;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "class Test {\n" +
+                          "   SAM s = #E;\n" +
+                          "}";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replaceAll("#E", ek.expressionString(plk, pk, ak));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.parse();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thron when parsing the following source:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        boolean errorExpected =
+                ak != ArrowKind.NONE ||
+                plk != ParameterListKind.UNARY ||
+                pk != ParameterKind.IMPLICIT;
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("bad diag for source:\n" +
+                source.getCharContent(true));
+        }
+        checkCount++;
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        @Override
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadLambdaPos.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,31 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda is only allowed in argument/cast/assignment context
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadLambdaPos.out -XDrawDiagnostics BadLambdaPos.java
+ */
+
+interface SAM {
+    void m(Integer x);
+}
+
+class Test {
+    void test(Object x) {}
+
+    void test1() {
+        test((int x)-> { } + (int x)-> { } );
+        test((int x)-> { } instanceof Object );
+    }
+
+    void test2() {
+        int i2 = (int x)-> { } + (int x)-> { };
+        boolean b = (int x)-> { } instanceof Object;
+    }
+
+    void test3() {
+        test((Object)(int x)-> { });
+        Object o = (Object)(int x)-> { };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadLambdaPos.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,9 @@
+BadLambdaPos.java:18:14: compiler.err.unexpected.lambda
+BadLambdaPos.java:18:30: compiler.err.unexpected.lambda
+BadLambdaPos.java:19:14: compiler.err.unexpected.lambda
+BadLambdaPos.java:23:18: compiler.err.unexpected.lambda
+BadLambdaPos.java:23:34: compiler.err.unexpected.lambda
+BadLambdaPos.java:24:21: compiler.err.unexpected.lambda
+BadLambdaPos.java:28:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+BadLambdaPos.java:29:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+8 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadMethodCall.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that diagnostics on nested erroneous deferred types are flushed
+ * @compile/fail/ref=BadMethodCall.out -XDrawDiagnostics BadMethodCall.java
+ */
+import java.util.*;
+
+class BadMethodCall {
+    <I> List<I> id(List<I> z) { return null; };
+
+    List<String> cons(String s, List<String> ls) { return null; }
+
+    void test(List<Object> lo) { Object t = cons(id(""),lo); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadMethodCall.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+BadMethodCall.java:15:50: compiler.err.cant.apply.symbol: kindname.method, id, java.util.List<I>, java.lang.String, kindname.class, BadMethodCall, (compiler.misc.infer.no.conforming.assignment.exists: I, (compiler.misc.inconvertible.types: java.lang.String, java.util.List<I>))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadRecovery.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that recovery of speculative types is not attempted if receiver is erroneous
+ * @compile/fail/ref=BadRecovery.out -XDrawDiagnostics BadRecovery.java
+ */
+class BadRecovery {
+
+    interface SAM1 {
+        void m(Object o);
+    }
+
+    void m(SAM1 m) { };
+
+    void test() {
+        m((receiver, t) -> { receiver.someMemberOfReceiver(()->{ Object x = f; }); });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadRecovery.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,3 @@
+BadRecovery.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, BadRecovery.SAM1, @369, kindname.class, BadRecovery, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))
+BadRecovery.java:17:77: compiler.err.cant.resolve.location: kindname.variable, f, , , (compiler.misc.location: kindname.class, BadRecovery, null)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadReturn.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,38 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that incompatible return types in lambdas are flagged with error
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadReturn.out -XDrawDiagnostics BadReturn.java
+ */
+
+class BadReturn {
+
+    interface SAM {
+        Comparable<?> m();
+    }
+
+    static void testNeg1() {
+        SAM s = ()-> {
+            if (true) {
+                return "";
+            } else {
+                return System.out.println("");
+            }};
+    }
+
+    static void testNeg2() {
+        SAM s = ()-> { return System.out.println(""); };
+    }
+
+    static void testPos() {
+        SAM s = ()-> {
+            if (false) {
+                return 10;
+            }
+            else {
+                return true;
+            }};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadReturn.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,3 @@
+BadReturn.java:21:42: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: void, java.lang.Comparable<?>))
+BadReturn.java:26:49: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: void, java.lang.Comparable<?>))
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadStatementInLambda.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that the compiler emits meaningful diagnostics when the lambda body contains bad statements
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadStatementInLambda.out -XDrawDiagnostics BadStatementInLambda.java
+ */
+
+class BadStatementInLambda {
+
+    interface SAM{
+        Object m();
+    }
+
+    SAM t1 = ()-> { null; };
+    SAM t2 = ()-> { 1; };
+    SAM t3 = ()-> { 1 + 5; };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadStatementInLambda.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,4 @@
+BadStatementInLambda.java:16:21: compiler.err.not.stmt
+BadStatementInLambda.java:17:21: compiler.err.not.stmt
+BadStatementInLambda.java:18:23: compiler.err.not.stmt
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadStatementInLambda02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that the compiler emits meaningful diagnostics when the lambda body contains bad statements
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadStatementInLambda02.out -XDrawDiagnostics BadStatementInLambda02.java
+ */
+
+class BadStatementInLambda02 {
+
+    interface SAM {
+        void m();
+    }
+
+    { call(()-> { System.out.println(new NonExistentClass() + ""); }); }
+
+    void call(SAM s) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadStatementInLambda02.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+BadStatementInLambda02.java:16:42: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, BadStatementInLambda02, null)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadTargetType.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,23 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that only SAM are allowed as target types for lambda expressions
+ * @author Jan Lahoda
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=BadTargetType.out -XDrawDiagnostics BadTargetType.java
+ */
+
+class BadTargetType {
+
+    static void m1(Object o) {}
+    void m2(Object o) {}
+
+    static Object l1 = (int pos)-> { };
+    Object l2 = (int pos)-> { };
+
+    {
+        m1((int pos)-> { });
+        m2((int pos)-> { });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/BadTargetType.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,5 @@
+BadTargetType.java:16:24: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+BadTargetType.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+BadTargetType.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, java.lang.Object, @460, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
+BadTargetType.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, java.lang.Object, @489, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/Conditional01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  conditional and varargs
+ * @compile -XDcomplexinference Conditional01.java
+ */
+
+import java.util.*;
+
+class Conditional01 {
+    void varargs(Object ... args) {  }
+
+    void test(boolean flag, List<String> ls) {
+       varargs(flag ? "" : ls);
+       varargs(null, flag ? "" : ls);
+       varargs(flag ? "" : ls());
+       varargs(null, flag ? "" : ls());
+    }
+
+    List<String> ls() { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/Conditional02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  inference and conditionals
+ * @compile -XDcomplexinference Conditional02.java
+ */
+
+class Conditional02 {
+
+    <Z> void m1(Z z) { }
+    <Z> void m2(Z... z) { }
+
+    void test(boolean flag) {
+        m1(flag ? "" : "");
+        m2(flag ? "" : "");
+        m2("", flag ? "" : "");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/Conditional03.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  conditionals and boxing
+ * @compile -XDcomplexinference Conditional03.java
+ */
+
+class Conditional03 {
+
+   void m1(Object o) { }
+   void m2(int i) { }
+
+   void test(boolean cond) {
+       m1((cond ? 1 : 1));
+       m1((cond ? box(1) : box(1)));
+   }
+
+   Integer box(int i) { return i; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/Conformance01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  lambda compiler regression with uninferred type-variables in generic constructor call
+ * @compile Conformance01.java
+ */
+
+class Conformance01 {
+    <T1, T2> Conformance01(T1 t) { }
+
+    Conformance01 c01 = new Conformance01(null);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/Defender01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  routine that checks for SAM types should skip defender methods in extended interfaces
+ * @author  Maurizio Cimadamore
+ * @compile Defender01.java
+ */
+
+class Defender01 {
+
+    interface A{
+        Object m();
+        default void n() { E.n(this); }
+    }
+
+    static class E{
+        static void n(A a){};
+    }
+
+    A t = ()-> null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/DisjunctiveTypeTest.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that subtyping between disjunctive and non disjunctive type works
+ * @author  Maurizio Cimadamore
+ * @compile DisjunctiveTypeTest.java
+ */
+
+class DisjunctiveTypeTest {
+
+    static class A extends IllegalArgumentException {
+       A(String a) { super(a); }
+    }
+
+    class B extends IllegalArgumentException {
+       B(String b) { super(b); }
+    }
+
+    void m() throws A,B {}
+
+    void test() {
+        try {
+            m();
+        } catch (A|B e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/EffectivelyFinal01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,18 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  effectively final check fails on method parameter
+ * @compile/fail/ref=EffectivelyFinal01.out -XDrawDiagnostics EffectivelyFinal01.java
+ */
+class EffectivelyFinal01 {
+
+    interface SAM {
+        Integer m(Integer i);
+    }
+
+    void test(Integer nefPar) {
+        SAM s = (Integer h) ->  { Integer k = 0; return k + h + nefPar; };
+        nefPar++;  //non-effectively final
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/EffectivelyFinal01.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+EffectivelyFinal01.java:15:65: compiler.err.cant.ref.non.effectively.final.var: nefPar, (compiler.misc.lambda)
+1 error
--- a/langtools/test/tools/javac/lambda/EffectivelyFinalTest.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/lambda/EffectivelyFinalTest.java	Sat Nov 17 19:01:03 2012 +0000
@@ -1,30 +1,9 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary Integrate efectively final check with DA/DU analysis
- * @compile/fail/ref=EffectivelyFinalTest01.out -XDallowEffectivelyFinalInInnerClasses -XDrawDiagnostics EffectivelyFinalTest.java
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  Integrate effectively final check with DA/DU analysis
+ * @compile/fail/ref=EffectivelyFinalTest01.out -XDrawDiagnostics EffectivelyFinalTest.java
  * @compile/fail/ref=EffectivelyFinalTest02.out -source 7 -Xlint:-options -XDrawDiagnostics EffectivelyFinalTest.java
  */
 class EffectivelyFinalTest {
@@ -62,7 +41,7 @@
 
     void m6(int x) {
         new Object() { { System.out.println(x+1); } }; //error - x not EF
-        x++;
+        x++; // Illegal: x is not effectively final.
     }
 
     void m7(int x) {
--- a/langtools/test/tools/javac/lambda/EffectivelyFinalTest01.out	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/lambda/EffectivelyFinalTest01.out	Sat Nov 17 19:01:03 2012 +0000
@@ -1,6 +1,6 @@
-EffectivelyFinalTest.java:46:47: compiler.err.var.might.not.have.been.initialized: y
-EffectivelyFinalTest.java:60:47: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.inner.cls)
-EffectivelyFinalTest.java:64:45: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.inner.cls)
-EffectivelyFinalTest.java:69:45: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.inner.cls)
-EffectivelyFinalTest.java:74:45: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.inner.cls)
+EffectivelyFinalTest.java:25:47: compiler.err.var.might.not.have.been.initialized: y
+EffectivelyFinalTest.java:39:47: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.inner.cls)
+EffectivelyFinalTest.java:43:45: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.inner.cls)
+EffectivelyFinalTest.java:48:45: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.inner.cls)
+EffectivelyFinalTest.java:53:45: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.inner.cls)
 5 errors
--- a/langtools/test/tools/javac/lambda/EffectivelyFinalTest02.out	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/lambda/EffectivelyFinalTest02.out	Sat Nov 17 19:01:03 2012 +0000
@@ -1,14 +1,14 @@
-EffectivelyFinalTest.java:46:47: compiler.err.var.might.not.have.been.initialized: y
-EffectivelyFinalTest.java:34:45: compiler.err.local.var.accessed.from.icls.needs.final: x
-EffectivelyFinalTest.java:34:47: compiler.err.local.var.accessed.from.icls.needs.final: y
-EffectivelyFinalTest.java:40:45: compiler.err.local.var.accessed.from.icls.needs.final: x
-EffectivelyFinalTest.java:40:47: compiler.err.local.var.accessed.from.icls.needs.final: y
-EffectivelyFinalTest.java:46:45: compiler.err.local.var.accessed.from.icls.needs.final: x
-EffectivelyFinalTest.java:53:45: compiler.err.local.var.accessed.from.icls.needs.final: x
-EffectivelyFinalTest.java:53:47: compiler.err.local.var.accessed.from.icls.needs.final: y
-EffectivelyFinalTest.java:60:45: compiler.err.local.var.accessed.from.icls.needs.final: x
-EffectivelyFinalTest.java:60:47: compiler.err.local.var.accessed.from.icls.needs.final: y
-EffectivelyFinalTest.java:64:45: compiler.err.local.var.accessed.from.icls.needs.final: x
-EffectivelyFinalTest.java:69:45: compiler.err.local.var.accessed.from.icls.needs.final: x
-EffectivelyFinalTest.java:74:45: compiler.err.local.var.accessed.from.icls.needs.final: y
+EffectivelyFinalTest.java:25:47: compiler.err.var.might.not.have.been.initialized: y
+EffectivelyFinalTest.java:13:45: compiler.err.local.var.accessed.from.icls.needs.final: x
+EffectivelyFinalTest.java:13:47: compiler.err.local.var.accessed.from.icls.needs.final: y
+EffectivelyFinalTest.java:19:45: compiler.err.local.var.accessed.from.icls.needs.final: x
+EffectivelyFinalTest.java:19:47: compiler.err.local.var.accessed.from.icls.needs.final: y
+EffectivelyFinalTest.java:25:45: compiler.err.local.var.accessed.from.icls.needs.final: x
+EffectivelyFinalTest.java:32:45: compiler.err.local.var.accessed.from.icls.needs.final: x
+EffectivelyFinalTest.java:32:47: compiler.err.local.var.accessed.from.icls.needs.final: y
+EffectivelyFinalTest.java:39:45: compiler.err.local.var.accessed.from.icls.needs.final: x
+EffectivelyFinalTest.java:39:47: compiler.err.local.var.accessed.from.icls.needs.final: y
+EffectivelyFinalTest.java:43:45: compiler.err.local.var.accessed.from.icls.needs.final: x
+EffectivelyFinalTest.java:48:45: compiler.err.local.var.accessed.from.icls.needs.final: x
+EffectivelyFinalTest.java:53:45: compiler.err.local.var.accessed.from.icls.needs.final: y
 13 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/ErroneousArg.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,36 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  speculative cache mismatches between Resolve.access and Attr.checkId leads to compiler crashes
+ * @compile/fail/ref=ErroneousArg.out -XDrawDiagnostics ErroneousArg.java
+ */
+class ErroneousArg {
+
+    private static class Foo {
+        static int j() { return 1; }
+    }
+
+    static Foo foo = new Foo();
+
+    static void m(String s) { }
+    static void m(Integer i) { }
+
+    static int f(String s) { return 1; }
+
+    static int g(String s) { return 1; }
+    static int g(Double s) { return 1; }
+
+    int h() { return 1; }
+}
+
+class TestErroneousArg extends ErroneousArg {
+    static void test() {
+        m(unknown()); //method not found
+        m(f(1)); //inapplicable method
+        m(g(1)); //inapplicable methods
+        m(g(null)); //ambiguous
+        m(h()); //static error
+        m(foo.j()); //inaccessible method
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/ErroneousArg.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,7 @@
+ErroneousArg.java:29:11: compiler.err.cant.resolve.location.args: kindname.method, unknown, , , (compiler.misc.location: kindname.class, TestErroneousArg, null)
+ErroneousArg.java:30:11: compiler.err.cant.apply.symbol: kindname.method, f, java.lang.String, int, kindname.class, ErroneousArg, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))
+ErroneousArg.java:31:11: compiler.err.cant.apply.symbols: kindname.method, g, int,{(compiler.misc.inapplicable.method: kindname.method, ErroneousArg, g(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.method, ErroneousArg, g(java.lang.Double), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.Double)))}
+ErroneousArg.java:32:11: compiler.err.ref.ambiguous: g, kindname.method, g(java.lang.String), ErroneousArg, kindname.method, g(java.lang.Double), ErroneousArg
+ErroneousArg.java:33:11: compiler.err.non-static.cant.be.ref: kindname.method, h()
+ErroneousArg.java:34:14: compiler.err.not.def.access.class.intf.cant.access: j(), ErroneousArg.Foo
+6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/ErroneousLambdaExpr.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  stale state after speculative attribution round leads to missing classfiles
+ */
+public class ErroneousLambdaExpr<T> {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM1<X> {
+        X m(X t, String s);
+    }
+
+    interface SAM2 {
+        void m(String s, int i);
+    }
+
+    interface SAM3<X> {
+        X m(X t, String s, int i);
+    }
+
+    void call(SAM1<T> s1) { assertTrue(true); }
+
+    void call(SAM2 s2) { assertTrue(false); }
+
+    void call(SAM3<T> s3) { assertTrue(false); }
+
+    public static void main(String[] args) {
+        ErroneousLambdaExpr<StringBuilder> test =
+                new ErroneousLambdaExpr<>();
+
+        test.call((builder, string) -> { builder.append(string); return builder; });
+        assertTrue(assertionCount == 1);
+    }
+}
--- a/langtools/test/tools/javac/lambda/InnerConstructor.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/lambda/InnerConstructor.java	Sat Nov 17 19:01:03 2012 +0000
@@ -23,15 +23,20 @@
 
 /*
  * @test
- * @summary Regression test JDK-8003306 inner class constructor in lambda
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  Regression test JDK-8003306 inner class constructor in lambda
  * @author  Robert Field
- * @compile -XDallowLambda InnerConstructor.java
  */
 
-class InnerConstructor {
+public class InnerConstructor {
 
-    public void testLambdaWithInnerConstructor() {
-        System.out.printf("%s should be %s\n", seq1().m().toString(), "Cbl:nada");
+    public static void main(String... args) {
+        InnerConstructor ic = new InnerConstructor();
+        String res = ic.seq1().m().toString();
+        if (!res.equals("Cbl.toString")) {
+            throw new AssertionError(String.format("Unexpected result: %s", res));
+        }
     }
 
     Ib1 seq1() {
@@ -40,6 +45,9 @@
 
     class Cbl {
         Cbl() {  }
+        public String toString() {
+            return "Cbl.toString";
+        }
     }
 
     interface Ib1 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaCapture01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  basic test for capture of non-mutable locals
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main LambdaCapture01
+ */
+
+public class LambdaCapture01 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface Tester {
+        void test();
+    }
+
+    interface TU<T, U> {
+        public T foo(U u);
+    }
+
+    public static <T, U> T exec(TU<T, U> lambda, U x) {
+        return lambda.foo(x);
+    }
+
+    public int n = 5;
+
+    //Simple local capture
+    void test1() {
+        final int N = 1;
+        int res = LambdaCapture01.<Integer,Integer>exec((Integer x) -> x + N, 3);
+        assertTrue(4 == res);
+    }
+
+    //Local capture with multiple scopes (anon class)
+    void test2() {
+        final int N = 1;
+        new Tester() {
+            public void test() {
+                final int M = 2;
+                int res = LambdaCapture01.<Integer,Integer>exec((Integer x) -> x + N + M, 3);
+                assertTrue(6 == res);
+            }
+        }.test();
+    }
+
+    //Local capture with multiple scopes (local class)
+    void test3() {
+        final int N = 1;
+        class MyTester implements Tester {
+            public void test() {
+                final int M = 2;
+                int res = LambdaCapture01.<Integer,Integer>exec((Integer x) -> x + N + M, 3);
+                assertTrue(6 == res);
+            }
+        }
+        new MyTester().test();
+    }
+
+    //access to field from enclosing scope
+    void test4() {
+        final int N = 4;
+        int res1 = LambdaCapture01.<Integer,Integer>exec((Integer x) -> x + n + N, 3);
+        assertTrue(12 == res1);
+        int res2 = LambdaCapture01.<Integer,Integer>exec((Integer x) -> x + LambdaCapture01.this.n + N, 3);
+        assertTrue(12 == res2);
+    }
+
+    public static void main(String[] args) {
+        LambdaCapture01 t = new LambdaCapture01();
+        t.test1();
+        t.test2();
+        t.test3();
+        t.test4();
+        assertTrue(assertionCount == 5);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaCapture02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  basic test for capture of non-mutable locals
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main LambdaCapture02
+ */
+
+public class LambdaCapture02 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface Tester {
+        void test();
+    }
+
+    interface TU<T, U> {
+        public T foo(U u);
+    }
+
+    public static <T, U> T exec(TU<T, U> lambda, U x) {
+        return lambda.foo(x);
+    }
+
+    public Integer n = 5;
+
+    //Simple local capture
+    void test1() {
+        final Integer N = 1;
+        int res = LambdaCapture02.<Integer,Integer>exec((Integer x) -> x + N, 3);
+        assertTrue(4 == res);
+    }
+
+    //Local capture with multiple scopes (anon class)
+    void test2() {
+        final Integer N = 1;
+        new Tester() {
+            public void test() {
+                final Integer M = 2;
+                int res = LambdaCapture02.<Integer,Integer>exec((Integer x) -> x + N + M, 3);
+                assertTrue(6 == res);
+            }
+        }.test();
+    }
+
+    //Local capture with multiple scopes (local class)
+    void test3() {
+        final Integer N = 1;
+        class MyTester implements Tester {
+            public void test() {
+                final Integer M = 2;
+                int res = LambdaCapture02.<Integer,Integer>exec((Integer x) -> x + N + M, 3);
+                assertTrue(6 == res);
+            }
+        }
+        new MyTester().test();
+    }
+
+    //access to field from enclosing scope
+    void test4() {
+        final Integer N = 4;
+        int res1 = LambdaCapture02.<Integer,Integer>exec((Integer x) -> x + n + N, 3);
+        assertTrue(12 == res1);
+        int res2 = LambdaCapture02.<Integer,Integer>exec((Integer x) -> x + LambdaCapture02.this.n + N, 3);
+        assertTrue(12 == res2);
+    }
+
+    public static void main(String[] args) {
+        LambdaCapture02 t = new LambdaCapture02();
+        t.test1();
+        t.test2();
+        t.test3();
+        t.test4();
+        assertTrue(assertionCount == 5);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaCapture03.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  test for capture of non-mutable locals/outer fields in multiple scopes
+ * @author  Maurizio Cimadamore
+ * @run main LambdaCapture03
+ */
+
+public class LambdaCapture03 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface Tester {
+        void test();
+    }
+
+    interface TU<T, U> {
+        public T foo(U u);
+    }
+
+    public static <T, U> T exec(TU<T, U> lambda, U x) {
+        return lambda.foo(x);
+    }
+
+    Integer n1 = 10;
+
+    void test1() {
+        final Integer N1 = 1;
+        class A {
+            Integer n2 = 20;
+            void test() {
+                  final Integer N2 = 2;
+                  class B {
+                       void test() {
+                           final Integer N3 = 3;
+                           int res = LambdaCapture03.exec((Integer x) -> x + n1 + n2 + N1 + N2 + N3, 30);
+                           assertTrue(res == 66);
+                       }
+                  }
+                  new B().test();
+            }
+        }
+        new A().test();
+    }
+
+    void test2() {
+        final Integer N1 = 1;
+        new Tester() {
+            Integer n2 = 20;
+            public void test() {
+                final Integer N2 = 2;
+                new Tester() {
+                    public void test() {
+                        final Integer N3 = 3;
+                        int res = LambdaCapture03.exec((Integer x) -> x + n1 + n2 + N1 + N2 + N3, 30);
+                        assertTrue(res == 66);
+                    }
+                }.test();
+            }
+        }.test();
+    }
+
+    public static void main(String[] args) {
+        LambdaCapture03 t = new LambdaCapture03();
+        t.test1();
+        t.test2();
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaCapture04.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  test for capture of non-mutable locals/outer fields in multiple scopes
+ * @author  Maurizio Cimadamore
+ * @run main LambdaCapture04
+ */
+
+public class LambdaCapture04 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface Tester {
+        void test();
+    }
+
+    interface TU<U> {
+        public void foo(U u);
+    }
+
+    public static <U> void exec(TU<U> lambda, U x) {
+        lambda.foo(x);
+    }
+
+    Integer n1 = 10;
+
+    void test1() {
+        final Integer N1 = 1;
+        class A {
+            Integer n2 = 20;
+            void test() {
+                  final Integer N2 = 2;
+                  class B {
+                       void test() {
+                           final Integer N3 = 3;
+                           exec((final Integer x) -> new Tester() { public void test() { assertTrue(x + n1 + n2 + N1 + N2 + N3 == 66); } }.test(),30);
+                       }
+                  }
+                  new B().test();
+            }
+        }
+        new A().test();
+    }
+
+    void test2() {
+        final Integer N1 = 1;
+        class A {
+            Integer n2 = 20;
+            void test() {
+                  final Integer N2 = 2;
+                  class B {
+                       void test() {
+                           final Integer N3 = 3;
+                           exec((final Integer x) -> {
+                               class LocTester implements Tester {
+                                   public void test() { assertTrue(x + n1 + n2 + N1 + N2 + N3 == 66); }
+                               };
+                               new LocTester().test();
+                           },30);
+                       }
+                  }
+                  new B().test();
+            }
+        }
+        new A().test();
+    }
+
+    void test3() {
+        final Integer N1 = 1;
+        new Tester() {
+            Integer n2 = 20;
+            public void test() {
+                final Integer N2 = 2;
+                new Tester() {
+                    public void test() {
+                        final Integer N3 = 3;
+                        exec((final Integer x) -> new Tester() { public void test() { assertTrue(x + n1 + n2 + N1 + N2 + N3 == 66); } }.test(),30);
+                    }
+                }.test();
+            }
+        }.test();
+    }
+
+    void test4() {
+        final Integer N1 = 1;
+        new Tester() {
+            Integer n2 = 20;
+            public void test() {
+                final Integer N2 = 2;
+                new Tester() {
+                    public void test() {
+                        final Integer N3 = 3;
+                        exec((final Integer x) -> {
+                            class LocTester implements Tester {
+                                public void test() { assertTrue(x + n1 + n2 + N1 + N2 + N3 == 66); }
+                            };
+                            new LocTester().test();
+                        },30);
+                    }
+                }.test();
+            }
+        }.test();
+    }
+
+    public static void main(String[] args) {
+        LambdaCapture04 t = new LambdaCapture04();
+        t.test1();
+        t.test2();
+        t.test3();
+        t.test4();
+        assertTrue(assertionCount == 4);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaCapture05.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  test for capture in nested lambda expressions
+ * @author  Maurizio Cimadamore
+ * @run main LambdaCapture05
+ */
+
+public class LambdaCapture05 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface TU<T, U> {
+        public T foo(U u);
+    }
+
+    public static <T, U> T exec(TU<T, U> lambda, U x) {
+        return lambda.foo(x);
+    }
+
+    int i = 40;
+
+    void test1(final int a0) {
+        exec((final Integer a1) -> {
+            final Integer x2 = 10; exec((final Integer a2) -> {
+                final Integer x3 = 20;
+                exec((final Integer a3) -> { assertTrue(106 == (a0 + a1 + a2 + a3 + x2 + x3 + i)); return null; }, 3);
+                return null;
+            },2);
+            return null;
+        },1);
+    }
+
+    static void test2(final int a0) {
+        exec((final Integer a1) -> {
+            final Integer x2 = 10; exec((final Integer a2) -> {
+                final Integer x3 = 20;
+                exec((final Integer a3) -> { assertTrue(66 == (a0 + a1 + a2 + a3 + x2 + x3)); return null; }, 3);
+                return null;
+            }, 2);
+            return null;
+        }, 1);
+    }
+
+    public static void main(String[] args) {
+        LambdaCapture05 t = new LambdaCapture05();
+        t.test1(30);
+        test2(30);
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaCapture06.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @ignore investigate as to whether code generation fails
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  Compiler crash when local inner class nested inside lambda captures local variables from enclosing scope
+ */
+public class LambdaCapture06 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM {
+        void m(int n);
+    }
+
+    public static void main(String[] args) {
+        int n = 5;
+        SAM s = k -> {
+            new Object() {
+                void test() { int j = n; assertTrue(j == 5); }
+            }.test();
+        };
+        s.m(42);
+        assertTrue(assertionCount == 1);
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  basic test for lambda conversion
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main LambdaConv01
+ */
+
+public class LambdaConv01 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface IntToInt {
+      public int foo(int x);
+    }
+
+    interface IntToVoid {
+      public void foo(int x);
+    }
+
+    interface VoidToInt {
+      public int foo();
+    }
+
+    interface TU<T, U> {
+      public T foo(U u);
+    }
+
+    public static <T, U> T exec(TU<T, U> lambda, U x) {
+        return lambda.foo(x);
+    }
+
+    static {
+        //Assignment conversion:
+        VoidToInt f1 = ()-> 3;
+        assertTrue(3 == f1.foo());
+        //Covariant returns:
+        TU<Number, Integer> f2 = (Integer x) -> x;
+        assertTrue(3 == f2.foo(3));
+        //Method resolution with boxing:
+        int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
+        assertTrue(3 == res);
+        //Runtime exception transparency:
+        try {
+            LambdaConv01.<Integer,Object>exec((Object x) -> x.hashCode(), null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    {
+        //Assignment conversion:
+        VoidToInt f1 = ()-> 3;
+        assertTrue(3 == f1.foo());
+        //Covariant returns:
+        TU<Number, Integer> f2 = (Integer x) -> x;
+        assertTrue(3 == f2.foo(3));
+        //Method resolution with boxing:
+        int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
+        assertTrue(3 == res);
+        //Runtime exception transparency:
+        try {
+            LambdaConv01.<Integer,Object>exec((Object x) -> x.hashCode(), null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    public static void test1() {
+        //Assignment conversion:
+        VoidToInt f1 = ()-> 3;
+        assertTrue(3 == f1.foo());
+        //Covariant returns:
+        TU<Number, Integer> f2 = (Integer x) -> x;
+        assertTrue(3 == f2.foo(3));
+        //Method resolution with boxing:
+        int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
+        assertTrue(3 == res);
+        //Runtime exception transparency:
+        try {
+            LambdaConv01.<Integer,Object>exec((Object x) -> x.hashCode(), null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    public void test2() {
+        //Assignment conversion:
+        VoidToInt f1 = ()-> 3;
+        assertTrue(3 == f1.foo());
+        //Covariant returns:
+        TU<Number, Integer> f2 = (Integer x) -> x;
+        assertTrue(3 == f2.foo(3));
+        //Method resolution with boxing:
+        int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
+        assertTrue(3 == res);
+        //Runtime exception transparency:
+        try {
+            LambdaConv01.<Integer,Object>exec((Object x) -> x.hashCode(), null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    public static void main(String[] args) {
+        test1();
+        new LambdaConv01().test2();
+        assertTrue(assertionCount == 16);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv03.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  SAM types and method type inference
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main LambdaConv03
+ */
+
+public class LambdaConv03 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface TU<T, U> {
+      public T foo(U u);
+    }
+
+    public static <T, U> T exec(TU<T, U> lambda, U x) {
+        return lambda.foo(x);
+    }
+
+    static {
+        //Covariant returns:
+        int i1 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i1);
+        //Method resolution with boxing:
+        int i2 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i2);
+        //Runtime exception transparency:
+        try {
+            exec((Object x) -> { return x.hashCode(); }, null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    {
+        //Covariant returns:
+        int i1 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i1);
+        //Method resolution with boxing:
+        int i2 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i2);
+        //Runtime exception transparency:
+        try {
+            exec((Object x) -> { return x.hashCode(); }, null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    public static void test1() {
+        //Covariant returns:
+        int i1 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i1);
+        //Method resolution with boxing:
+        int i2 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i2);
+        //Runtime exception transparency:
+        try {
+            exec((Object x) -> { return x.hashCode(); }, null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    public void test2() {
+        //Covariant returns:
+        int i1 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i1);
+        //Method resolution with boxing:
+        int i2 = exec((Integer x) -> { return x; }, 3);
+        assertTrue(3 == i2);
+        //Runtime exception transparency:
+        try {
+            exec((Object x) -> { return x.hashCode(); }, null);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true);
+        }
+    }
+
+    public static void main(String[] args) {
+        test1();
+        new LambdaConv03().test2();
+        assertTrue(assertionCount == 12);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv05.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  function type and method type inference
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @run main LambdaConv05
+ */
+
+import java.util.*;
+
+public class LambdaConv05 {
+
+    static void assertTrue(boolean cond) {
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    int count = 0;
+
+    void sort(List<String> data) {
+      Collections.sort(data,
+                       (String a, String b) -> { LambdaConv05.this.count++; return a.length()-b.length(); });
+    }
+
+    public static void main(String[] args) {
+        ArrayList<String> arr = new ArrayList<>();
+        arr.add("Three");
+        arr.add("Four");
+        arr.add("One");
+        LambdaConv05 sorter = new LambdaConv05();
+        sorter.sort(arr);
+        assertTrue(arr.get(0).equals("One"));
+        assertTrue(arr.get(1).equals("Four"));
+        assertTrue(arr.get(2).equals("Three"));
+        assertTrue(sorter.count == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv06.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  ensure that definite assignment analysis doesn't mess up with lambda attribution
+ * @author Jan Lahoda
+ * @author  Maurizio Cimadamore
+ * @compile LambdaConv06.java
+ */
+
+class LambdaConv06 {
+
+    private int t() {
+        return a((final Object indexed) -> {
+            return b(new R() {
+                public String build(final Object index) {
+                    return "";
+                }
+            });
+        });
+    }
+
+    private int a(R r) {return 0;}
+    private String b(R r) {return null;}
+
+    public static interface R {
+        public String build(Object o);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv08.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that SAM conversion handles covarinat return types correctly
+ * @author  Peter Levart
+ * @author  Maurizio Cimadamore
+ * @run main LambdaConv08
+ */
+
+public class LambdaConv08 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    public interface ObjectF { Object invoke(); }
+    public interface StringF extends ObjectF { String invoke(); }
+
+    public static void call(StringF stringFunc) {
+        assertTrue(true);
+    }
+
+    public static void call(ObjectF objectFunc) {  }
+
+    public static void main(String[] args)   {
+        call(()-> "Hello");
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv09.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,50 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that SAM conversion handles Object members correctly
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=LambdaConv09.out -XDrawDiagnostics LambdaConv09.java
+ */
+
+class LambdaConv09 {
+
+    // Not a SAM type; not enough abstract methods
+    interface Foo1 {}
+
+    // SAM type; Foo has no abstract methods
+    interface Foo2 { boolean equals(Object object); }
+
+
+    // Not a SAM type; Foo still has no abstract methods
+    interface Foo3 extends Foo2 { public abstract String toString(); }
+
+    // SAM type; Bar has one abstract non-Object method
+    interface Foo4<T> extends Foo2 { int compare(T o1, T o2); }
+
+    // Not a SAM type; still no valid abstract methods
+    interface Foo5 {
+        boolean equals(Object object);
+        String toString();
+    }
+
+    // SAM type; Foo6 has one abstract non-Object method
+    interface Foo6<T> {
+        boolean equals(Object obj);
+        int compare(T o1, T o2);
+    }
+
+    // SAM type; Foo6 has one abstract non-Object method
+    interface Foo7<T> extends Foo2, Foo6<T> { }
+
+    void test() {
+        Foo1 f1 = ()-> { };
+        Foo2 f2 = ()-> { };
+        Foo3 f3 = x -> true;
+        Foo4 f4 = (x, y) -> 1;
+        Foo5 f5 = x -> true;
+        Foo6 f6 = (x, y) -> 1;
+        Foo7 f7 = (x, y) -> 1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv09.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,5 @@
+LambdaConv09.java:42:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo1))
+LambdaConv09.java:43:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo2))
+LambdaConv09.java:44:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo3))
+LambdaConv09.java:46:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo5))
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv10.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda conversion does not allow boxing of lambda parameters
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=LambdaConv10.out -XDrawDiagnostics LambdaConv10.java
+ */
+
+class LambdaConv10 {
+
+    interface Method1<R, A1> { public R call( A1 a1 ); }
+
+    public static void main( final String... notUsed ) {
+        Method1<Integer,Integer> m1 = (int i) -> 2 * i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv10.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,2 @@
+LambdaConv10.java:15:39: compiler.err.prob.found.req: (compiler.misc.incompatible.arg.types.in.lambda)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv11.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  issues with lambda conversion involving generic class hierarchies
+ * @author  Maurizio Cimadamore
+ * @compile LambdaConv11.java
+ */
+
+import java.util.Comparator;
+
+class LambdaConv11<T> {
+
+    interface SAM<X> extends Comparator<X> {
+        public int compare(X left, X right);
+    }
+
+    SAM<T> y = (l, r) -> 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv12.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  instance creation expression should allow lambda expressions as constrcutor arguments
+ * @author  Maurizio Cimadamore
+ * @compile LambdaConv12.java
+ */
+
+class LambdaConv12 {
+
+    LambdaConv12(SAM s) {}
+
+    interface SAM {
+        public abstract void m();
+    }
+
+    void test() {
+        new LambdaConv12(()-> { });
+        new LambdaConv12(()-> { }) {};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv13.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  interface methods in diamond shaped inheritance trees shouldn't be counted twice
+ * @author  Maurizio Cimadamore
+ * @compile LambdaConv13.java
+ */
+
+class LambdaConv13 {
+
+    interface I {
+        void m();
+    }
+
+    interface A extends I {}
+    interface B extends I {}
+    interface C extends A, B {}
+    interface D extends A, I {}
+    interface E extends B, I {}
+
+    C c = ()-> { };
+    D d = ()-> { };
+    D e = ()-> { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv16.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  SAM conversion and raw types in argument/return types
+ * @author  Maurizio Cimadamore
+ * @run main LambdaConv16
+ */
+
+import java.util.*;
+
+public class LambdaConv16 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface A {
+        Iterable m(List<String> ls);
+    }
+
+    interface B {
+        Iterable<String> m(List l);
+    }
+
+    interface AB extends A, B {} //SAM type ([List], Iterable<String>, {})
+
+    static void test(AB ab, List l) { ab.m(l); }
+
+    public static void main(String[] args) {
+        AB ab = (List list) -> { assertTrue(true); return new ArrayList<String>(); };
+        ab.m(null);
+        test((List list) -> { assertTrue(true); return new ArrayList<String>(); }, null);
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv17.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  lambda compiler crashes if lambda has try-with-resources
+ * @compile LambdaConv17.java
+ */
+
+class LambdaConv17 {
+    interface SAM {
+       void m() throws Exception;
+    }
+
+    SAM s = ()-> { try (AutoCloseable ac = null){ } };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv18.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,24 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  simple test for lambda candidate check
+ * @compile/fail/ref=LambdaConv18.out -XDrawDiagnostics -XDidentifyLambdaCandidate=true LambdaConv18.java
+ */
+
+class LambdaConv18 {
+
+    interface SAM {
+        void m();
+    }
+
+    interface NonSAM {
+        void m1();
+        void m2();
+    }
+
+    SAM s1 = new SAM() { public void m() {} };
+    NonSAM s2 = new NonSAM() { public void m1() {}
+                              public void m2() {} };
+    NonExistent s3 = new NonExistent() { public void m() {} };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv18.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,4 @@
+LambdaConv18.java:23:5: compiler.err.cant.resolve.location: kindname.class, NonExistent, , , (compiler.misc.location: kindname.class, LambdaConv18, null)
+LambdaConv18.java:20:24: compiler.note.potential.lambda.found
+LambdaConv18.java:23:26: compiler.err.cant.resolve.location: kindname.class, NonExistent, , , (compiler.misc.location: kindname.class, LambdaConv18, null)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv19.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that redundant cast warnings are not generated for SAM conversions
+ * @compile -Xlint:cast -Werror LambdaConv19.java
+ */
+
+class LambdaConv19 {
+
+    interface SAM {
+        void m();
+    }
+
+    SAM s = (SAM)()-> { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv20.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that synthetic casts are added when erased type of lambda body
+ *          ends up being too general
+ * @run main LambdaConv20
+ */
+
+import java.util.*;
+
+public class LambdaConv20 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM<X> {
+        X m(List<X> l);
+    }
+
+    public static void main(String[] args) {
+        SAM<Integer> si1 = l -> l.get(0);
+        assertTrue(si1.m(Arrays.asList(1)) == 1);
+        SAM<Integer> si2 = l -> { return l.get(0); };
+        assertTrue(si2.m(Arrays.asList(1)) == 1);
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv21.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,38 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that code generation handles void-compatibility correctly
+ * @compile/fail/ref=LambdaConv21.out -XDrawDiagnostics LambdaConv21.java
+ */
+
+class LambdaConv21 {
+
+    interface SAM_void<X> {
+        void m();
+    }
+
+    interface SAM_java_lang_Void {
+        Void m();
+    }
+
+    static void m_void() { }
+
+    static Void m_java_lang_Void() { return null; }
+
+    static void testExpressionLambda() {
+        SAM_void s1 = ()->m_void(); //ok
+        SAM_java_lang_Void s2 = ()->m_void(); //no - incompatible target
+        SAM_void s3 = ()->m_java_lang_Void(); //no - incompatible target
+        SAM_java_lang_Void s4 = ()->m_java_lang_Void(); //ok
+    }
+
+    static void testStatementLambda() {
+        SAM_void s1 = ()-> { m_void(); }; //ok
+        SAM_java_lang_Void s2 = ()-> { m_void(); }; //no - missing return value
+        SAM_void s3 = ()-> { return m_java_lang_Void(); }; //no - unexpected return value
+        SAM_java_lang_Void s4 = ()-> { return m_java_lang_Void(); }; //ok
+        SAM_void s5 = ()-> { m_java_lang_Void(); }; //ok
+        SAM_java_lang_Void s6 = ()-> { m_java_lang_Void(); }; //no - missing return value
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv21.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,6 @@
+LambdaConv21.java:25:43: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: void, java.lang.Void))
+LambdaConv21.java:26:43: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Void, void))
+LambdaConv21.java:32:33: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.Void))
+LambdaConv21.java:33:53: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.unexpected.ret.val))
+LambdaConv21.java:36:33: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.missing.ret.val: java.lang.Void))
+5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv22.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  inner class translator fails with spurious method clash errors
+ * @compile LambdaConv22.java
+ */
+
+class LambdaConv22<U> {
+
+    interface Factory<T> { T make(); }
+
+    U make() { return null; }
+
+    void test(U u) {
+        Factory<U> fu1 = () -> u;
+        Factory<U> fu2 = this::make;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv23.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check super varargs reference is handled correctly
+ * @run main LambdaConv23
+ */
+public class LambdaConv23 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM { void m(Integer a, Integer b); }
+
+    static class Super {
+        void m(Object... vi) { assertTrue(true); }
+    }
+
+
+    static class Sub extends Super {
+
+        void m(Object... vi) { assertTrue(false); }
+
+        public void test() {
+            SAM q = super::m;
+            q.m(1, 2);
+        }
+    }
+
+    public static void main(String[] args) {
+        new Sub().test();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv24.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda inside 'this' call is handled properly
+ * @run main LambdaConv24
+ */
+public class LambdaConv24 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM<X> {
+        boolean m(X x);
+    }
+
+    LambdaConv24(SAM<String> p) {
+        assertTrue(p.m("42"));
+    }
+
+    LambdaConv24(int i) {
+        this(s->true);
+    }
+
+    LambdaConv24(int i1, int i2) {
+        this(LambdaConv24::m);
+    }
+
+    static boolean m(String s) { return true; }
+
+    public static void main(String[] args) {
+        new LambdaConv24(1);
+        new LambdaConv24(1,2);
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConversionTest.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  perform several automated checks in lambda conversion, esp. around accessibility
+ * @author  Maurizio Cimadamore
+ * @run main LambdaConversionTest
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class LambdaConversionTest {
+
+    enum PackageKind {
+        NO_PKG(""),
+        PKG_A("a");
+
+        String pkg;
+
+        PackageKind(String pkg) {
+            this.pkg = pkg;
+        }
+
+        String getPkgDecl() {
+            return this == NO_PKG ?
+                "" :
+                "package " + pkg + ";";
+        }
+
+        String getImportStat() {
+            return this == NO_PKG ?
+                "" :
+                "import " + pkg + ".*;";
+        }
+    }
+
+    enum SamKind {
+        CLASS("public class Sam {  }"),
+        ABSTACT_CLASS("public abstract class Sam {  }"),
+        ANNOTATION("public @interface Sam {  }"),
+        ENUM("public enum Sam { }"),
+        INTERFACE("public interface Sam { \n #METH; \n }");
+
+        String sam_str;
+
+        SamKind(String sam_str) {
+            this.sam_str = sam_str;
+        }
+
+        String getSam(String methStr) {
+            return sam_str.replaceAll("#METH", methStr);
+        }
+    }
+
+    enum ModifierKind {
+        PUBLIC("public"),
+        PACKAGE("");
+
+        String modifier_str;
+
+        ModifierKind(String modifier_str) {
+            this.modifier_str = modifier_str;
+        }
+
+        boolean stricterThan(ModifierKind that) {
+            return this.ordinal() > that.ordinal();
+        }
+    }
+
+    enum TypeKind {
+        EXCEPTION("Exception"),
+        PKG_CLASS("PackageClass");
+
+        String typeStr;
+
+        private TypeKind(String typeStr) {
+            this.typeStr = typeStr;
+        }
+    }
+
+    enum MethodKind {
+        NONE(""),
+        NON_GENERIC("public #R m(#ARG s) throws #T;"),
+        GENERIC("public <X> #R m(#ARG s) throws #T;");
+
+        String methodTemplate;
+
+        private MethodKind(String methodTemplate) {
+            this.methodTemplate = methodTemplate;
+        }
+
+        String getMethod(TypeKind retType, TypeKind argType, TypeKind thrownType) {
+            return methodTemplate.replaceAll("#R", retType.typeStr).
+                    replaceAll("#ARG", argType.typeStr).
+                    replaceAll("#T", thrownType.typeStr);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        for (PackageKind samPkg : PackageKind.values()) {
+            for (ModifierKind modKind : ModifierKind.values()) {
+                for (SamKind samKind : SamKind.values()) {
+                    for (MethodKind meth : MethodKind.values()) {
+                        for (TypeKind retType : TypeKind.values()) {
+                            for (TypeKind argType : TypeKind.values()) {
+                                for (TypeKind thrownType : TypeKind.values()) {
+                                    new LambdaConversionTest(samPkg, modKind, samKind,
+                                            meth, retType, argType, thrownType).test();
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    PackageKind samPkg;
+    ModifierKind modKind;
+    SamKind samKind;
+    MethodKind meth;
+    TypeKind retType;
+    TypeKind argType;
+    TypeKind thrownType;
+
+    SourceFile samSourceFile = new SourceFile("Sam.java", "#P \n #C") {
+        public String toString() {
+            return template.replaceAll("#P", samPkg.getPkgDecl()).
+                    replaceAll("#C", samKind.getSam(meth.getMethod(retType, argType, thrownType)));
+        }
+    };
+
+    SourceFile pkgClassSourceFile = new SourceFile("PackageClass.java",
+                                                   "#P\n #M class PackageClass extends Exception { }") {
+        public String toString() {
+            return template.replaceAll("#P", samPkg.getPkgDecl()).
+                    replaceAll("#M", modKind.modifier_str);
+        }
+    };
+
+    SourceFile clientSourceFile = new SourceFile("Client.java",
+                                                 "#I\n class Client { Sam s = x -> null; }") {
+        public String toString() {
+            return template.replaceAll("#I", samPkg.getImportStat());
+        }
+    };
+
+    LambdaConversionTest(PackageKind samPkg, ModifierKind modKind, SamKind samKind,
+            MethodKind meth, TypeKind retType, TypeKind argType, TypeKind thrownType) {
+        this.samPkg = samPkg;
+        this.modKind = modKind;
+        this.samKind = samKind;
+        this.meth = meth;
+        this.retType = retType;
+        this.argType = argType;
+        this.thrownType = thrownType;
+    }
+
+    void test() throws Exception {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        DiagnosticChecker dc = new DiagnosticChecker();
+        JavacTask ct = (JavacTask)tool.getTask(null, null, dc,
+                null, null, Arrays.asList(samSourceFile, pkgClassSourceFile, clientSourceFile));
+        ct.analyze();
+        if (dc.errorFound == checkSamConversion()) {
+            throw new AssertionError(samSourceFile + "\n\n" + pkgClassSourceFile + "\n\n" + clientSourceFile);
+        }
+    }
+
+    boolean checkSamConversion() {
+        if (samKind != SamKind.INTERFACE) {
+            //sam type must be an interface
+            return false;
+        } else if (meth != MethodKind.NON_GENERIC) {
+            //target method must be non-generic
+            return false;
+        } else if (samPkg != PackageKind.NO_PKG &&
+                modKind != ModifierKind.PUBLIC &&
+                (retType == TypeKind.PKG_CLASS ||
+                argType == TypeKind.PKG_CLASS ||
+                thrownType == TypeKind.PKG_CLASS)) {
+            //target must not contain inaccessible types
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    abstract class SourceFile extends SimpleJavaFileObject {
+
+        protected String template;
+
+        public SourceFile(String filename, String template) {
+            super(URI.create("myfo:/" + filename), JavaFileObject.Kind.SOURCE);
+            this.template = template;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return toString();
+        }
+
+        public abstract String toString();
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound = false;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaEffectivelyFinalTest.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,60 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  Integrate efectively final check with DA/DU analysis
+ * @compile/fail/ref=LambdaEffectivelyFinalTest.out -XDrawDiagnostics LambdaEffectivelyFinalTest.java
+ */
+class LambdaEffectivelyFinalTest {
+
+    interface SAM {
+        int m();
+    }
+
+    void foo(LambdaEffectivelyFinalTest.SAM s) { }
+
+    void m1(int x) {
+        int y = 1;
+        foo(() -> x+y); // Legal: x and y are both effectively final.
+    }
+
+    void m2(int x) {
+        int y;
+        y = 1;
+        foo(() -> x+y); // Legal: x and y are both effectively final.
+    }
+
+    void m3(int x, boolean cond) {
+        int y;
+        if (cond) y = 1;
+        foo(() -> x+y); // Illegal: y is effectively final, but not definitely assigned.
+    }
+
+    void m4(int x, boolean cond) {
+        int y;
+        if (cond) y = 1;
+        else y = 2;
+        foo(() -> x+y); // Legal: x and y are both effectively final.
+    }
+
+    void m5(int x, boolean cond) {
+        int y;
+        if (cond) y = 1;
+        y = 2;
+        foo(() -> x+y); // Illegal: y is not effectively final.t EF
+    }
+
+    void m6(int x) {
+        foo(() -> x+1);
+        x++; // Illegal: x is not effectively final.
+    }
+
+    void m7(int x) {
+        foo(() -> x=1); // Illegal: x in the assignment does not denote a variable (see 6.5.6.1)
+    }
+
+    void m8() {
+        int y;
+        foo(() -> y=1); // Illegal: y in the assignment does not denote a variable (see 6.5.6.1)
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaEffectivelyFinalTest.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,6 @@
+LambdaEffectivelyFinalTest.java:30:21: compiler.err.var.might.not.have.been.initialized: y
+LambdaEffectivelyFinalTest.java:44:21: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.lambda)
+LambdaEffectivelyFinalTest.java:48:19: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.lambda)
+LambdaEffectivelyFinalTest.java:53:19: compiler.err.cant.ref.non.effectively.final.var: x, (compiler.misc.lambda)
+LambdaEffectivelyFinalTest.java:58:19: compiler.err.cant.ref.non.effectively.final.var: y, (compiler.misc.lambda)
+5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  basic test for simple lambda expressions in multiple scopes
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main LambdaExpr01
+ */
+
+public class LambdaExpr01 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface S_int {
+        int m();
+    }
+
+    interface S_Integer {
+        Integer m();
+    }
+
+    interface S_int_int {
+        int m(int i);
+    }
+
+    interface S_Integer_int {
+        int m(Integer i);
+    }
+
+    interface S_int_Integer {
+        Integer m(int i);
+    }
+
+    interface S_Integer_Integer {
+        Integer m(Integer i);
+    }
+
+    static {
+        S_int s_i = ()-> 3;
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> 3;
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x)-> x+1;
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x)-> x+1;
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    {
+        S_int s_i = ()-> 3;
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> 3;
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x)-> x+1;
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x)-> x+1;
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    static void test1() {
+        S_int s_i = ()-> 3;
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> 3;
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x)-> x+1;
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x)-> x+1;
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    void test2() {
+        S_int s_i = ()-> 3;
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> 3;
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x)-> x+1;
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x)-> x+1;
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> x.intValue() + 1;
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    public static void main(String[] args) {
+        test1();
+        new LambdaExpr01().test2();
+        assertTrue(assertionCount == 24);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  basic test for simple lambda expressions in multiple scopes
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main LambdaExpr01
+ */
+
+public class LambdaExpr02 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface S_int {
+        int m();
+    }
+
+    interface S_Integer {
+        Integer m();
+    }
+
+    interface S_int_int {
+        int m(int i);
+    }
+
+    interface S_Integer_int {
+        int m(Integer i);
+    }
+
+    interface S_int_Integer {
+        Integer m(int i);
+    }
+
+    interface S_Integer_Integer {
+        Integer m(Integer i);
+    }
+
+    static {
+        S_int s_i = ()-> { return 3; };
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> { return 3; };
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    {
+        S_int s_i = ()-> { return 3; };
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> { return 3; };
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    static void test1() {
+        S_int s_i = ()-> { return 3; };
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> { return 3; };
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    void test2() {
+        S_int s_i = ()-> { return 3; };
+        assertTrue(3 == s_i.m());
+        S_Integer s_I = ()-> { return 3; };
+        assertTrue(3 == s_I.m());
+        S_int_int s_i_i = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_i.m(3));
+        S_int_Integer s_i_I = (int x) -> { return x + 1; };
+        assertTrue(4 == s_i_I.m(3));
+        S_Integer_int s_I_i = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_i.m(3));
+        S_Integer_Integer s_I_I = (Integer x) -> { return x.intValue() + 1; };
+        assertTrue(4 == s_I_I.m(3));
+    }
+
+    public static void main(String[] args) {
+        test1();
+        new LambdaExpr02().test2();
+        assertTrue(assertionCount == 24);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr04.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda initializers compile w/o problems
+ * @author Jan Lahoda
+ * @author  Maurizio Cimadamore
+ * @compile LambdaExpr04.java
+ */
+
+class LambdaExpr04 {
+
+    interface SAM {
+        void m(int i);
+    }
+    static SAM lambda_01 = (int pos) -> { };
+
+    static final SAM lambda_02 = (int pos) -> { };
+
+    SAM lambda_03 = (int pos) -> { };
+
+    final SAM lambda_04 = (int pos) -> { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr05.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that binary expression in lambda expression is parsed correctly
+ * @author  Maurizio Cimadamore
+ * @compile LambdaExpr05.java
+ */
+
+class LambdaExpr05 {
+
+    interface SAM { int foo(int i); }
+
+    SAM s1 = i -> i * 2;
+    SAM s2 = i -> 2 * i;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr06.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  parser test for nested parenthesized lambda expression
+ * @run main LambdaExpr06
+ */
+
+public class LambdaExpr06 {
+
+    static void assertTrue(boolean cond) {
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface A {
+        int m();
+    }
+
+    interface B {
+        int dup(int i);
+    }
+
+    public static void main(String[] args) {
+        A a = ()-> ((B)i -> i * 2).dup(3);
+        assertTrue(a.m() == 6);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr07.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check access to effectively final local variable from doubly nested lambda
+ * @run main LambdaExpr07
+ */
+
+public class LambdaExpr07 {
+
+    interface Block<A, R> {
+        R apply(A x);
+    }
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    String S = "A";
+
+    void test() {
+        Block<String, Block<String, String>> o = s1 -> s2 -> S + s1 + s2;
+        assertTrue(o.apply("B").apply("C").equals("ABC"));
+    }
+
+    public static void main(String[] args) {
+        new LambdaExpr07().test();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr08.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that reference to local final variable w/o initializer is accepted
+ * @compile LambdaExpr08.java
+ */
+
+class LambdaExpr08 {
+
+    interface SAM {
+       String m();
+    }
+
+    void test() {
+        final String s;
+        s = "";
+        SAM sam = () -> s;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr09.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda in array initializers is correctly accepted
+ * @compile LambdaExpr09.java
+ */
+
+class LambdaExpr09 {
+
+    interface Block<T> {
+       void m(T t);
+    }
+
+    void apply(Object[] obj_arr) { }
+
+    void test1() {
+        Block<?>[] arr1 =  { t -> { }, t -> { } };
+        Block<?>[][] arr2 =  { { t -> { }, t -> { } }, { t -> { }, t -> { } } };
+    }
+
+    void test2() {
+        Block<?>[] arr1 =  new Block<?>[]{ t -> { }, t -> { } };
+        Block<?>[][] arr2 =  new Block<?>[][]{ { t -> { }, t -> { } }, { t -> { }, t -> { } } };
+    }
+
+    void test3() {
+        apply(new Block<?>[]{ t -> { }, t -> { } });
+        apply(new Block<?>[][]{ { t -> { }, t -> { } }, { t -> { }, t -> { } } });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr10.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,37 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda in array initializers (with wrong type) are correctly rejected
+ * @compile/fail/ref=LambdaExpr10.out -XDrawDiagnostics LambdaExpr10.java
+ */
+
+class LambdaExpr10 {
+
+    interface Block<T> {
+       void m(T t);
+    }
+
+    void apply(Object[] obj_arr) { }
+
+    void test1() {
+        Object[] arr1 =  { t -> { } };
+        Object[][] arr2 =  { { t -> { } } };
+    }
+
+    void test2() {
+        Object[] arr1 =  new Object[]{ t -> { } };
+        Object[][] arr2 =  new Object[][]{ { t -> { } } };
+    }
+
+    void test3() {
+        apply(new Object[]{ t -> { } });
+        apply(new Object[][]{ { t -> { } } });
+    }
+
+    void test4() {
+        Block<?>[] arr1 =  { t -> t };
+        Block<?>[] arr2 =  new Block<?>[]{ t -> t };
+        apply(new Block<?>[]{ t -> { }, t -> { } });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr10.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,9 @@
+LambdaExpr10.java:18:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:19:32: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:23:40: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:24:46: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:28:29: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:29:33: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:33:35: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, void))
+LambdaExpr10.java:34:49: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, void))
+8 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr11.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that creating an inner class from a lambda does add a captured this
+ * @run main LambdaExpr11
+ */
+public class LambdaExpr11 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    class Inner {
+        Inner() { assertTrue(true); }
+    }
+
+    void test() {
+        Runnable r1 = ()-> { new Inner(); };
+        r1.run();
+        Runnable r2 = ()-> { new Inner() {}; };
+        r2.run();
+        Runnable r3 = ()-> { class SubInner extends Inner {}; new SubInner(); };
+        r3.run();
+        Runnable r4 = ()-> { class SubInner extends Inner {}; new SubInner() {}; };
+        r4.run();
+        new Inner2().test();
+    }
+
+    class Inner2 {
+        void test() {
+            Runnable r1 = ()-> { new Inner(); };
+            r1.run();
+            Runnable r2 = ()-> { new Inner() {}; };
+            r2.run();
+            Runnable r3 = ()-> { class SubInner extends Inner {}; new SubInner(); };
+            r3.run();
+            Runnable r4 = ()-> { class SubInner extends Inner {}; new SubInner() {}; };
+            r4.run();
+            new Inner3().test();
+        }
+
+        class Inner3 {
+            void test() {
+                Runnable r1 = ()-> { new Inner(); };
+                r1.run();
+                Runnable r2 = ()-> { new Inner() {}; };
+                r2.run();
+                Runnable r3 = ()-> { class SubInner extends Inner {}; new SubInner(); };
+                r3.run();
+                Runnable r4 = ()-> { class SubInner extends Inner {}; new SubInner() {}; };
+                r4.run();
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        new LambdaExpr11().test();
+        assertTrue(assertionCount == 12);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr12.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that creating an inner class from a lambda does add a captured this
+ * @run main LambdaExpr12
+ */
+
+public class LambdaExpr12 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface Getter<X> {
+        X get();
+    }
+
+
+    interface Mapper<X,Y> {
+        Y map(X x);
+    }
+
+    void test() {
+        Mapper<String, Getter<Character>> mapper =
+                (final String s) -> new Getter<Character>() {
+                     @Override
+                     public Character get() {
+                         return s.charAt(0);
+                     }
+                };
+        assertTrue(mapper.map("First").get() == 'F');
+    }
+
+    public static void main(String[] args) {
+        new LambdaExpr12().test();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr13.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that recursive lambda (through field ref) is accepted in all contexts
+ * @compile LambdaExpr13.java
+ */
+
+class LambdaExpr13 {
+
+    Runnable ir = () -> { ir.run(); };;
+    static Runnable sr = () -> { sr.run(); };
+
+    { ir = () -> { ir.run(); }; }
+    static { sr = () -> { sr.run(); }; }
+
+    static void m1() {
+        sr = () -> { sr.run(); };
+    }
+
+    void m2() {
+        ir = () -> { ir.run(); };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr14.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that recursion from doubly nested lambda is handled correctly
+ */
+
+public class LambdaExpr14 {
+
+    interface SAM {
+       SAM invoke();
+    }
+
+    static SAM local;
+
+    public static void main(String[] args) {
+        local = () -> () -> local.invoke();
+        local.invoke().invoke(); // Not a recursive lambda - exec should terminate
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr15.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @ignore investigate as to whether code generation fails
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that nested inner class in statement lambdas don't get corrupted return statements
+ * @run main LambdaExpr15
+ */
+public class LambdaExpr15 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface Block<T> {
+       void apply(T t);
+    }
+
+    public static void main(String[] args) {
+        //anon class
+        Block<Object> ba1 = t -> {
+            new Object() {
+                String get() { return ""; }
+            };
+            assertTrue(t == 1);
+        };
+        ba1.apply(1);
+
+        //local class
+        Block<Object> ba2 = t -> {
+            class A {
+                String get() { return ""; }
+            };
+            new A();
+            assertTrue(t == 2);
+        };
+        ba2.apply(2);
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr16.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that super inside lambda is handled correctly
+ * @run main LambdaExpr16
+ */
+public class LambdaExpr16 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface A { void m(); }
+
+    static class Sup {
+       void m() {
+          assertTrue(true);
+       }
+    }
+
+    static class Sub extends Sup {
+        void testLambda1() {
+            A a = ()->{ super.m(); };
+            a.m();
+        }
+        void testLambda2() {
+            A a = () -> { A a1 = () -> { super.m(); }; a1.m(); };
+            a.m();
+        }
+        void testRef1() {
+            A a = () -> { A a1 = super::m; a1.m(); };
+            a.m();
+        }
+        void testRef2() {
+            A a = () -> { A a1 = () -> { A a2 = super::m; a2.m(); }; a1.m(); };
+            a.m();
+        }
+    }
+
+   public static void main(String[] args) {
+      Sub s = new Sub();
+      s.testLambda1();
+      s.testLambda2();
+      s.testRef1();
+      s.testRef2();
+      assertTrue(assertionCount == 4);
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr17.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that super in argument position inside lambda is handled correctly
+ * @run main LambdaExpr17
+ */
+public class LambdaExpr17 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM {
+        void m();
+    }
+
+    static class Sup {
+        protected String m() {
+            assertTrue(true);
+            return "Hello!";
+        }
+    }
+
+    static class Sub extends Sup {
+        void test() {
+            SAM s = () -> { System.out.println(super.m()); };
+            s.m();
+        }
+    }
+
+    public static void main(String[] args) {
+        new Sub().test();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr18.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that synthetic casts from outer environment are not inserted twice
+ * @run main LambdaExpr18
+ */
+public class LambdaExpr18 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM<R> {
+        R eval();
+    }
+
+    static void test(){
+        SAM<Integer> sam1 = () -> {
+            assertTrue(true);
+            SAM<String> sam2 = () -> {
+                assertTrue(true);
+                return "";
+            };
+            sam2.eval();
+            return 1;
+        };
+        sam1.eval();
+    }
+
+    public static void main(String[] args) {
+        test();
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr19.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,53 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that inner scopes are left after a lambda check exception has been thrown
+ * @compile/fail/ref=LambdaExpr19.out -XDrawDiagnostics LambdaExpr19.java
+ */
+class LambdaExpr19 {
+
+    interface SAM {
+        String m();
+    }
+
+    void m(SAM s) { }
+
+    void testTry() {
+        m(() -> {
+                try { return 1; }
+                catch (Exception e) { }
+            });
+    }
+
+    void testTryWithResources() {
+        m(() -> {
+                try (AutoCloseable c = null) { return 1; }
+                catch (Exception e) { }
+            });
+    }
+
+    void testSwitch() {
+        m(() -> {
+                switch (1) {
+                    default: return 1;
+                }
+            });
+    }
+
+    void testFor() {
+        m(() -> {
+                for (;;) {
+                    return 1;
+                }
+            });
+    }
+
+    void testForeach() {
+        m(() -> {
+                for (Object o : new Object[] { null , null }) {
+                    return 1;
+                }
+            });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr19.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,6 @@
+LambdaExpr19.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @363, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:24:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @512, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:31:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @676, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:39:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @824, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+LambdaExpr19.java:47:9: compiler.err.cant.apply.symbol: kindname.method, m, LambdaExpr19.SAM, @965, kindname.class, LambdaExpr19, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExpr20.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that default super call from lambda expression is compiled successfully
+ * @compile LambdaExpr20.java
+ */
+
+class LambdaExpr20 {
+
+    interface K {
+        default void m() { }
+    }
+
+    static class Test implements K {
+        @Override
+        public void m() {
+            Runnable r = () -> { K.super.m(); };
+            r.run();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExprNotVoid.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda expression body (when not a block) cannot be void
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=LambdaExprNotVoid.out -XDlambdaInferenceDiags=false -XDrawDiagnostics LambdaExprNotVoid.java
+ */
+
+class LambdaExpr05 {
+
+    interface SAM { void foo(int i); }
+
+    SAM s1 = i -> i * 2;
+    SAM s2 = i -> 2 * i;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaExprNotVoid.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,3 @@
+LambdaExprNotVoid.java:14:21: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, void))
+LambdaExprNotVoid.java:15:21: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, void))
+2 errors
--- a/langtools/test/tools/javac/lambda/LambdaParserTest.java	Fri Nov 16 18:27:36 2012 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaParserTest.java	Sat Nov 17 19:01:03 2012 +0000
@@ -24,7 +24,9 @@
 /*
  * @test
  * @bug 7115050
- * @summary Add parser support for lambda expressions
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  Add parser support for lambda expressions
  */
 
 import com.sun.source.util.JavacTask;
@@ -234,7 +236,7 @@
 
     void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
         JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
-                Arrays.asList("-XDallowLambda"), null, Arrays.asList(source));
+                null, null, Arrays.asList(source));
         try {
             ct.parse();
         } catch (Throwable ex) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaScope01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  basic test for capture of non-mutable locals
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main LambdaScope01
+ */
+
+public class LambdaScope01 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface TU<T, U> {
+        public T foo(U u);
+    }
+
+    public static <T, U> T exec(TU<T, U> lambda, U x) {
+        return lambda.foo(x);
+    }
+
+    public int n = 5;
+
+    public int hashCode() {
+        throw new RuntimeException();
+    }
+
+    public void test1() {
+        try {
+            int res = LambdaScope01.<Integer,Integer>exec((Integer x) -> x * hashCode(), 3);
+        }
+        catch (RuntimeException e) {
+            assertTrue(true); //should throw
+        }
+    }
+
+    public void test2() {
+        final int n = 10;
+        int res = LambdaScope01.<Integer,Integer>exec((Integer x) -> x + n, 3);
+        assertTrue(13 == res);
+    }
+
+    public static void main(String[] args) {
+        LambdaScope01 t = new LambdaScope01();
+        t.test1();
+        t.test2();
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaScope02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that Object members are accessible as expected
+ * @author  Maurizio Cimadamore
+ * @run main LambdaScope02
+ */
+
+public class LambdaScope02 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    @Override
+    public String toString() {
+        return "Callable1";
+    }
+
+    interface Callable {
+        void call();
+    }
+
+    static void call(Callable c) { c.call(); }
+
+    void test() {
+        call(()-> { assertTrue(LambdaScope02.this.toString().equals("Callable1")); });
+        call(()-> { assertTrue(toString().equals("Callable1")); });
+    }
+
+    public static void main(String[] args) {
+        new LambdaScope02().test();
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaScope03.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that unqualified Object members are accessed as expected
+ * @author  Maurizio Cimadamore
+ * @run main LambdaScope03
+ */
+
+public class LambdaScope03 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM {
+        void m();
+    }
+
+    static void call(SAM s) { s.m(); }
+
+    void test() {
+        call(()-> { assertTrue(LambdaScope03.this.getClass().equals(getClass())); });
+        call(()-> { assertTrue(LambdaScope03.this.getClass().equals(this.getClass())); });
+        call(()-> { assertTrue(LambdaScope03.this.hashCode() == hashCode()); });
+        call(()-> { assertTrue(LambdaScope03.this.hashCode() == this.hashCode()); });
+        call(()-> { assertTrue(LambdaScope03.this.toString().equals(toString())); });
+        call(()-> { assertTrue(LambdaScope03.this.toString().equals(this.toString())); });
+        call(()-> { assertTrue(LambdaScope03.this.equals(this)); });
+        call(()-> { assertTrue(equals(LambdaScope03.this)); });
+    }
+
+    public static void main(String[] args) {
+        new LambdaScope03().test();
+        assertTrue(assertionCount == 8);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaScope04.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,163 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that lambda cannot shadow variables from enclosing scope
+ * @compile/fail/ref=LambdaScope04.out -XDrawDiagnostics LambdaScope04.java
+ */
+
+class LambdaScope04 {
+
+    interface SAM {
+        void m(Object o);
+    }
+
+    static SAM field1 = field1->{}; //ok
+    static SAM field2 = param->{ Object field2 = null; }; //ok
+
+    SAM field3 = field3->{}; //ok
+    SAM field4 = param->{ Object field4 = null; }; //ok
+
+    {
+        Object local = null;
+        SAM s1 = local->{}; //error
+        SAM s2 = param->{ Object local = null; }; //error
+    }
+
+    static {
+        Object local = null;
+        SAM s1 = local->{}; //error
+        SAM s2 = param->{ Object local = null; }; //error
+        SAM s3 = field1->{ Object field_2 = null; }; //ok
+    }
+
+    void testLocalInstance() {
+        Object local = null;
+        SAM s1 = local->{}; //error
+        SAM s2 = param->{ Object local = null; }; //error
+        SAM s3 = field1->{ Object field_2 = null; }; //ok
+    }
+
+    static void testLocalStatic() {
+        Object local = null;
+        SAM s1 = local->{}; //error
+        SAM s2 = param->{ Object local = null; }; //error
+        SAM s3 = field1->{ Object field_2 = null; }; //ok
+    }
+
+    void testParamInstance(Object local) {
+        SAM s1 = local->{}; //error
+        SAM s2 = param->{ Object local = null; }; //error
+        SAM s3 = field1->{ Object field_2 = null; }; //ok
+    }
+
+    static void testParamStatic(Object local) {
+        SAM s1 = local->{}; //error
+        SAM s2 = param->{ Object local = null; }; //error
+        SAM s3 = field1->{ Object field_2 = null; }; //ok
+    }
+
+    void testForInstance() {
+        for (int local = 0; local != 0 ; local++) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    static void testForStatic(Iterable<Object> elems) {
+        for (int local = 0; local != 0 ; local++) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    void testForEachInstance(Iterable<Object> elems) {
+        for (Object local : elems) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    static void testForEachStatic(Iterable<Object> elems) {
+        for (Object local : elems) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    void testCatchInstance() {
+        try { } catch (Throwable local) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    static void testCatchStatic(Iterable<Object> elems) {
+        try { } catch (Throwable local) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    void testTWRInstance(AutoCloseable res) {
+        try (AutoCloseable local = res) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        } finally { }
+    }
+
+    static void testTWRStatic(AutoCloseable res) {
+        try (AutoCloseable local = res) {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        } finally { }
+    }
+
+    void testBlockLocalInstance() {
+        Object local = null;
+        {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    static void testBlockLocalStatic() {
+        Object local = null;
+        {
+            SAM s1 = local->{}; //error
+            SAM s2 = param->{ Object local = null; }; //error
+            SAM s3 = field1->{ Object field_2 = null; }; //ok
+        }
+    }
+
+    void testSwitchLocalInstance(int i) {
+        switch (i) {
+            case 0: Object local = null;
+            default: {
+                SAM s1 = local->{}; //error
+                SAM s2 = param->{ Object local = null; }; //error
+                SAM s3 = field1->{ Object field_2 = null; }; //ok
+            }
+        }
+    }
+
+    static void testSwitchLocalStatic(int i) {
+        switch (i) {
+            case 0: Object local = null;
+            default: {
+                SAM s1 = local->{}; //error
+                SAM s2 = param->{ Object local = null; }; //error
+                SAM s3 = field1->{ Object field_2 = null; }; //ok
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaScope04.out	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,37 @@
+LambdaScope04.java:23:18: compiler.err.already.defined.in.clinit: kindname.variable, local, kindname.instance.init, kindname.class, LambdaScope04
+LambdaScope04.java:24:34: compiler.err.already.defined.in.clinit: kindname.variable, local, kindname.instance.init, kindname.class, LambdaScope04
+LambdaScope04.java:29:18: compiler.err.already.defined.in.clinit: kindname.variable, local, kindname.static.init, kindname.class, LambdaScope04
+LambdaScope04.java:30:34: compiler.err.already.defined.in.clinit: kindname.variable, local, kindname.static.init, kindname.class, LambdaScope04
+LambdaScope04.java:36:18: compiler.err.already.defined: kindname.variable, local, kindname.method, testLocalInstance()
+LambdaScope04.java:37:34: compiler.err.already.defined: kindname.variable, local, kindname.method, testLocalInstance()
+LambdaScope04.java:43:18: compiler.err.already.defined: kindname.variable, local, kindname.method, testLocalStatic()
+LambdaScope04.java:44:34: compiler.err.already.defined: kindname.variable, local, kindname.method, testLocalStatic()
+LambdaScope04.java:49:18: compiler.err.already.defined: kindname.variable, local, kindname.method, testParamInstance(java.lang.Object)
+LambdaScope04.java:50:34: compiler.err.already.defined: kindname.variable, local, kindname.method, testParamInstance(java.lang.Object)
+LambdaScope04.java:55:18: compiler.err.already.defined: kindname.variable, local, kindname.method, testParamStatic(java.lang.Object)
+LambdaScope04.java:56:34: compiler.err.already.defined: kindname.variable, local, kindname.method, testParamStatic(java.lang.Object)
+LambdaScope04.java:62:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testForInstance()
+LambdaScope04.java:63:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testForInstance()
+LambdaScope04.java:70:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testForStatic(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:71:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testForStatic(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:78:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testForEachInstance(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:79:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testForEachInstance(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:86:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testForEachStatic(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:87:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testForEachStatic(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:94:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testCatchInstance()
+LambdaScope04.java:95:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testCatchInstance()
+LambdaScope04.java:102:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testCatchStatic(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:103:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testCatchStatic(java.lang.Iterable<java.lang.Object>)
+LambdaScope04.java:110:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testTWRInstance(java.lang.AutoCloseable)
+LambdaScope04.java:111:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testTWRInstance(java.lang.AutoCloseable)
+LambdaScope04.java:118:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testTWRStatic(java.lang.AutoCloseable)
+LambdaScope04.java:119:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testTWRStatic(java.lang.AutoCloseable)
+LambdaScope04.java:127:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testBlockLocalInstance()
+LambdaScope04.java:128:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testBlockLocalInstance()
+LambdaScope04.java:136:22: compiler.err.already.defined: kindname.variable, local, kindname.method, testBlockLocalStatic()
+LambdaScope04.java:137:38: compiler.err.already.defined: kindname.variable, local, kindname.method, testBlockLocalStatic()
+LambdaScope04.java:146:26: compiler.err.already.defined: kindname.variable, local, kindname.method, testSwitchLocalInstance(int)
+LambdaScope04.java:147:42: compiler.err.already.defined: kindname.variable, local, kindname.method, testSwitchLocalInstance(int)
+LambdaScope04.java:157:26: compiler.err.already.defined: kindname.variable, local, kindname.method, testSwitchLocalStatic(int)
+LambdaScope04.java:158:42: compiler.err.already.defined: kindname.variable, local, kindname.method, testSwitchLocalStatic(int)
+36 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LocalBreakAndContinue.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  check that local break/continue is allowed in lambda expressions
+ * @author  Maurizio Cimadamore
+ * @compile LocalBreakAndContinue.java
+ */
+
+class LocalBreakAndContinue {
+
+    static interface SAM {
+       void m();
+    }
+
+    SAM s1 = ()-> { while (true) break; };
+    SAM s2 = ()-> { while (true) continue; };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MethodReference01.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003280
+ * @summary Add lambda tests
+ *  use method reference to sort list elements by field
+ * @author  Brian Goetz
+ * @author  Maurizio Cimadamore
+ * @run main MethodReference01
+ */
+
+import java.util.*;
+
+public class MethodReference01 {
+
+    interface Getter<U, T> {
+        public U get(T t);
+    }
+
+    static class Foo {
+        private Integer a;
+        private String b;
+
+        Foo(Integer a, String b) {
+            this.a = a;
+            this.b = b;
+        }
+
+        static Integer getA(Foo f) { return f.a; }
+        static String getB(Foo f) { return f.b; }
+    }
+
+    public static <T, U extends Comparable<? super U>>
+           void sortBy(List<T> s, final Getter<U, T> getter) {
+        Collections.sort(s, new Comparator<T>() {
+            public int compare(T t1, T t2) {
+                return getter.get(t1).compareTo(getter.get(t2));
+            }
+        });
+    };
+
+    public static void main(String[] args) {
+        List<Foo> c = new ArrayList<Foo>();
+        c.add(new Foo(2, "Hello3!"));
+        c.add(new Foo(3, "Hello1!"));
+        c.add(new Foo(1, "Hello2!"));
+        checkSortByA(c);
+        checkSortByB(c);
+    }
+
+    static void checkSortByA(List<Foo> l) {
+        sortBy(l, Foo::getA);
+        int oldA = -1;
+        for (Foo foo : l) {
+            if (foo.a.compareTo(oldA) < 1) {
+                throw new AssertionError();
+            }
+        }
+    }
+
+    static void checkSortByB(List<Foo> l) {
+        sortBy(l, Foo::getB);
+        String oldB = "";
+        for (Foo foo : l) {
+            if (foo.b.compareTo(oldB) < 1) {
+                throw new AssertionError();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MethodReference02.java	Sat Nov 17 19:01:03 2012 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * Yo