Wed, 14 May 2014 11:01:08 -0700
Merge
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties Tue May 13 23:18:48 2014 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties Wed May 14 11:01:08 2014 -0700 1.3 @@ -29,7 +29,7 @@ 1.4 doclet.Href_Enum_Title={0}\u5185\u306E\u5217\u6319\u578B 1.5 doclet.Href_Type_Param_Title={0}\u5185\u306E\u578B\u30D1\u30E9\u30E1\u30FC\u30BF 1.6 doclet.Href_Class_Or_Interface_Title={0}\u5185\u306E\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9 1.7 -doclet.Summary=\u6982\u8981: 1.8 +doclet.Summary=\u30B5\u30DE\u30EA\u30FC: 1.9 doclet.Detail=\u8A73\u7D30: 1.10 doclet.navNested=\u30CD\u30B9\u30C8 1.11 doclet.navAnnotationTypeOptionalMember=\u30AA\u30D7\u30B7\u30E7\u30F3 1.12 @@ -117,18 +117,18 @@ 1.13 doclet.Window_Source_title=\u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9 1.14 doclet.Window_Help_title=API\u30D8\u30EB\u30D7 1.15 doclet.Help_line_1=API\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u69CB\u6210 1.16 -doclet.Help_line_2=\u3053\u306EAPI(Application Programming Interface)\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306B\u306F\u3001\u6B21\u306B\u8AAC\u660E\u3059\u308B\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u306B\u3042\u308B\u9805\u76EE\u306B\u5BFE\u5FDC\u3059\u308B\u30DA\u30FC\u30B8\u304C\u542B\u307E\u308C\u307E\u3059\u3002 1.17 -doclet.Help_line_3={0}\u30DA\u30FC\u30B8\u306FAPI\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30D5\u30ED\u30F3\u30C8\u30FB\u30DA\u30FC\u30B8\u3067\u3001\u5404\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u6982\u8981\u3092\u542B\u3080\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30EA\u30B9\u30C8\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u4E00\u9023\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u6982\u8981\u8AAC\u660E\u3082\u8868\u793A\u3055\u308C\u307E\u3059\u3002 1.18 -doclet.Help_line_4=\u5404\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u306F\u3001\u305D\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u30EA\u30B9\u30C8\u3068\u3001\u305D\u308C\u305E\u308C\u306E\u6982\u8981\u3092\u542B\u3080\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u3059\u3002\u3053\u306E\u30DA\u30FC\u30B8\u306F6\u3064\u306E\u30AB\u30C6\u30B4\u30EA\u3067\u69CB\u6210\u3055\u308C\u307E\u3059\u3002 1.19 +doclet.Help_line_2=\u3053\u306EAPI (Application Programming Interface)\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306B\u306F\u3001\u6B21\u306B\u8AAC\u660E\u3059\u308B\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u306B\u3042\u308B\u9805\u76EE\u306B\u5BFE\u5FDC\u3059\u308B\u30DA\u30FC\u30B8\u304C\u542B\u307E\u308C\u307E\u3059\u3002 1.20 +doclet.Help_line_3={0}\u30DA\u30FC\u30B8\u306FAPI\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30D5\u30ED\u30F3\u30C8\u30FB\u30DA\u30FC\u30B8\u3067\u3001\u5404\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30B5\u30DE\u30EA\u30FC\u3092\u542B\u3080\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30EA\u30B9\u30C8\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u4E00\u9023\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u5168\u4F53\u7684\u306A\u8AAC\u660E\u3082\u8868\u793A\u3055\u308C\u307E\u3059\u3002 1.21 +doclet.Help_line_4=\u5404\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u306F\u3001\u305D\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u30EA\u30B9\u30C8\u3068\u3001\u305D\u308C\u305E\u308C\u306E\u30B5\u30DE\u30EA\u30FC\u3092\u542B\u3080\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u3059\u3002\u3053\u306E\u30DA\u30FC\u30B8\u306F6\u3064\u306E\u30AB\u30C6\u30B4\u30EA\u3067\u69CB\u6210\u3055\u308C\u307E\u3059\u3002 1.22 doclet.Help_line_5=\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9 1.23 -doclet.Help_line_6=\u5404\u30AF\u30E9\u30B9\u3001\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3001\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u306F\u500B\u5225\u306E\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u3059\u3002\u5404\u30DA\u30FC\u30B8\u306B\u306F\u6B21\u306E\u3088\u3046\u306B\u3001\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u8AAC\u660E\u3068\u3001\u6982\u8981\u8868\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u8A73\u7D30\u8AAC\u660E\u304C\u542B\u307E\u308C\u307E\u3059\u3002 1.24 +doclet.Help_line_6=\u5404\u30AF\u30E9\u30B9\u3001\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3001\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u306F\u500B\u5225\u306E\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u3059\u3002\u5404\u30DA\u30FC\u30B8\u306B\u306F\u6B21\u306E\u3088\u3046\u306B\u3001\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u8AAC\u660E\u3068\u3001\u30B5\u30DE\u30EA\u30FC\u8868\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u8A73\u7D30\u8AAC\u660E\u304C\u542B\u307E\u308C\u307E\u3059\u3002 1.25 doclet.Help_line_7=\u30AF\u30E9\u30B9\u968E\u5C64\u8868\u793A 1.26 doclet.Help_line_8=\u76F4\u7CFB\u306E\u30B5\u30D6\u30AF\u30E9\u30B9 1.27 doclet.Help_line_9=\u65E2\u77E5\u306E\u30B5\u30D6\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u30EA\u30B9\u30C8 1.28 doclet.Help_line_10=\u65E2\u77E5\u306E\u5B9F\u88C5\u30AF\u30E9\u30B9\u306E\u30EA\u30B9\u30C8 1.29 doclet.Help_line_11=\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u5BA3\u8A00 1.30 doclet.Help_line_12=\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u8AAC\u660E 1.31 -doclet.Help_line_13=\u5404\u6982\u8981\u30A8\u30F3\u30C8\u30EA\u306B\u306F\u3001\u305D\u306E\u9805\u76EE\u306E\u8A73\u7D30\u306A\u8AAC\u660E\u306E\u4E2D\u304B\u30891\u884C\u76EE\u306E\u6587\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u8A73\u7D30\u306A\u8AAC\u660E\u306F\u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9\u306B\u73FE\u308C\u308B\u9806\u306B\u4E26\u3079\u3089\u308C\u307E\u3059\u304C\u3001\u6982\u8981\u30A8\u30F3\u30C8\u30EA\u306F\u30A2\u30EB\u30D5\u30A1\u30D9\u30C3\u30C8\u9806\u306B\u4E26\u3079\u3089\u308C\u307E\u3059\u3002\u3053\u308C\u306B\u3088\u3063\u3066\u3001\u30D7\u30ED\u30B0\u30E9\u30DE\u304C\u8A2D\u5B9A\u3057\u305F\u8AD6\u7406\u7684\u306A\u30B0\u30EB\u30FC\u30D7\u5206\u3051\u304C\u4FDD\u6301\u3055\u308C\u307E\u3059\u3002 1.32 +doclet.Help_line_13=\u5404\u30B5\u30DE\u30EA\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306B\u306F\u3001\u305D\u306E\u9805\u76EE\u306E\u8A73\u7D30\u8AAC\u660E\u306E\u4E2D\u304B\u30891\u884C\u76EE\u306E\u6587\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u30B5\u30DE\u30EA\u30FC\u30FB\u30A8\u30F3\u30C8\u30EA\u306F\u30A2\u30EB\u30D5\u30A1\u30D9\u30C3\u30C8\u9806\u3067\u3059\u304C\u3001\u8A73\u7D30\u8AAC\u660E\u306F\u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9\u306B\u73FE\u308C\u308B\u9806\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002\u3053\u308C\u306B\u3088\u3063\u3066\u3001\u30D7\u30ED\u30B0\u30E9\u30DE\u304C\u8A2D\u5B9A\u3057\u305F\u8AD6\u7406\u7684\u306A\u30B0\u30EB\u30FC\u30D7\u5206\u3051\u304C\u4FDD\u6301\u3055\u308C\u307E\u3059\u3002 1.33 doclet.Help_line_14=\u4F7F\u7528 1.34 doclet.Help_line_15=\u5404\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5316\u3055\u308C\u305F\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u306F\u305D\u308C\u305E\u308C\u300C\u4F7F\u7528\u300D\u30DA\u30FC\u30B8\u304C\u3042\u308A\u307E\u3059\u3002\u3053\u306E\u30DA\u30FC\u30B8\u306B\u306F\u3001\u3069\u306E\u3088\u3046\u306A\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u3001\u30E1\u30BD\u30C3\u30C9\u3001\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u304A\u3088\u3073\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u3001\u7279\u5B9A\u306E\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u4E00\u90E8\u3092\u4F7F\u7528\u3057\u3066\u3044\u308B\u304B\u304C\u8A18\u8FF0\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u305F\u3068\u3048\u3070\u3001\u30AF\u30E9\u30B9A\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9A\u306E\u5834\u5408\u3001\u305D\u306E\u300C\u4F7F\u7528\u300D\u30DA\u30FC\u30B8\u306B\u306F\u3001A\u306E\u30B5\u30D6\u30AF\u30E9\u30B9\u3001A\u3068\u3057\u3066\u5BA3\u8A00\u3055\u308C\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u3001A\u3092\u8FD4\u3059\u30E1\u30BD\u30C3\u30C9\u3068\u3001\u578BA\u3092\u6301\u3064\u30E1\u30BD\u30C3\u30C9\u304A\u3088\u3073\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u304C\u542B\u307E\u308C\u307E\u3059\u3002\u3053\u306E\u30DA\u30FC\u30B8\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u306B\u306F\u3001\u307E\u305A\u305D\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u79FB\u52D5\u3057\u3001\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u306E\u300C\u4F7F\u7528\u300D\u30EA\u30F3\u30AF\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002 1.35 doclet.Help_line_16=\u968E\u5C64\u30C4\u30EA\u30FC(\u30AF\u30E9\u30B9\u968E\u5C64)
2.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties Tue May 13 23:18:48 2014 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties Wed May 14 11:01:08 2014 -0700 2.3 @@ -66,22 +66,22 @@ 2.4 doclet.malformed_html_link_tag=<a> \u30BF\u30B0\u306E\u5F62\u5F0F\u304C\u4E0D\u6B63:\n"{0}" 2.5 doclet.tag_misuse={0}\u30BF\u30B0\u306F{1}\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5185\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u4F7F\u7528\u3067\u304D\u308B\u306E\u306F\u6B21\u306E\u30BF\u30A4\u30D7\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5185\u306E\u307F\u3067\u3059: {2}\u3002 2.6 doclet.javafx_tag_misuse=\u30BF\u30B0@propertyGetter\u3001@propertySetter\u304A\u3088\u3073@propertyDescription\u306F\u3001JavaFX\u306E\u30D7\u30ED\u30D1\u30C6\u30A3getter\u3068setter\u306E\u307F\u3067\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002 2.7 -doclet.Package_Summary=\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u6982\u8981 2.8 +doclet.Package_Summary=\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u30B5\u30DE\u30EA\u30FC 2.9 doclet.Profile_Summary=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u30FB\u30B5\u30DE\u30EA\u30FC 2.10 -doclet.Interface_Summary=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u6982\u8981 2.11 -doclet.Annotation_Types_Summary=\u6CE8\u91C8\u578B\u306E\u6982\u8981 2.12 -doclet.Enum_Summary=\u5217\u6319\u578B\u306E\u6982\u8981 2.13 -doclet.Exception_Summary=\u4F8B\u5916\u306E\u6982\u8981 2.14 -doclet.Error_Summary=\u30A8\u30E9\u30FC\u306E\u6982\u8981 2.15 -doclet.Class_Summary=\u30AF\u30E9\u30B9\u306E\u6982\u8981 2.16 -doclet.Nested_Class_Summary=\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9\u306E\u6982\u8981 2.17 -doclet.Annotation_Type_Optional_Member_Summary=\u4EFB\u610F\u8981\u7D20\u306E\u6982\u8981 2.18 -doclet.Annotation_Type_Required_Member_Summary=\u5FC5\u9808\u8981\u7D20\u306E\u6982\u8981 2.19 -doclet.Field_Summary=\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u6982\u8981 2.20 -doclet.Property_Summary=\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u6982\u8981 2.21 -doclet.Enum_Constant_Summary=\u5217\u6319\u578B\u5B9A\u6570\u306E\u6982\u8981 2.22 -doclet.Constructor_Summary=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u6982\u8981 2.23 -doclet.Method_Summary=\u30E1\u30BD\u30C3\u30C9\u306E\u6982\u8981 2.24 +doclet.Interface_Summary=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u30B5\u30DE\u30EA\u30FC 2.25 +doclet.Annotation_Types_Summary=\u6CE8\u91C8\u578B\u306E\u30B5\u30DE\u30EA\u30FC 2.26 +doclet.Enum_Summary=\u5217\u6319\u578B\u306E\u30B5\u30DE\u30EA\u30FC 2.27 +doclet.Exception_Summary=\u4F8B\u5916\u306E\u30B5\u30DE\u30EA\u30FC 2.28 +doclet.Error_Summary=\u30A8\u30E9\u30FC\u306E\u30B5\u30DE\u30EA\u30FC 2.29 +doclet.Class_Summary=\u30AF\u30E9\u30B9\u306E\u30B5\u30DE\u30EA\u30FC 2.30 +doclet.Nested_Class_Summary=\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9\u306E\u30B5\u30DE\u30EA\u30FC 2.31 +doclet.Annotation_Type_Optional_Member_Summary=\u4EFB\u610F\u8981\u7D20\u306E\u30B5\u30DE\u30EA\u30FC 2.32 +doclet.Annotation_Type_Required_Member_Summary=\u5FC5\u9808\u8981\u7D20\u306E\u30B5\u30DE\u30EA\u30FC 2.33 +doclet.Field_Summary=\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30B5\u30DE\u30EA\u30FC 2.34 +doclet.Property_Summary=\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u30B5\u30DE\u30EA\u30FC 2.35 +doclet.Enum_Constant_Summary=\u5217\u6319\u578B\u5B9A\u6570\u306E\u30B5\u30DE\u30EA\u30FC 2.36 +doclet.Constructor_Summary=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u30B5\u30DE\u30EA\u30FC 2.37 +doclet.Method_Summary=\u30E1\u30BD\u30C3\u30C9\u306E\u30B5\u30DE\u30EA\u30FC 2.38 doclet.Interfaces=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9 2.39 doclet.Enums=\u5217\u6319\u578B 2.40 doclet.AnnotationTypes=\u6CE8\u91C8\u578B
3.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue May 13 23:18:48 2014 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed May 14 11:01:08 2014 -0700 3.3 @@ -392,7 +392,7 @@ 3.4 /** A class is an inner class if it it has an enclosing instance class. 3.5 */ 3.6 public boolean isInner() { 3.7 - return type.getEnclosingType().hasTag(CLASS); 3.8 + return kind == TYP && type.getEnclosingType().hasTag(CLASS); 3.9 } 3.10 3.11 /** An inner class has an outer instance if it is not an interface 3.12 @@ -703,10 +703,10 @@ 3.13 } 3.14 3.15 /** 3.16 - * A total ordering between type symbols that refines the 3.17 + * A partial ordering between type symbols that refines the 3.18 * class inheritance graph. 3.19 * 3.20 - * Typevariables always precede other kinds of symbols. 3.21 + * Type variables always precede other kinds of symbols. 3.22 */ 3.23 public final boolean precedes(TypeSymbol that, Types types) { 3.24 if (this == that)
4.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java Tue May 13 23:18:48 2014 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Wed May 14 11:01:08 2014 -0700 4.3 @@ -1445,12 +1445,19 @@ 4.4 * Inference variable bound kinds 4.5 */ 4.6 public enum InferenceBound { 4.7 - /** upper bounds */ 4.8 - UPPER, 4.9 - /** lower bounds */ 4.10 - LOWER, 4.11 - /** equality constraints */ 4.12 - EQ; 4.13 + UPPER { 4.14 + public InferenceBound complement() { return LOWER; } 4.15 + }, 4.16 + /** lower bounds */ 4.17 + LOWER { 4.18 + public InferenceBound complement() { return UPPER; } 4.19 + }, 4.20 + /** equality constraints */ 4.21 + EQ { 4.22 + public InferenceBound complement() { return EQ; } 4.23 + }; 4.24 + 4.25 + public abstract InferenceBound complement(); 4.26 } 4.27 4.28 /** inference variable bounds */ 4.29 @@ -1636,6 +1643,9 @@ 4.30 //only change bounds if request comes from substBounds 4.31 super.addBound(ib, bound, types, update); 4.32 } 4.33 + else if (bound.hasTag(UNDETVAR) && !((UndetVar) bound).isCaptured()) { 4.34 + ((UndetVar) bound).addBound(ib.complement(), this, types, false); 4.35 + } 4.36 } 4.37 4.38 @Override
5.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Tue May 13 23:18:48 2014 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Wed May 14 11:01:08 2014 -0700 5.3 @@ -43,6 +43,7 @@ 5.4 import com.sun.tools.javac.comp.Enter; 5.5 import com.sun.tools.javac.comp.Env; 5.6 import com.sun.tools.javac.jvm.ClassReader; 5.7 +import com.sun.tools.javac.tree.JCTree; 5.8 import com.sun.tools.javac.util.*; 5.9 import static com.sun.tools.javac.code.BoundKind.*; 5.10 import static com.sun.tools.javac.code.Flags.*; 5.11 @@ -151,31 +152,31 @@ 5.12 }; 5.13 // </editor-fold> 5.14 5.15 - // <editor-fold defaultstate="collapsed" desc="lowerBound"> 5.16 + // <editor-fold defaultstate="collapsed" desc="wildLowerBound"> 5.17 /** 5.18 - * The "lvalue conversion".<br> 5.19 - * The lower bound of most types is the type 5.20 - * itself. Wildcards, on the other hand have upper 5.21 - * and lower bounds. 5.22 + * Get a wildcard's lower bound, returning non-wildcards unchanged. 5.23 + * @param t a type argument, either a wildcard or a type 5.24 + */ 5.25 + public Type wildLowerBound(Type t) { 5.26 + if (t.hasTag(WILDCARD)) { 5.27 + WildcardType w = (WildcardType) t; 5.28 + return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type); 5.29 + } 5.30 + else return t; 5.31 + } 5.32 + // </editor-fold> 5.33 + 5.34 + // <editor-fold defaultstate="collapsed" desc="cvarLowerBound"> 5.35 + /** 5.36 + * Get a capture variable's lower bound, returning other types unchanged. 5.37 * @param t a type 5.38 - * @return the lower bound of the given type 5.39 */ 5.40 - public Type lowerBound(Type t) { 5.41 - return lowerBound.visit(t); 5.42 + public Type cvarLowerBound(Type t) { 5.43 + if (t.hasTag(TYPEVAR) && ((TypeVar) t).isCaptured()) { 5.44 + return cvarLowerBound(t.getLowerBound()); 5.45 + } 5.46 + else return t; 5.47 } 5.48 - // where 5.49 - private final MapVisitor<Void> lowerBound = new MapVisitor<Void>() { 5.50 - 5.51 - @Override 5.52 - public Type visitWildcardType(WildcardType t, Void ignored) { 5.53 - return t.isExtendsBound() ? syms.botType : visit(t.type); 5.54 - } 5.55 - 5.56 - @Override 5.57 - public Type visitCapturedType(CapturedType t, Void ignored) { 5.58 - return visit(t.getLowerBound()); 5.59 - } 5.60 - }; 5.61 // </editor-fold> 5.62 5.63 // <editor-fold defaultstate="collapsed" desc="isUnbounded"> 5.64 @@ -305,8 +306,8 @@ 5.65 } 5.66 5.67 /** 5.68 - * Is t a subtype of or convertiable via boxing/unboxing 5.69 - * convertions to s? 5.70 + * Is t a subtype of or convertible via boxing/unboxing 5.71 + * conversions to s? 5.72 */ 5.73 public boolean isConvertible(Type t, Type s) { 5.74 return isConvertible(t, s, noWarnings); 5.75 @@ -827,9 +828,15 @@ 5.76 return true; 5.77 } 5.78 5.79 - Type lower = lowerBound(s); 5.80 - if (s != lower) 5.81 - return isSubtype(capture ? capture(t) : t, lower, false); 5.82 + // Generally, if 's' is a type variable, recur on lower bound; but 5.83 + // for inference variables and intersections, we need to keep 's' 5.84 + // (see JLS 4.10.2 for intersections and 18.2.3 for inference vars) 5.85 + if (!t.hasTag(UNDETVAR) && !t.isCompound()) { 5.86 + // TODO: JDK-8039198, bounds checking sometimes passes in a wildcard as s 5.87 + Type lower = cvarLowerBound(wildLowerBound(s)); 5.88 + if (s != lower) 5.89 + return isSubtype(capture ? capture(t) : t, lower, false); 5.90 + } 5.91 5.92 return isSubtype.visit(capture ? capture(t) : t, s); 5.93 } 5.94 @@ -913,14 +920,11 @@ 5.95 @Override 5.96 public Boolean visitClassType(ClassType t, Type s) { 5.97 Type sup = asSuper(t, s.tsym); 5.98 - return sup != null 5.99 - && sup.tsym == s.tsym 5.100 - // You're not allowed to write 5.101 - // Vector<Object> vec = new Vector<String>(); 5.102 - // But with wildcards you can write 5.103 - // Vector<? extends Object> vec = new Vector<String>(); 5.104 - // which means that subtype checking must be done 5.105 - // here instead of same-type checking (via containsType). 5.106 + if (sup == null) return false; 5.107 + // If t is an intersection, sup might not be a class type 5.108 + if (!sup.hasTag(CLASS)) return isSubtypeNoCapture(sup, s); 5.109 + return sup.tsym == s.tsym 5.110 + // Check type variable containment 5.111 && (!s.isParameterized() || containsTypeRecursive(s, sup)) 5.112 && isSubtypeNoCapture(sup.getEnclosingType(), 5.113 s.getEnclosingType()); 5.114 @@ -1136,7 +1140,7 @@ 5.115 return visit(s, t); 5.116 5.117 if (s.isSuperBound() && !s.isExtendsBound()) 5.118 - return visit(t, upperBound(s)) && visit(t, lowerBound(s)); 5.119 + return visit(t, upperBound(s)) && visit(t, wildLowerBound(s)); 5.120 5.121 if (t.isCompound() && s.isCompound()) { 5.122 if (!visit(supertype(t), supertype(s))) 5.123 @@ -1291,7 +1295,7 @@ 5.124 break; 5.125 } 5.126 case SUPER: { 5.127 - Type bound = lowerBound(s); 5.128 + Type bound = wildLowerBound(s); 5.129 undetvar.addBound(InferenceBound.LOWER, bound, this); 5.130 break; 5.131 } 5.132 @@ -1384,9 +1388,9 @@ 5.133 // t.isSuperBound() 5.134 // || isSubtypeNoCapture(upperBound(s), U(t))); 5.135 // System.err.format(" %s L(%s) <: L(%s) %s = %s%n", 5.136 -// L(t), t, s, lowerBound(s), 5.137 +// L(t), t, s, wildLowerBound(s), 5.138 // t.isExtendsBound() 5.139 -// || isSubtypeNoCapture(L(t), lowerBound(s))); 5.140 +// || isSubtypeNoCapture(L(t), wildLowerBound(s))); 5.141 // System.err.println(); 5.142 // } 5.143 5.144 @@ -1398,7 +1402,7 @@ 5.145 // debugContainsType(t, s); 5.146 return isSameWildcard(t, s) 5.147 || isCaptureOf(s, t) 5.148 - || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(s))) && 5.149 + || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), wildLowerBound(s))) && 5.150 (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t)))); 5.151 } 5.152 } 5.153 @@ -1760,7 +1764,7 @@ 5.154 if (s.isExtendsBound()) 5.155 return !isCastableRecursive(t.type, upperBound(s)); 5.156 else if (s.isSuperBound()) 5.157 - return notSoftSubtypeRecursive(lowerBound(s), t.type); 5.158 + return notSoftSubtypeRecursive(wildLowerBound(s), t.type); 5.159 } else if (t.isSuperBound()) { 5.160 if (s.isExtendsBound()) 5.161 return notSoftSubtypeRecursive(t.type, upperBound(s)); 5.162 @@ -1770,19 +1774,13 @@ 5.163 }; 5.164 // </editor-fold> 5.165 5.166 - // <editor-fold defaultstate="collapsed" desc="lowerBoundArgtypes"> 5.167 - /** 5.168 - * Returns the lower bounds of the formals of a method. 5.169 - */ 5.170 - public List<Type> lowerBoundArgtypes(Type t) { 5.171 - return lowerBounds(t.getParameterTypes()); 5.172 + // <editor-fold defaultstate="collapsed" desc="cvarLowerBounds"> 5.173 + public List<Type> cvarLowerBounds(List<Type> ts) { 5.174 + return map(ts, cvarLowerBoundMapping); 5.175 } 5.176 - public List<Type> lowerBounds(List<Type> ts) { 5.177 - return map(ts, lowerBoundMapping); 5.178 - } 5.179 - private final Mapping lowerBoundMapping = new Mapping("lowerBound") { 5.180 + private final Mapping cvarLowerBoundMapping = new Mapping("cvarLowerBound") { 5.181 public Type apply(Type t) { 5.182 - return lowerBound(t); 5.183 + return cvarLowerBound(t); 5.184 } 5.185 }; 5.186 // </editor-fold> 5.187 @@ -1934,6 +1932,17 @@ 5.188 * @param sym a symbol 5.189 */ 5.190 public Type asSuper(Type t, Symbol sym) { 5.191 + /* Some examples: 5.192 + * 5.193 + * (Enum<E>, Comparable) => Comparable<E> 5.194 + * (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind> 5.195 + * (c.s.s.t.ExpressionTree, c.s.s.t.Tree) => c.s.s.t.Tree 5.196 + * (j.u.List<capture#160 of ? extends c.s.s.d.DocTree>, Iterable) => 5.197 + * Iterable<capture#160 of ? extends c.s.s.d.DocTree> 5.198 + */ 5.199 + if (sym.type == syms.objectType) { //optimization 5.200 + return syms.objectType; 5.201 + } 5.202 return asSuper.visit(t, sym); 5.203 } 5.204 // where 5.205 @@ -1949,16 +1958,18 @@ 5.206 return t; 5.207 5.208 Type st = supertype(t); 5.209 - if (st.hasTag(CLASS) || st.hasTag(TYPEVAR) || st.hasTag(ERROR)) { 5.210 + if (st.hasTag(CLASS) || st.hasTag(TYPEVAR)) { 5.211 Type x = asSuper(st, sym); 5.212 if (x != null) 5.213 return x; 5.214 } 5.215 if ((sym.flags() & INTERFACE) != 0) { 5.216 for (List<Type> l = interfaces(t); l.nonEmpty(); l = l.tail) { 5.217 - Type x = asSuper(l.head, sym); 5.218 - if (x != null) 5.219 - return x; 5.220 + if (!l.head.hasTag(ERROR)) { 5.221 + Type x = asSuper(l.head, sym); 5.222 + if (x != null) 5.223 + return x; 5.224 + } 5.225 } 5.226 } 5.227 return null; 5.228 @@ -2240,7 +2251,8 @@ 5.229 5.230 // <editor-fold defaultstate="collapsed" desc="makeCompoundType"> 5.231 /** 5.232 - * Make a compound type from non-empty list of types 5.233 + * Make a compound type from non-empty list of types. The list should be 5.234 + * ordered according to {@link Symbol#precedes(TypeSymbol,Types)}. 5.235 * 5.236 * @param bounds the types from which the compound type is formed 5.237 * @param supertype is objectType if all bounds are interfaces, 5.238 @@ -3330,12 +3342,15 @@ 5.239 * Insert a type in a closure 5.240 */ 5.241 public List<Type> insert(List<Type> cl, Type t) { 5.242 - if (cl.isEmpty() || t.tsym.precedes(cl.head.tsym, this)) { 5.243 + if (cl.isEmpty()) { 5.244 return cl.prepend(t); 5.245 - } else if (cl.head.tsym.precedes(t.tsym, this)) { 5.246 + } else if (t.tsym == cl.head.tsym) { 5.247 + return cl; 5.248 + } else if (t.tsym.precedes(cl.head.tsym, this)) { 5.249 + return cl.prepend(t); 5.250 + } else { 5.251 + // t comes after head, or the two are unrelated 5.252 return insert(cl.tail, t).prepend(cl.head); 5.253 - } else { 5.254 - return cl; 5.255 } 5.256 } 5.257 5.258 @@ -3347,12 +3362,15 @@ 5.259 return cl2; 5.260 } else if (cl2.isEmpty()) { 5.261 return cl1; 5.262 + } else if (cl1.head.tsym == cl2.head.tsym) { 5.263 + return union(cl1.tail, cl2.tail).prepend(cl1.head); 5.264 } else if (cl1.head.tsym.precedes(cl2.head.tsym, this)) { 5.265 return union(cl1.tail, cl2).prepend(cl1.head); 5.266 } else if (cl2.head.tsym.precedes(cl1.head.tsym, this)) { 5.267 return union(cl1, cl2.tail).prepend(cl2.head); 5.268 } else { 5.269 - return union(cl1.tail, cl2.tail).prepend(cl1.head); 5.270 + // unrelated types 5.271 + return union(cl1.tail, cl2).prepend(cl1.head); 5.272 } 5.273 } 5.274 5.275 @@ -3462,18 +3480,31 @@ 5.276 private List<Type> closureMin(List<Type> cl) { 5.277 ListBuffer<Type> classes = new ListBuffer<>(); 5.278 ListBuffer<Type> interfaces = new ListBuffer<>(); 5.279 + Set<Type> toSkip = new HashSet<>(); 5.280 while (!cl.isEmpty()) { 5.281 Type current = cl.head; 5.282 - if (current.isInterface()) 5.283 - interfaces.append(current); 5.284 - else 5.285 - classes.append(current); 5.286 - ListBuffer<Type> candidates = new ListBuffer<>(); 5.287 - for (Type t : cl.tail) { 5.288 - if (!isSubtypeNoCapture(current, t)) 5.289 - candidates.append(t); 5.290 + boolean keep = !toSkip.contains(current); 5.291 + if (keep && current.hasTag(TYPEVAR)) { 5.292 + // skip lower-bounded variables with a subtype in cl.tail 5.293 + for (Type t : cl.tail) { 5.294 + if (isSubtypeNoCapture(t, current)) { 5.295 + keep = false; 5.296 + break; 5.297 + } 5.298 + } 5.299 } 5.300 - cl = candidates.toList(); 5.301 + if (keep) { 5.302 + if (current.isInterface()) 5.303 + interfaces.append(current); 5.304 + else 5.305 + classes.append(current); 5.306 + for (Type t : cl.tail) { 5.307 + // skip supertypes of 'current' in cl.tail 5.308 + if (isSubtypeNoCapture(current, t)) 5.309 + toSkip.add(t); 5.310 + } 5.311 + } 5.312 + cl = cl.tail; 5.313 } 5.314 return classes.appendList(interfaces).toList(); 5.315 } 5.316 @@ -3633,7 +3664,19 @@ 5.317 return s; 5.318 5.319 List<Type> closure = union(closure(t), closure(s)); 5.320 - List<Type> bounds = closureMin(closure); 5.321 + return glbFlattened(closure, t); 5.322 + } 5.323 + //where 5.324 + /** 5.325 + * Perform glb for a list of non-primitive, non-error, non-compound types; 5.326 + * redundant elements are removed. Bounds should be ordered according to 5.327 + * {@link Symbol#precedes(TypeSymbol,Types)}. 5.328 + * 5.329 + * @param flatBounds List of type to glb 5.330 + * @param errT Original type to use if the result is an error type 5.331 + */ 5.332 + private Type glbFlattened(List<Type> flatBounds, Type errT) { 5.333 + List<Type> bounds = closureMin(flatBounds); 5.334 5.335 if (bounds.isEmpty()) { // length == 0 5.336 return syms.objectType; 5.337 @@ -3641,11 +3684,21 @@ 5.338 return bounds.head; 5.339 } else { // length > 1 5.340 int classCount = 0; 5.341 - for (Type bound : bounds) 5.342 - if (!bound.isInterface()) 5.343 + List<Type> lowers = List.nil(); 5.344 + for (Type bound : bounds) { 5.345 + if (!bound.isInterface()) { 5.346 classCount++; 5.347 - if (classCount > 1) 5.348 - return createErrorType(t); 5.349 + Type lower = cvarLowerBound(bound); 5.350 + if (bound != lower && !lower.hasTag(BOT)) 5.351 + lowers = insert(lowers, lower); 5.352 + } 5.353 + } 5.354 + if (classCount > 1) { 5.355 + if (lowers.isEmpty()) 5.356 + return createErrorType(errT); 5.357 + else 5.358 + return glbFlattened(union(bounds, lowers), errT); 5.359 + } 5.360 } 5.361 return makeCompoundType(bounds); 5.362 } 5.363 @@ -3869,9 +3922,11 @@ 5.364 } 5.365 return buf.reverse(); 5.366 } 5.367 + 5.368 public Type capture(Type t) { 5.369 - if (!t.hasTag(CLASS)) 5.370 + if (!t.hasTag(CLASS)) { 5.371 return t; 5.372 + } 5.373 if (t.getEnclosingType() != Type.noType) { 5.374 Type capturedEncl = capture(t.getEnclosingType()); 5.375 if (capturedEncl != t.getEnclosingType()) { 5.376 @@ -4123,7 +4178,7 @@ 5.377 if (source.isExtendsBound()) 5.378 adaptRecursive(upperBound(source), upperBound(target)); 5.379 else if (source.isSuperBound()) 5.380 - adaptRecursive(lowerBound(source), lowerBound(target)); 5.381 + adaptRecursive(wildLowerBound(source), wildLowerBound(target)); 5.382 return null; 5.383 } 5.384 5.385 @@ -4135,7 +4190,7 @@ 5.386 Type val = mapping.get(source.tsym); 5.387 if (val != null) { 5.388 if (val.isSuperBound() && target.isSuperBound()) { 5.389 - val = isSubtype(lowerBound(val), lowerBound(target)) 5.390 + val = isSubtype(wildLowerBound(val), wildLowerBound(target)) 5.391 ? target : val; 5.392 } else if (val.isExtendsBound() && target.isExtendsBound()) { 5.393 val = isSubtype(upperBound(val), upperBound(target)) 5.394 @@ -4249,7 +4304,7 @@ 5.395 } 5.396 5.397 public Type visitType(Type t, Void s) { 5.398 - return high ? upperBound(t) : lowerBound(t); 5.399 + return high ? upperBound(t) : t; 5.400 } 5.401 5.402 @Override
6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue May 13 23:18:48 2014 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed May 14 11:01:08 2014 -0700 6.3 @@ -518,6 +518,10 @@ 6.4 return new ResultInfo(pkind, pt, newContext); 6.5 } 6.6 6.7 + protected ResultInfo dup(Type newPt, CheckContext newContext) { 6.8 + return new ResultInfo(pkind, newPt, newContext); 6.9 + } 6.10 + 6.11 @Override 6.12 public String toString() { 6.13 if (pt != null) { 6.14 @@ -2143,6 +2147,11 @@ 6.15 cdef.extending = clazz; 6.16 } 6.17 6.18 + if (resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && 6.19 + isSerializable(clazztype)) { 6.20 + localEnv.info.isSerializable = true; 6.21 + } 6.22 + 6.23 attribStat(cdef, localEnv); 6.24 6.25 checkLambdaCandidate(tree, cdef.sym, clazztype); 6.26 @@ -2298,6 +2307,9 @@ 6.27 resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK; 6.28 try { 6.29 Type currentTarget = pt(); 6.30 + if (needsRecovery && isSerializable(currentTarget)) { 6.31 + localEnv.info.isSerializable = true; 6.32 + } 6.33 List<Type> explicitParamTypes = null; 6.34 if (that.paramKind == JCLambda.ParameterKind.EXPLICIT) { 6.35 //attribute lambda parameters 6.36 @@ -2702,17 +2714,20 @@ 6.37 typeargtypes = attribTypes(that.typeargs, localEnv); 6.38 } 6.39 6.40 - Type target; 6.41 Type desc; 6.42 - if (pt() != Type.recoveryType) { 6.43 - target = targetChecker.visit(pt(), that); 6.44 - desc = types.findDescriptorType(target); 6.45 + Type currentTarget = pt(); 6.46 + boolean isTargetSerializable = 6.47 + resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && 6.48 + isSerializable(currentTarget); 6.49 + if (currentTarget != Type.recoveryType) { 6.50 + currentTarget = targetChecker.visit(currentTarget, that); 6.51 + desc = types.findDescriptorType(currentTarget); 6.52 } else { 6.53 - target = Type.recoveryType; 6.54 + currentTarget = Type.recoveryType; 6.55 desc = fallbackDescriptorType(that); 6.56 } 6.57 6.58 - setFunctionalInfo(localEnv, that, pt(), desc, target, resultInfo.checkContext); 6.59 + setFunctionalInfo(localEnv, that, pt(), desc, currentTarget, resultInfo.checkContext); 6.60 List<Type> argtypes = desc.getParameterTypes(); 6.61 Resolve.MethodCheck referenceCheck = rs.resolveMethodCheck; 6.62 6.63 @@ -2754,7 +2769,7 @@ 6.64 targetError = false; 6.65 } 6.66 6.67 - JCDiagnostic detailsDiag = ((Resolve.ResolveError)refSym).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT, 6.68 + JCDiagnostic detailsDiag = ((Resolve.ResolveError)refSym.baseSymbol()).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT, 6.69 that, exprType.tsym, exprType, that.name, argtypes, typeargtypes); 6.70 6.71 JCDiagnostic.DiagnosticType diagKind = targetError ? 6.72 @@ -2763,10 +2778,10 @@ 6.73 JCDiagnostic diag = diags.create(diagKind, log.currentSource(), that, 6.74 "invalid.mref", Kinds.kindName(that.getMode()), detailsDiag); 6.75 6.76 - if (targetError && target == Type.recoveryType) { 6.77 + if (targetError && currentTarget == Type.recoveryType) { 6.78 //a target error doesn't make sense during recovery stage 6.79 //as we don't know what actual parameter types are 6.80 - result = that.type = target; 6.81 + result = that.type = currentTarget; 6.82 return; 6.83 } else { 6.84 if (targetError) { 6.85 @@ -2774,7 +2789,7 @@ 6.86 } else { 6.87 log.report(diag); 6.88 } 6.89 - result = that.type = types.createErrorType(target); 6.90 + result = that.type = types.createErrorType(currentTarget); 6.91 return; 6.92 } 6.93 } 6.94 @@ -2785,7 +2800,7 @@ 6.95 6.96 if (desc.getReturnType() == Type.recoveryType) { 6.97 // stop here 6.98 - result = that.type = target; 6.99 + result = that.type = currentTarget; 6.100 return; 6.101 } 6.102 6.103 @@ -2803,7 +2818,7 @@ 6.104 //static ref with class type-args 6.105 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()), 6.106 diags.fragment("static.mref.with.targs")); 6.107 - result = that.type = types.createErrorType(target); 6.108 + result = that.type = types.createErrorType(currentTarget); 6.109 return; 6.110 } 6.111 6.112 @@ -2812,7 +2827,7 @@ 6.113 //no static bound mrefs 6.114 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()), 6.115 diags.fragment("static.bound.mref")); 6.116 - result = that.type = types.createErrorType(target); 6.117 + result = that.type = types.createErrorType(currentTarget); 6.118 return; 6.119 } 6.120 6.121 @@ -2820,12 +2835,17 @@ 6.122 // Check that super-qualified symbols are not abstract (JLS) 6.123 rs.checkNonAbstract(that.pos(), that.sym); 6.124 } 6.125 + 6.126 + if (isTargetSerializable) { 6.127 + chk.checkElemAccessFromSerializableLambda(that); 6.128 + } 6.129 } 6.130 6.131 ResultInfo checkInfo = 6.132 resultInfo.dup(newMethodTemplate( 6.133 desc.getReturnType().hasTag(VOID) ? Type.noType : desc.getReturnType(), 6.134 - that.kind.isUnbound() ? argtypes.tail : argtypes, typeargtypes)); 6.135 + that.kind.isUnbound() ? argtypes.tail : argtypes, typeargtypes), 6.136 + new FunctionalReturnContext(resultInfo.checkContext)); 6.137 6.138 Type refType = checkId(that, lookupHelper.site, refSym, localEnv, checkInfo); 6.139 6.140 @@ -2851,9 +2871,9 @@ 6.141 resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.SPECULATIVE; 6.142 checkReferenceCompatible(that, desc, refType, resultInfo.checkContext, isSpeculativeRound); 6.143 if (!isSpeculativeRound) { 6.144 - checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), desc, target); 6.145 + checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), desc, currentTarget); 6.146 } 6.147 - result = check(that, target, VAL, resultInfo); 6.148 + result = check(that, currentTarget, VAL, resultInfo); 6.149 } catch (Types.FunctionDescriptorLookupError ex) { 6.150 JCDiagnostic cause = ex.getDiagnostic(); 6.151 resultInfo.checkContext.report(that, cause); 6.152 @@ -3193,6 +3213,11 @@ 6.153 while (env1.outer != null && !rs.isAccessible(env, env1.enclClass.sym.type, sym)) 6.154 env1 = env1.outer; 6.155 } 6.156 + 6.157 + if (env.info.isSerializable) { 6.158 + chk.checkElemAccessFromSerializableLambda(tree); 6.159 + } 6.160 + 6.161 result = checkId(tree, env1.enclClass.sym.type, sym, env, resultInfo); 6.162 } 6.163 6.164 @@ -3317,6 +3342,10 @@ 6.165 } 6.166 } 6.167 6.168 + if (env.info.isSerializable) { 6.169 + chk.checkElemAccessFromSerializableLambda(tree); 6.170 + } 6.171 + 6.172 env.info.selectSuper = selectSuperPrev; 6.173 result = checkId(tree, site, sym, env, resultInfo); 6.174 } 6.175 @@ -4195,6 +4224,11 @@ 6.176 ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) { 6.177 log.error(env.tree.pos(), "enum.types.not.extensible"); 6.178 } 6.179 + 6.180 + if (isSerializable(c.type)) { 6.181 + env.info.isSerializable = true; 6.182 + } 6.183 + 6.184 attribClassBody(env, c); 6.185 6.186 chk.checkDeprecatedAnnotation(env.tree.pos(), c); 6.187 @@ -4308,7 +4342,7 @@ 6.188 6.189 // Check for proper use of serialVersionUID 6.190 if (env.info.lint.isEnabled(LintCategory.SERIAL) && 6.191 - isSerializable(c) && 6.192 + isSerializable(c.type) && 6.193 (c.flags() & Flags.ENUM) == 0 && 6.194 checkForSerial(c)) { 6.195 checkSerialVersionUID(tree, c); 6.196 @@ -4348,15 +4382,15 @@ 6.197 return null; 6.198 } 6.199 6.200 - /** check if a class is a subtype of Serializable, if that is available. */ 6.201 - private boolean isSerializable(ClassSymbol c) { 6.202 + /** check if a type is a subtype of Serializable, if that is available. */ 6.203 + boolean isSerializable(Type t) { 6.204 try { 6.205 syms.serializableType.complete(); 6.206 } 6.207 catch (CompletionFailure e) { 6.208 return false; 6.209 } 6.210 - return types.isSubtype(c.type, syms.serializableType); 6.211 + return types.isSubtype(t, syms.serializableType); 6.212 } 6.213 6.214 /** Check that an appropriate serialVersionUID member is defined. */
7.1 --- a/src/share/classes/com/sun/tools/javac/comp/AttrContext.java Tue May 13 23:18:48 2014 -0700 7.2 +++ b/src/share/classes/com/sun/tools/javac/comp/AttrContext.java Wed May 14 11:01:08 2014 -0700 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -54,6 +54,10 @@ 7.11 */ 7.12 boolean selectSuper = false; 7.13 7.14 + /** Is the current target of lambda expression or method reference serializable? 7.15 + */ 7.16 + boolean isSerializable = false; 7.17 + 7.18 /** Are arguments to current function applications boxed into an array for varargs? 7.19 */ 7.20 Resolve.MethodResolutionPhase pendingResolutionPhase = null; 7.21 @@ -89,6 +93,7 @@ 7.22 info.enclVar = enclVar; 7.23 info.returnResult = returnResult; 7.24 info.defaultSuperCallSite = defaultSuperCallSite; 7.25 + info.isSerializable = isSerializable; 7.26 return info; 7.27 } 7.28
8.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Tue May 13 23:18:48 2014 -0700 8.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Wed May 14 11:01:08 2014 -0700 8.3 @@ -82,6 +82,7 @@ 8.4 private final TreeInfo treeinfo; 8.5 private final JavaFileManager fileManager; 8.6 private final Profile profile; 8.7 + private final boolean warnOnAccessToSensitiveMembers; 8.8 8.9 // The set of lint options currently in effect. It is initialized 8.10 // from the context, and then is set/reset as needed by Attr as it 8.11 @@ -131,6 +132,7 @@ 8.12 warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts"); 8.13 suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile"); 8.14 enableSunApiLintControl = options.isSet("enableSunApiLintControl"); 8.15 + warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers"); 8.16 8.17 Target target = Target.instance(context); 8.18 syntheticNameChar = target.syntheticNameChar(); 8.19 @@ -510,6 +512,11 @@ 8.20 public DeferredAttrContext deferredAttrContext() { 8.21 return deferredAttr.emptyDeferredAttrContext; 8.22 } 8.23 + 8.24 + @Override 8.25 + public String toString() { 8.26 + return "CheckContext: basicHandler"; 8.27 + } 8.28 }; 8.29 8.30 /** Check that a given type is assignable to a given proto-type. 8.31 @@ -616,7 +623,7 @@ 8.32 } else if (a.isExtendsBound()) { 8.33 return types.isCastable(bound, types.upperBound(a), types.noWarnings); 8.34 } else if (a.isSuperBound()) { 8.35 - return !types.notSoftSubtype(types.lowerBound(a), bound); 8.36 + return !types.notSoftSubtype(types.wildLowerBound(a), bound); 8.37 } 8.38 return true; 8.39 } 8.40 @@ -2583,6 +2590,44 @@ 8.41 } 8.42 } 8.43 8.44 + void checkElemAccessFromSerializableLambda(final JCTree tree) { 8.45 + if (warnOnAccessToSensitiveMembers) { 8.46 + Symbol sym = TreeInfo.symbol(tree); 8.47 + if ((sym.kind & (VAR | MTH)) == 0) { 8.48 + return; 8.49 + } 8.50 + 8.51 + if (sym.kind == VAR) { 8.52 + if ((sym.flags() & PARAMETER) != 0 || 8.53 + sym.isLocal() || 8.54 + sym.name == names._this || 8.55 + sym.name == names._super) { 8.56 + return; 8.57 + } 8.58 + } 8.59 + 8.60 + if (!types.isSubtype(sym.owner.type, syms.serializableType) && 8.61 + isEffectivelyNonPublic(sym)) { 8.62 + log.warning(tree.pos(), 8.63 + "access.to.sensitive.member.from.serializable.element", sym); 8.64 + } 8.65 + } 8.66 + } 8.67 + 8.68 + private boolean isEffectivelyNonPublic(Symbol sym) { 8.69 + if (sym.packge() == syms.rootPackage) { 8.70 + return false; 8.71 + } 8.72 + 8.73 + while (sym.kind != Kinds.PCK) { 8.74 + if ((sym.flags() & PUBLIC) == 0) { 8.75 + return true; 8.76 + } 8.77 + sym = sym.owner; 8.78 + } 8.79 + return false; 8.80 + } 8.81 + 8.82 /** Report a conflict between a user symbol and a synthetic symbol. 8.83 */ 8.84 private void syntheticError(DiagnosticPosition pos, Symbol sym) { 8.85 @@ -2680,7 +2725,7 @@ 8.86 if (types.isSameType(type, syms.stringType)) return; 8.87 if ((type.tsym.flags() & Flags.ENUM) != 0) return; 8.88 if ((type.tsym.flags() & Flags.ANNOTATION) != 0) return; 8.89 - if (types.lowerBound(type).tsym == syms.classType.tsym) return; 8.90 + if (types.cvarLowerBound(type).tsym == syms.classType.tsym) return; 8.91 if (types.isArray(type) && !types.isArray(types.elemtype(type))) { 8.92 validateAnnotationType(pos, types.elemtype(type)); 8.93 return;
9.1 --- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Tue May 13 23:18:48 2014 -0700 9.2 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Wed May 14 11:01:08 2014 -0700 9.3 @@ -110,6 +110,11 @@ 9.4 void complete() { 9.5 Assert.error("Empty deferred context!"); 9.6 } 9.7 + 9.8 + @Override 9.9 + public String toString() { 9.10 + return "Empty deferred context!"; 9.11 + } 9.12 }; 9.13 } 9.14
10.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue May 13 23:18:48 2014 -0700 10.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Wed May 14 11:01:08 2014 -0700 10.3 @@ -142,24 +142,24 @@ 10.4 * Main inference entry point - instantiate a generic method type 10.5 * using given argument types and (possibly) an expected target-type. 10.6 */ 10.7 - public Type instantiateMethod(Env<AttrContext> env, 10.8 - List<Type> tvars, 10.9 - MethodType mt, 10.10 - Attr.ResultInfo resultInfo, 10.11 - Symbol msym, 10.12 - List<Type> argtypes, 10.13 - boolean allowBoxing, 10.14 - boolean useVarargs, 10.15 - Resolve.MethodResolutionContext resolveContext, 10.16 - Warner warn) throws InferenceException { 10.17 + Type instantiateMethod( Env<AttrContext> env, 10.18 + List<Type> tvars, 10.19 + MethodType mt, 10.20 + Attr.ResultInfo resultInfo, 10.21 + MethodSymbol msym, 10.22 + List<Type> argtypes, 10.23 + boolean allowBoxing, 10.24 + boolean useVarargs, 10.25 + Resolve.MethodResolutionContext resolveContext, 10.26 + Warner warn) throws InferenceException { 10.27 //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG 10.28 - final InferenceContext inferenceContext = new InferenceContext(tvars); 10.29 + final InferenceContext inferenceContext = new InferenceContext(tvars); //B0 10.30 inferenceException.clear(); 10.31 try { 10.32 DeferredAttr.DeferredAttrContext deferredAttrContext = 10.33 resolveContext.deferredAttrContext(msym, inferenceContext, resultInfo, warn); 10.34 10.35 - resolveContext.methodCheck.argumentsAcceptable(env, deferredAttrContext, 10.36 + resolveContext.methodCheck.argumentsAcceptable(env, deferredAttrContext, //B2 10.37 argtypes, mt.getParameterTypes(), warn); 10.38 10.39 if (allowGraphInference && 10.40 @@ -167,7 +167,8 @@ 10.41 !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) { 10.42 //inject return constraints earlier 10.43 checkWithinBounds(inferenceContext, warn); //propagation 10.44 - Type newRestype = generateReturnConstraints(resultInfo, mt, inferenceContext); 10.45 + Type newRestype = generateReturnConstraints(env.tree, resultInfo, //B3 10.46 + mt, inferenceContext); 10.47 mt = (MethodType)types.createMethodTypeWithReturn(mt, newRestype); 10.48 //propagate outwards if needed 10.49 if (resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) { 10.50 @@ -193,7 +194,7 @@ 10.51 inferenceContext.restvars().nonEmpty() && 10.52 resultInfo != null && 10.53 !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) { 10.54 - generateReturnConstraints(resultInfo, mt, inferenceContext); 10.55 + generateReturnConstraints(env.tree, resultInfo, mt, inferenceContext); 10.56 inferenceContext.solveLegacy(false, warn, LegacyInferenceSteps.EQ_UPPER.steps); //maximizeInst 10.57 mt = (MethodType)inferenceContext.asInstType(mt); 10.58 } 10.59 @@ -210,6 +211,12 @@ 10.60 } else { 10.61 inferenceContext.notifyChange(inferenceContext.boundedVars()); 10.62 } 10.63 + if (resultInfo == null) { 10.64 + /* if the is no result info then we can clear the capture types 10.65 + * cache without affecting any result info check 10.66 + */ 10.67 + inferenceContext.captureTypeCache.clear(); 10.68 + } 10.69 } 10.70 } 10.71 10.72 @@ -218,7 +225,7 @@ 10.73 * call occurs in a context where a type T is expected, use the expected 10.74 * type to derive more constraints on the generic method inference variables. 10.75 */ 10.76 - Type generateReturnConstraints(Attr.ResultInfo resultInfo, 10.77 + Type generateReturnConstraints(JCTree tree, Attr.ResultInfo resultInfo, 10.78 MethodType mt, InferenceContext inferenceContext) { 10.79 InferenceContext rsInfoInfContext = resultInfo.checkContext.inferenceContext(); 10.80 Type from = mt.getReturnType(); 10.81 @@ -232,13 +239,29 @@ 10.82 } 10.83 } 10.84 } 10.85 - Type qtype1 = inferenceContext.asUndetVar(from); 10.86 - Type to = returnConstraintTarget(qtype1, resultInfo.pt); 10.87 + Type qtype = inferenceContext.asUndetVar(from); 10.88 + Type to = resultInfo.pt; 10.89 + 10.90 + if (qtype.hasTag(VOID)) { 10.91 + to = syms.voidType; 10.92 + } else if (to.hasTag(NONE)) { 10.93 + to = from.isPrimitive() ? from : syms.objectType; 10.94 + } else if (qtype.hasTag(UNDETVAR)) { 10.95 + if (resultInfo.pt.isReference()) { 10.96 + to = generateReturnConstraintsUndetVarToReference( 10.97 + tree, (UndetVar)qtype, to, resultInfo, inferenceContext); 10.98 + } else { 10.99 + if (to.isPrimitive()) { 10.100 + to = generateReturnConstraintsPrimitive(tree, (UndetVar)qtype, to, 10.101 + resultInfo, inferenceContext); 10.102 + } 10.103 + } 10.104 + } 10.105 Assert.check(allowGraphInference || !rsInfoInfContext.free(to), 10.106 "legacy inference engine cannot handle constraints on both sides of a subtyping assertion"); 10.107 //we need to skip capture? 10.108 Warner retWarn = new Warner(); 10.109 - if (!resultInfo.checkContext.compatible(qtype1, rsInfoInfContext.asUndetVar(to), retWarn) || 10.110 + if (!resultInfo.checkContext.compatible(qtype, rsInfoInfContext.asUndetVar(to), retWarn) || 10.111 //unchecked conversion is not allowed in source 7 mode 10.112 (!allowGraphInference && retWarn.hasLint(Lint.LintCategory.UNCHECKED))) { 10.113 throw inferenceException 10.114 @@ -248,30 +271,96 @@ 10.115 return from; 10.116 } 10.117 10.118 - Type returnConstraintTarget(Type from, Type to) { 10.119 - if (from.hasTag(VOID)) { 10.120 - return syms.voidType; 10.121 - } else if (to.hasTag(NONE)) { 10.122 - return from.isPrimitive() ? from : syms.objectType; 10.123 - } else if (from.hasTag(UNDETVAR) && to.isPrimitive()) { 10.124 - if (!allowGraphInference) { 10.125 - //if legacy, just return boxed type 10.126 - return types.boxedClass(to).type; 10.127 + private Type generateReturnConstraintsPrimitive(JCTree tree, UndetVar from, 10.128 + Type to, Attr.ResultInfo resultInfo, InferenceContext inferenceContext) { 10.129 + if (!allowGraphInference) { 10.130 + //if legacy, just return boxed type 10.131 + return types.boxedClass(to).type; 10.132 + } 10.133 + //if graph inference we need to skip conflicting boxed bounds... 10.134 + for (Type t : from.getBounds(InferenceBound.EQ, InferenceBound.UPPER, 10.135 + InferenceBound.LOWER)) { 10.136 + Type boundAsPrimitive = types.unboxedType(t); 10.137 + if (boundAsPrimitive == null || boundAsPrimitive.hasTag(NONE)) { 10.138 + continue; 10.139 } 10.140 - //if graph inference we need to skip conflicting boxed bounds... 10.141 - UndetVar uv = (UndetVar)from; 10.142 - for (Type t : uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) { 10.143 - Type boundAsPrimitive = types.unboxedType(t); 10.144 - if (boundAsPrimitive == null) continue; 10.145 - if (types.isConvertible(boundAsPrimitive, to)) { 10.146 - //effectively skip return-type constraint generation (compatibility) 10.147 - return syms.objectType; 10.148 + return generateReferenceToTargetConstraint(tree, from, to, 10.149 + resultInfo, inferenceContext); 10.150 + } 10.151 + return types.boxedClass(to).type; 10.152 + } 10.153 + 10.154 + private Type generateReturnConstraintsUndetVarToReference(JCTree tree, 10.155 + UndetVar from, Type to, Attr.ResultInfo resultInfo, 10.156 + InferenceContext inferenceContext) { 10.157 + Type captureOfTo = types.capture(to); 10.158 + /* T is a reference type, but is not a wildcard-parameterized type, and either 10.159 + */ 10.160 + if (captureOfTo == to) { //not a wildcard parameterized type 10.161 + /* i) B2 contains a bound of one of the forms alpha = S or S <: alpha, 10.162 + * where S is a wildcard-parameterized type, or 10.163 + */ 10.164 + for (Type t : from.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) { 10.165 + Type captureOfBound = types.capture(t); 10.166 + if (captureOfBound != t) { 10.167 + return generateReferenceToTargetConstraint(tree, from, to, 10.168 + resultInfo, inferenceContext); 10.169 } 10.170 } 10.171 - return types.boxedClass(to).type; 10.172 - } else { 10.173 - return to; 10.174 + 10.175 + /* ii) B2 contains two bounds of the forms S1 <: alpha and S2 <: alpha, 10.176 + * where S1 and S2 have supertypes that are two different 10.177 + * parameterizations of the same generic class or interface. 10.178 + */ 10.179 + for (Type aLowerBound : from.getBounds(InferenceBound.LOWER)) { 10.180 + for (Type anotherLowerBound : from.getBounds(InferenceBound.LOWER)) { 10.181 + if (aLowerBound != anotherLowerBound && 10.182 + commonSuperWithDiffParameterization(aLowerBound, anotherLowerBound)) { 10.183 + /* self comment check if any lower bound may be and undetVar, 10.184 + * in that case the result of this call may be a false positive. 10.185 + * Should this be restricted to non free types? 10.186 + */ 10.187 + return generateReferenceToTargetConstraint(tree, from, to, 10.188 + resultInfo, inferenceContext); 10.189 + } 10.190 + } 10.191 + } 10.192 } 10.193 + 10.194 + /* T is a parameterization of a generic class or interface, G, 10.195 + * and B2 contains a bound of one of the forms alpha = S or S <: alpha, 10.196 + * where there exists no type of the form G<...> that is a 10.197 + * supertype of S, but the raw type G is a supertype of S 10.198 + */ 10.199 + if (to.isParameterized()) { 10.200 + for (Type t : from.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) { 10.201 + Type sup = types.asSuper(t, to.tsym); 10.202 + if (sup != null && sup.isRaw()) { 10.203 + return generateReferenceToTargetConstraint(tree, from, to, 10.204 + resultInfo, inferenceContext); 10.205 + } 10.206 + } 10.207 + } 10.208 + return to; 10.209 + } 10.210 + 10.211 + private boolean commonSuperWithDiffParameterization(Type t, Type s) { 10.212 + Pair<Type, Type> supers = getParameterizedSupers(t, s); 10.213 + return (supers != null && !types.isSameType(supers.fst, supers.snd)); 10.214 + } 10.215 + 10.216 + private Type generateReferenceToTargetConstraint(JCTree tree, UndetVar from, 10.217 + Type to, Attr.ResultInfo resultInfo, 10.218 + InferenceContext inferenceContext) { 10.219 + inferenceContext.solve(List.of(from.qtype), new Warner()); 10.220 + Type capturedType = resultInfo.checkContext.inferenceContext() 10.221 + .cachedCapture(tree, from.inst, false); 10.222 + if (types.isConvertible(capturedType, 10.223 + resultInfo.checkContext.inferenceContext().asUndetVar(to))) { 10.224 + //effectively skip additional return-type constraint generation (compatibility) 10.225 + return syms.objectType; 10.226 + } 10.227 + return to; 10.228 } 10.229 10.230 /** 10.231 @@ -1318,7 +1407,7 @@ 10.232 Type solve(UndetVar uv, InferenceContext inferenceContext) { 10.233 Infer infer = inferenceContext.infer(); 10.234 List<Type> hibounds = filterBounds(uv, inferenceContext); 10.235 - //note: lobounds should have at least one element 10.236 + //note: hibounds should have at least one element 10.237 Type owntype = hibounds.tail.tail == null ? hibounds.head : infer.types.glb(hibounds); 10.238 if (owntype.isPrimitive() || owntype.hasTag(ERROR)) { 10.239 throw infer.inferenceException 10.240 @@ -2082,8 +2171,10 @@ 10.241 * Copy variable in this inference context to the given context 10.242 */ 10.243 void dupTo(final InferenceContext that) { 10.244 - that.inferencevars = that.inferencevars.appendList(inferencevars); 10.245 - that.undetvars = that.undetvars.appendList(undetvars); 10.246 + that.inferencevars = that.inferencevars.appendList( 10.247 + inferencevars.diff(that.inferencevars)); 10.248 + that.undetvars = that.undetvars.appendList( 10.249 + undetvars.diff(that.undetvars)); 10.250 //set up listeners to notify original inference contexts as 10.251 //propagated vars are inferred in new context 10.252 for (Type t : inferencevars) { 10.253 @@ -2202,6 +2293,30 @@ 10.254 return "Inference vars: " + inferencevars + '\n' + 10.255 "Undet vars: " + undetvars; 10.256 } 10.257 + 10.258 + /* Method Types.capture() generates a new type every time it's applied 10.259 + * to a wildcard parameterized type. This is intended functionality but 10.260 + * there are some cases when what you need is not to generate a new 10.261 + * captured type but to check that a previously generated captured type 10.262 + * is correct. There are cases when caching a captured type for later 10.263 + * reuse is sound. In general two captures from the same AST are equal. 10.264 + * This is why the tree is used as the key of the map below. This map 10.265 + * stores a Type per AST. 10.266 + */ 10.267 + Map<JCTree, Type> captureTypeCache = new HashMap<>(); 10.268 + 10.269 + Type cachedCapture(JCTree tree, Type t, boolean readOnly) { 10.270 + Type captured = captureTypeCache.get(tree); 10.271 + if (captured != null) { 10.272 + return captured; 10.273 + } 10.274 + 10.275 + Type result = types.capture(t); 10.276 + if (result != t && !readOnly) { // then t is a wildcard parameterized type 10.277 + captureTypeCache.put(tree, result); 10.278 + } 10.279 + return result; 10.280 + } 10.281 } 10.282 10.283 final InferenceContext emptyContext = new InferenceContext(List.<Type>nil());
11.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Tue May 13 23:18:48 2014 -0700 11.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed May 14 11:01:08 2014 -0700 11.3 @@ -36,6 +36,7 @@ 11.4 import com.sun.tools.javac.code.Symbol.ClassSymbol; 11.5 import com.sun.tools.javac.code.Symbol.DynamicMethodSymbol; 11.6 import com.sun.tools.javac.code.Symbol.MethodSymbol; 11.7 +import com.sun.tools.javac.code.Symbol.TypeSymbol; 11.8 import com.sun.tools.javac.code.Symbol.VarSymbol; 11.9 import com.sun.tools.javac.code.Symtab; 11.10 import com.sun.tools.javac.code.Type; 11.11 @@ -50,8 +51,10 @@ 11.12 11.13 import java.util.EnumMap; 11.14 import java.util.HashMap; 11.15 +import java.util.HashSet; 11.16 import java.util.LinkedHashMap; 11.17 import java.util.Map; 11.18 +import java.util.Set; 11.19 11.20 import static com.sun.tools.javac.comp.LambdaToMethod.LambdaSymbolKind.*; 11.21 import static com.sun.tools.javac.code.Flags.*; 11.22 @@ -438,13 +441,9 @@ 11.23 public void visitVarDef(JCVariableDecl tree) { 11.24 LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context; 11.25 if (context != null && lambdaContext.getSymbolMap(LOCAL_VAR).containsKey(tree.sym)) { 11.26 - JCExpression init = translate(tree.init); 11.27 - int prevPos = make.pos; 11.28 - try { 11.29 - result = make.at(tree).VarDef((VarSymbol)lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym), init); 11.30 - } finally { 11.31 - make.at(prevPos); 11.32 - } 11.33 + tree.init = translate(tree.init); 11.34 + tree.sym = (VarSymbol) lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym); 11.35 + result = tree; 11.36 } else if (context != null && lambdaContext.getSymbolMap(TYPE_VAR).containsKey(tree.sym)) { 11.37 JCExpression init = translate(tree.init); 11.38 VarSymbol xsym = (VarSymbol)lambdaContext.getSymbolMap(TYPE_VAR).get(tree.sym); 11.39 @@ -1286,7 +1285,10 @@ 11.40 11.41 @Override 11.42 public void visitNewClass(JCNewClass tree) { 11.43 - if (lambdaNewClassFilter(context(), tree)) { 11.44 + TypeSymbol def = tree.type.tsym; 11.45 + boolean inReferencedClass = currentlyInClass(def); 11.46 + boolean isLocal = def.isLocal(); 11.47 + if ((inReferencedClass && isLocal || lambdaNewClassFilter(context(), tree))) { 11.48 TranslationContext<?> localContext = context(); 11.49 while (localContext != null) { 11.50 if (localContext.tree.getTag() == LAMBDA) { 11.51 @@ -1296,16 +1298,16 @@ 11.52 localContext = localContext.prev; 11.53 } 11.54 } 11.55 - if (context() != null && tree.type.tsym.owner.kind == MTH) { 11.56 + if (context() != null && !inReferencedClass && isLocal) { 11.57 LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context(); 11.58 - captureLocalClassDefs(tree.type.tsym, lambdaContext); 11.59 + captureLocalClassDefs(def, lambdaContext); 11.60 } 11.61 super.visitNewClass(tree); 11.62 } 11.63 //where 11.64 void captureLocalClassDefs(Symbol csym, final LambdaTranslationContext lambdaContext) { 11.65 JCClassDecl localCDef = localClassDefs.get(csym); 11.66 - if (localCDef != null && localCDef.pos < lambdaContext.tree.pos) { 11.67 + if (localCDef != null && lambdaContext.freeVarProcessedLocalClasses.add(csym)) { 11.68 BasicFreeVarCollector fvc = lower.new BasicFreeVarCollector() { 11.69 @Override 11.70 void addFreeVars(ClassSymbol c) { 11.71 @@ -1331,6 +1333,18 @@ 11.72 fvc.scan(localCDef); 11.73 } 11.74 } 11.75 + //where 11.76 + boolean currentlyInClass(Symbol csym) { 11.77 + for (Frame frame : frameStack) { 11.78 + if (frame.tree.hasTag(JCTree.Tag.CLASSDEF)) { 11.79 + JCClassDecl cdef = (JCClassDecl) frame.tree; 11.80 + if (cdef.sym == csym) { 11.81 + return true; 11.82 + } 11.83 + } 11.84 + } 11.85 + return false; 11.86 + } 11.87 11.88 /** 11.89 * Method references to local class constructors, may, if the local 11.90 @@ -1756,6 +1770,11 @@ 11.91 11.92 List<JCVariableDecl> syntheticParams; 11.93 11.94 + /** 11.95 + * to prevent recursion, track local classes processed 11.96 + */ 11.97 + final Set<Symbol> freeVarProcessedLocalClasses; 11.98 + 11.99 LambdaTranslationContext(JCLambda tree) { 11.100 super(tree); 11.101 Frame frame = frameStack.head; 11.102 @@ -1785,6 +1804,8 @@ 11.103 translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<Symbol, Symbol>()); 11.104 translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<Symbol, Symbol>()); 11.105 translatedSymbols.put(TYPE_VAR, new LinkedHashMap<Symbol, Symbol>()); 11.106 + 11.107 + freeVarProcessedLocalClasses = new HashSet<>(); 11.108 } 11.109 11.110 /** 11.111 @@ -1895,7 +1916,7 @@ 11.112 }; 11.113 break; 11.114 case LOCAL_VAR: 11.115 - ret = new VarSymbol(sym.flags() & FINAL, name, types.erasure(sym.type), translatedSym); 11.116 + ret = new VarSymbol(sym.flags() & FINAL, name, sym.type, translatedSym); 11.117 ((VarSymbol) ret).pos = ((VarSymbol) sym).pos; 11.118 break; 11.119 case PARAM:
12.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue May 13 23:18:48 2014 -0700 12.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed May 14 11:01:08 2014 -0700 12.3 @@ -565,7 +565,7 @@ 12.4 tvars, 12.5 (MethodType)mt, 12.6 resultInfo, 12.7 - m, 12.8 + (MethodSymbol)m, 12.9 argtypes, 12.10 allowBoxing, 12.11 useVarargs, 12.12 @@ -773,6 +773,7 @@ 12.13 public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) { 12.14 return nilMethodCheck; 12.15 } 12.16 + 12.17 } 12.18 12.19 /** 12.20 @@ -784,6 +785,11 @@ 12.21 void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) { 12.22 //do nothing - actual always compatible to formals 12.23 } 12.24 + 12.25 + @Override 12.26 + public String toString() { 12.27 + return "arityMethodCheck"; 12.28 + } 12.29 }; 12.30 12.31 List<Type> dummyArgs(int length) { 12.32 @@ -869,6 +875,11 @@ 12.33 public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) { 12.34 return new MostSpecificCheck(strict, actuals); 12.35 } 12.36 + 12.37 + @Override 12.38 + public String toString() { 12.39 + return "resolveMethodCheck"; 12.40 + } 12.41 }; 12.42 12.43 /** 12.44 @@ -900,7 +911,9 @@ 12.45 @Override 12.46 public boolean compatible(Type found, Type req, Warner warn) { 12.47 found = pendingInferenceContext.asUndetVar(found); 12.48 - req = infer.returnConstraintTarget(found, req); 12.49 + if (found.hasTag(UNDETVAR) && req.isPrimitive()) { 12.50 + req = types.boxedClass(req).type; 12.51 + } 12.52 return super.compatible(found, req, warn); 12.53 } 12.54 12.55 @@ -955,6 +968,12 @@ 12.56 public DeferredAttrContext deferredAttrContext() { 12.57 return deferredAttrContext; 12.58 } 12.59 + 12.60 + @Override 12.61 + public String toString() { 12.62 + return "MethodReferenceCheck"; 12.63 + } 12.64 + 12.65 } 12.66 12.67 /** 12.68 @@ -973,7 +992,12 @@ 12.69 DeferredType dt = (DeferredType)found; 12.70 return dt.check(this); 12.71 } else { 12.72 - return super.check(pos, chk.checkNonVoid(pos, types.capture(U(found.baseType())))); 12.73 + Type uResult = U(found.baseType()); 12.74 + Type capturedType = pos == null || pos.getTree() == null ? 12.75 + types.capture(uResult) : 12.76 + checkContext.inferenceContext() 12.77 + .cachedCapture(pos.getTree(), uResult, true); 12.78 + return super.check(pos, chk.checkNonVoid(pos, capturedType)); 12.79 } 12.80 } 12.81 12.82 @@ -1408,7 +1432,7 @@ 12.83 return bestSoFar; 12.84 } else if (useVarargs && (sym.flags() & VARARGS) == 0) { 12.85 return bestSoFar.kind >= ERRONEOUS ? 12.86 - new BadVarargsMethod((ResolveError)bestSoFar) : 12.87 + new BadVarargsMethod((ResolveError)bestSoFar.baseSymbol()) : 12.88 bestSoFar; 12.89 } 12.90 Assert.check(sym.kind < AMBIGUOUS); 12.91 @@ -1500,14 +1524,22 @@ 12.92 if (m2SignatureMoreSpecific) return m2; 12.93 return ambiguityError(m1, m2); 12.94 case AMBIGUOUS: 12.95 - //check if m1 is more specific than all ambiguous methods in m2 12.96 + //compare m1 to ambiguous methods in m2 12.97 AmbiguityError e = (AmbiguityError)m2.baseSymbol(); 12.98 + boolean m1MoreSpecificThanAnyAmbiguous = true; 12.99 + boolean allAmbiguousMoreSpecificThanM1 = true; 12.100 for (Symbol s : e.ambiguousSyms) { 12.101 - if (mostSpecific(argtypes, m1, s, env, site, allowBoxing, useVarargs) != m1) { 12.102 - return e.addAmbiguousSymbol(m1); 12.103 - } 12.104 + Symbol moreSpecific = mostSpecific(argtypes, m1, s, env, site, allowBoxing, useVarargs); 12.105 + m1MoreSpecificThanAnyAmbiguous &= moreSpecific == m1; 12.106 + allAmbiguousMoreSpecificThanM1 &= moreSpecific == s; 12.107 } 12.108 - return m1; 12.109 + if (m1MoreSpecificThanAnyAmbiguous) 12.110 + return m1; 12.111 + //if m1 is more specific than some ambiguous methods, but other ambiguous methods are 12.112 + //more specific than m1, add it as a new ambiguous method: 12.113 + if (!allAmbiguousMoreSpecificThanM1) 12.114 + e.addAmbiguousSymbol(m1); 12.115 + return e; 12.116 default: 12.117 throw new AssertionError(); 12.118 } 12.119 @@ -1525,7 +1557,7 @@ 12.120 currentResolutionContext.methodCheck = 12.121 prevResolutionContext.methodCheck.mostSpecificCheck(actuals, !allowBoxing); 12.122 Type mst = instantiate(env, site, m2, null, 12.123 - adjustArgs(types.lowerBounds(types.memberType(site, m1).getParameterTypes()), m1, maxLength, useVarargs), null, 12.124 + adjustArgs(types.cvarLowerBounds(types.memberType(site, m1).getParameterTypes()), m1, maxLength, useVarargs), null, 12.125 allowBoxing, useVarargs, noteWarner); 12.126 return mst != null && 12.127 !noteWarner.hasLint(Lint.LintCategory.UNCHECKED); 12.128 @@ -2168,7 +2200,7 @@ 12.129 List<Type> typeargtypes, 12.130 LogResolveHelper logResolveHelper) { 12.131 if (sym.kind >= AMBIGUOUS) { 12.132 - ResolveError errSym = (ResolveError)sym; 12.133 + ResolveError errSym = (ResolveError)sym.baseSymbol(); 12.134 sym = errSym.access(name, qualified ? site.tsym : syms.noSymbol); 12.135 argtypes = logResolveHelper.getArgumentTypes(errSym, sym, name, argtypes); 12.136 if (logResolveHelper.resolveDiagnosticNeeded(site, argtypes, typeargtypes)) { 12.137 @@ -2557,7 +2589,7 @@ 12.138 sym = super.access(env, pos, location, sym); 12.139 } else { 12.140 final JCDiagnostic details = sym.kind == WRONG_MTH ? 12.141 - ((InapplicableSymbolError)sym).errCandidate().snd : 12.142 + ((InapplicableSymbolError)sym.baseSymbol()).errCandidate().snd : 12.143 null; 12.144 sym = new InapplicableSymbolError(sym.kind, "diamondError", currentResolutionContext) { 12.145 @Override 12.146 @@ -2965,12 +2997,12 @@ 12.147 return true; 12.148 case WRONG_MTH: 12.149 InapplicableSymbolError errSym = 12.150 - (InapplicableSymbolError)s; 12.151 + (InapplicableSymbolError)s.baseSymbol(); 12.152 return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) 12.153 .matches(errSym.errCandidate().snd); 12.154 case WRONG_MTHS: 12.155 InapplicableSymbolsError errSyms = 12.156 - (InapplicableSymbolsError)s; 12.157 + (InapplicableSymbolsError)s.baseSymbol(); 12.158 return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); 12.159 case WRONG_STATICNESS: 12.160 return false;
13.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue May 13 23:18:48 2014 -0700 13.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed May 14 11:01:08 2014 -0700 13.3 @@ -35,9 +35,6 @@ 13.4 import java.util.Queue; 13.5 import java.util.ResourceBundle; 13.6 import java.util.Set; 13.7 -import java.util.logging.Handler; 13.8 -import java.util.logging.Level; 13.9 -import java.util.logging.Logger; 13.10 13.11 import javax.annotation.processing.Processor; 13.12 import javax.lang.model.SourceVersion; 13.13 @@ -1304,11 +1301,16 @@ 13.14 * Perform dataflow checks on an attributed parse tree. 13.15 */ 13.16 protected void flow(Env<AttrContext> env, Queue<Env<AttrContext>> results) { 13.17 + if (compileStates.isDone(env, CompileState.FLOW)) { 13.18 + results.add(env); 13.19 + return; 13.20 + } 13.21 + 13.22 try { 13.23 if (shouldStop(CompileState.FLOW)) 13.24 return; 13.25 13.26 - if (relax || compileStates.isDone(env, CompileState.FLOW)) { 13.27 + if (relax) { 13.28 results.add(env); 13.29 return; 13.30 }
14.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue May 13 23:18:48 2014 -0700 14.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed May 14 11:01:08 2014 -0700 14.3 @@ -1617,6 +1617,10 @@ 14.4 compiler.warn.varargs.redundant.trustme.anno=\ 14.5 Redundant {0} annotation. {1} 14.6 14.7 +# 0: symbol 14.8 +compiler.warn.access.to.sensitive.member.from.serializable.element=\ 14.9 + access to sensitive member {0} from serializable element can be publicly accessible to untrusted code 14.10 + 14.11 ##### 14.12 14.13 ## The following are tokens which are non-terminals in the language. They should
15.1 --- a/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties Tue May 13 23:18:48 2014 -0700 15.2 +++ b/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties Wed May 14 11:01:08 2014 -0700 15.3 @@ -1,5 +1,5 @@ 15.4 # 15.5 -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 15.6 +# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 15.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 # 15.9 # This code is free software; you can redistribute it and/or modify it 15.10 @@ -30,14 +30,14 @@ 15.11 javac.opt.g.lines.vars.source=\u3044\u304F\u3064\u304B\u306E\u30C7\u30D0\u30C3\u30B0\u60C5\u5831\u306E\u307F\u3092\u751F\u6210\u3059\u308B 15.12 javac.opt.nowarn=\u8B66\u544A\u3092\u767A\u751F\u3055\u305B\u306A\u3044 15.13 javac.opt.verbose=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u52D5\u4F5C\u306B\u3064\u3044\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B 15.14 -javac.opt.deprecation=\u975E\u63A8\u5968\u306EAPI\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u308B\u30BD\u30FC\u30B9\u306E\u4F4D\u7F6E\u3092\u51FA\u529B\u3059\u308B 15.15 +javac.opt.deprecation=\u975E\u63A8\u5968\u306EAPI\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u308B\u30BD\u30FC\u30B9\u306E\u5834\u6240\u3092\u51FA\u529B\u3059\u308B 15.16 javac.opt.classpath=\u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304A\u3088\u3073\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B 15.17 javac.opt.sourcepath=\u5165\u529B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B 15.18 -javac.opt.bootclasspath=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 15.19 +javac.opt.bootclasspath=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 15.20 javac.opt.Xbootclasspath.p=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u4ED8\u52A0\u3059\u308B 15.21 javac.opt.Xbootclasspath.a=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u8FFD\u52A0\u3059\u308B 15.22 -javac.opt.endorseddirs=\u63A8\u5968\u898F\u683C\u30D1\u30B9\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 15.23 -javac.opt.extdirs=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u6E08\u307F\u62E1\u5F35\u6A5F\u80FD\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 15.24 +javac.opt.endorseddirs=\u63A8\u5968\u898F\u683C\u30D1\u30B9\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 15.25 +javac.opt.extdirs=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u6E08\u307F\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 15.26 javac.opt.processorpath=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B 15.27 javac.opt.processor=\u5B9F\u884C\u3059\u308B\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u306E\u540D\u524D\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u691C\u51FA\u51E6\u7406\u3092\u30D0\u30A4\u30D1\u30B9 15.28 javac.opt.parameters=\u30E1\u30BD\u30C3\u30C9\u30FB\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u30EA\u30D5\u30EC\u30AF\u30B7\u30E7\u30F3\u7528\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u751F\u6210\u3057\u307E\u3059 15.29 @@ -133,7 +133,7 @@ 15.30 15.31 javac.msg.usage.nonstandard.footer=\u3053\u308C\u3089\u306F\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3042\u308A\u4E88\u544A\u306A\u3057\u306B\u5909\u66F4\u3055\u308C\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\u3002 15.32 15.33 -javac.msg.bug=\u30B3\u30F3\u30D1\u30A4\u30E9\u3067\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002Bug Parade\u306B\u540C\u3058\u30D0\u30B0\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u306A\u3044\u3053\u3068\u3092\u3054\u78BA\u8A8D\u306E\u4E0A\u3001Java Developer Connection(http://java.sun.com/webapps/bugreport)\u3067\u30D0\u30B0\u306E\u767B\u9332\u3092\u304A\u9858\u3044\u3044\u305F\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306B\u306F\u3001\u305D\u306E\u30D7\u30ED\u30B0\u30E9\u30E0\u3068\u4E0B\u8A18\u306E\u8A3A\u65AD\u5185\u5BB9\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u3054\u5354\u529B\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\u3002 15.34 +javac.msg.bug=\u30B3\u30F3\u30D1\u30A4\u30E9\u3067\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002Bug Parade\u3067\u91CD\u8907\u304C\u306A\u3044\u304B\u3092\u3054\u78BA\u8A8D\u306E\u3046\u3048\u3001Java Developer Connection (http://java.sun.com/webapps/bugreport)\u3067bug\u306E\u767B\u9332\u3092\u304A\u9858\u3044\u3044\u305F\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306B\u306F\u3001\u305D\u306E\u30D7\u30ED\u30B0\u30E9\u30E0\u3068\u4E0B\u8A18\u306E\u8A3A\u65AD\u5185\u5BB9\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u3054\u5354\u529B\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\u3002 15.35 15.36 javac.msg.io=\n\n\u5165\u51FA\u529B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n 15.37
16.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Tue May 13 23:18:48 2014 -0700 16.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed May 14 11:01:08 2014 -0700 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 16.6 + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -831,6 +831,8 @@ 16.11 return symbol(((JCTypeApply) tree).clazz); 16.12 case ANNOTATED_TYPE: 16.13 return symbol(((JCAnnotatedType) tree).underlyingType); 16.14 + case REFERENCE: 16.15 + return ((JCMemberReference) tree).sym; 16.16 default: 16.17 return null; 16.18 }
17.1 --- a/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties Tue May 13 23:18:48 2014 -0700 17.2 +++ b/src/share/classes/com/sun/tools/javap/resources/javap_ja.properties Wed May 14 11:01:08 2014 -0700 17.3 @@ -3,10 +3,9 @@ 17.4 17.5 err.bad.constant.pool={0}\u306E\u5B9A\u6570\u30D7\u30FC\u30EB\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {1} 17.6 err.class.not.found=\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0} 17.7 -err.crash=\u91CD\u5927\u306A\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0}\n\u6B21\u306E\u60C5\u5831\u3092\u542B\u3080\u30D0\u30B0\u30FB\u30EC\u30DD\u30FC\u30C8\u3092\u30D5\u30A1\u30A4\u30EB\u3057\u3066\u304F\u3060\u3055\u3044:\n{1} 17.8 +err.crash=\u91CD\u5927\u306A\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0}\n\u6B21\u306E\u60C5\u5831\u3092\u542B\u3080bug\u30EC\u30DD\u30FC\u30C8\u3092\u30D5\u30A1\u30A4\u30EB\u3057\u3066\u304F\u3060\u3055\u3044:\n{1} 17.9 err.end.of.file={0}\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u4E88\u671F\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u7D42\u308F\u308A\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F 17.10 err.file.not.found=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0} 17.11 -err.h.not.supported=-h\u306F\u4F7F\u7528\u53EF\u80FD\u3067\u306A\u304F\u306A\u308A\u307E\u3057\u305F - 'javah'\u30D7\u30ED\u30B0\u30E9\u30E0\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044 17.12 err.incompatible.options=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u304C\u4E0D\u6B63\u3067\u3059: {0} 17.13 err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0} {1} {2} 17.14 err.invalid.arg.for.option=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0} 17.15 @@ -14,12 +13,11 @@ 17.16 err.missing.arg={0}\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093 17.17 err.no.classes.specified=\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093 17.18 err.not.standard.file.manager=\u6A19\u6E96\u30D5\u30A1\u30A4\u30EB\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u3092\u4F7F\u7528\u3057\u3066\u3044\u308B\u5834\u5408\u306F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059 17.19 +err.invalid.use.of.option=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u4F7F\u7528\u304C\u7121\u52B9\u3067\u3059: {0} 17.20 err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0} 17.21 -err.verify.not.supported=-verify\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093 17.22 err.no.SourceFile.attribute=SourceFile\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093 17.23 err.source.file.not.found=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 17.24 err.bad.innerclasses.attribute={0}\u306EInnerClasses\u5C5E\u6027\u304C\u4E0D\u6B63\u3067\u3059 17.25 -warn.Xold.not.supported=-Xold\u306F\u4F7F\u7528\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3057\u305F 17.26 17.27 main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-help\u3092\u4F7F\u7528\u3057\u307E\u3059 17.28 17.29 @@ -57,9 +55,9 @@ 17.30 17.31 main.opt.cp=\ -cp <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B 17.32 17.33 -main.opt.bootclasspath=\ -bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 17.34 +main.opt.bootclasspath=\ -bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B 17.35 17.36 -main.opt.constants=\ -constants \u9759\u7684final\u5B9A\u6570\u3092\u8868\u793A\u3059\u308B 17.37 +main.opt.constants=\ -constants final\u5B9A\u6570\u3092\u8868\u793A\u3059\u308B 17.38 17.39 17.40 main.opt.sysinfo=\ -sysinfo \u51E6\u7406\u3057\u3066\u3044\u308B\u30AF\u30E9\u30B9\u306E\u30B7\u30B9\u30C6\u30E0\u60C5\u5831(\u30D1\u30B9\u3001\u30B5\u30A4\u30BA\u3001\u65E5\u4ED8\u3001MD5\u30CF\u30C3\u30B7\u30E5)\n \u3092\u8868\u793A\u3059\u308B
18.1 --- a/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties Tue May 13 23:18:48 2014 -0700 18.2 +++ b/src/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties Wed May 14 11:01:08 2014 -0700 18.3 @@ -6,7 +6,6 @@ 18.4 err.crash=\u51FA\u73B0\u4E25\u91CD\u7684\u5185\u90E8\u9519\u8BEF: {0}\n\u8BF7\u5EFA\u7ACB Bug \u62A5\u544A, \u5E76\u5305\u62EC\u4EE5\u4E0B\u4FE1\u606F:\n{1} 18.5 err.end.of.file=\u8BFB\u53D6{0}\u65F6\u51FA\u73B0\u610F\u5916\u7684\u6587\u4EF6\u7ED3\u5C3E 18.6 err.file.not.found=\u627E\u4E0D\u5230\u6587\u4EF6: {0} 18.7 -err.h.not.supported=-h \u4E0D\u518D\u53EF\u7528 - \u8BF7\u4F7F\u7528 'javah' \u7A0B\u5E8F 18.8 err.incompatible.options=\u9009\u9879\u7EC4\u5408\u9519\u8BEF: {0} 18.9 err.internal.error=\u5185\u90E8\u9519\u8BEF: {0} {1} {2} 18.10 err.invalid.arg.for.option=\u9009\u9879\u7684\u53C2\u6570\u65E0\u6548: {0} 18.11 @@ -14,12 +13,11 @@ 18.12 err.missing.arg=\u6CA1\u6709\u4E3A{0}\u6307\u5B9A\u503C 18.13 err.no.classes.specified=\u672A\u6307\u5B9A\u7C7B 18.14 err.not.standard.file.manager=\u4F7F\u7528\u6807\u51C6\u6587\u4EF6\u7BA1\u7406\u5668\u65F6\u53EA\u80FD\u6307\u5B9A\u7C7B\u6587\u4EF6 18.15 +err.invalid.use.of.option=\u9009\u9879\u7684\u4F7F\u7528\u65E0\u6548: {0} 18.16 err.unknown.option=\u672A\u77E5\u9009\u9879: {0} 18.17 -err.verify.not.supported=\u4E0D\u652F\u6301 -verify 18.18 err.no.SourceFile.attribute=\u6CA1\u6709 SourceFile \u5C5E\u6027 18.19 err.source.file.not.found=\u627E\u4E0D\u5230\u6E90\u6587\u4EF6 18.20 err.bad.innerclasses.attribute={0}\u7684 InnerClasses \u5C5E\u6027\u9519\u8BEF 18.21 -warn.Xold.not.supported=-Xold \u4E0D\u518D\u53EF\u7528 18.22 18.23 main.usage.summary=\u7528\u6CD5: {0} <options> <classes>\n\u4F7F\u7528 -help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879 18.24 18.25 @@ -59,7 +57,7 @@ 18.26 18.27 main.opt.bootclasspath=\ -bootclasspath <path> \u8986\u76D6\u5F15\u5BFC\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E 18.28 18.29 -main.opt.constants=\ -constants \u663E\u793A\u9759\u6001\u6700\u7EC8\u5E38\u91CF 18.30 +main.opt.constants=\ -constants \u663E\u793A\u6700\u7EC8\u5E38\u91CF 18.31 18.32 18.33 main.opt.sysinfo=\ -sysinfo \u663E\u793A\u6B63\u5728\u5904\u7406\u7684\u7C7B\u7684\n \u7CFB\u7EDF\u4FE1\u606F (\u8DEF\u5F84, \u5927\u5C0F, \u65E5\u671F, MD5 \u6563\u5217)
19.1 --- a/test/Makefile Tue May 13 23:18:48 2014 -0700 19.2 +++ b/test/Makefile Wed May 14 11:01:08 2014 -0700 19.3 @@ -186,6 +186,12 @@ 19.4 JTREG_OPTIONS += -timeoutFactor:$(JTREG_TIMEOUT_FACTOR) 19.5 endif 19.6 19.7 +# Default verbosity setting for jtreg 19.8 +JTREG_VERBOSE = fail,error,nopass 19.9 + 19.10 +# Default verbosity setting for jck 19.11 +JCK_VERBOSE = non-pass 19.12 + 19.13 # Assertions: some tests show failures when assertions are enabled. 19.14 # Since javac is typically loaded via the bootclassloader (either via TESTJAVA 19.15 # or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac. 19.16 @@ -256,6 +262,8 @@ 19.17 # Version of java used to run jtreg. Should normally be the same as TESTJAVA 19.18 # TESTJAVA 19.19 # Version of java to be tested. 19.20 +# JTREG_VERBOSE 19.21 +# Verbosity setting for jtreg 19.22 # JTREG_OPTIONS 19.23 # Additional options for jtreg 19.24 # JTREG_TESTDIRS 19.25 @@ -273,7 +281,7 @@ 19.26 JT_JAVA=$(JT_JAVA) $(JTREG) \ 19.27 -J-Xmx512m \ 19.28 -vmoption:-Xmx768m \ 19.29 - -a -ignore:quiet -v:fail,error,nopass \ 19.30 + -a -ignore:quiet $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE)) \ 19.31 -r:$(JTREG_OUTPUT_DIR)/JTreport \ 19.32 -w:$(JTREG_OUTPUT_DIR)/JTwork \ 19.33 -jdk:$(TESTJAVA) \ 19.34 @@ -312,6 +320,8 @@ 19.35 # Default is JDK 7 19.36 # TESTJAVA 19.37 # Version of java to be tested. 19.38 +# JCK_VERBOSE 19.39 +# Verbosity setting for jtjck 19.40 # JCK_COMPILER_OPTIONS 19.41 # Additional options for JCK-compiler 19.42 # JCK_COMPILER_TESTDIRS 19.43 @@ -325,9 +335,9 @@ 19.44 @rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \ 19.45 $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt 19.46 @mkdir -p $(JCK_COMPILER_OUTPUT_DIR) 19.47 - $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ 19.48 + $(JT_JAVA)/bin/java -Xmx512m \ 19.49 -jar $(JCK_HOME)/JCK-compiler-8/lib/jtjck.jar \ 19.50 - -v:non-pass \ 19.51 + $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \ 19.52 -r:$(JCK_COMPILER_OUTPUT_DIR)/report \ 19.53 -w:$(JCK_COMPILER_OUTPUT_DIR)/work \ 19.54 -jdk:$(TESTJAVA) \ 19.55 @@ -361,6 +371,8 @@ 19.56 # Version of java used to run JCK. Should normally be the same as TESTJAVA 19.57 # TESTJAVA 19.58 # Version of java to be tested. 19.59 +# JCK_VERBOSE 19.60 +# Verbosity setting for jtjck 19.61 # JCK_RUNTIME_OPTIONS 19.62 # Additional options for JCK-runtime 19.63 # JCK_RUNTIME_TESTDIRS 19.64 @@ -374,9 +386,9 @@ 19.65 @rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \ 19.66 $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt 19.67 @mkdir -p $(JCK_RUNTIME_OUTPUT_DIR) 19.68 - $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \ 19.69 + $(JT_JAVA)/bin/java -Xmx512m \ 19.70 -jar $(JCK_HOME)/JCK-runtime-8/lib/jtjck.jar \ 19.71 - -v:non-pass \ 19.72 + $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \ 19.73 -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \ 19.74 -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \ 19.75 -jdk:$(TESTJAVA) \
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/T8029102/WarnSerializableLambdaTest.java Wed May 14 11:01:08 2014 -0700 20.3 @@ -0,0 +1,241 @@ 20.4 +/* 20.5 + * @test /nodynamiccopyright/ 20.6 + * @bug 8029102 20.7 + * @summary Enhance compiler warnings for Lambda 20.8 + * Checks that the warning for accessing non public members of a class is 20.9 + * fired correctly. 20.10 + * @compile/fail/ref=WarnSerializableLambdaTest.out -XDrawDiagnostics -Werror -XDwarnOnAccessToSensitiveMembers WarnSerializableLambdaTest.java 20.11 + */ 20.12 + 20.13 +import java.io.Serializable; 20.14 + 20.15 +public class WarnSerializableLambdaTest { 20.16 + 20.17 + void warnLambda() throws Exception { 20.18 + SAM t3 = (SAM & Serializable)WarnSerializableLambdaTest::packageClassMethod; 20.19 + SAM t4 = (SAM & Serializable)WarnSerializableLambdaTest::protectedClassMethod; 20.20 + SAM t5 = (SAM & Serializable)WarnSerializableLambdaTest::privateClassMethod; 20.21 + 20.22 + WarnSerializableLambdaTest test = new WarnSerializableLambdaTest(); 20.23 + SAM t6 = (SAM & Serializable)test::packageInstanceMethod; 20.24 + SAM t7 = (SAM & Serializable)test::protectedInstanceMethod; 20.25 + SAM t8 = (SAM & Serializable)test::privateInstanceMethod; 20.26 + 20.27 + SAM t9 = (SAM & Serializable) c -> { 20.28 + 20.29 + WarnSerializableLambdaTest.staticPackageField = ""; 20.30 + WarnSerializableLambdaTest.staticProtectedField = ""; 20.31 + WarnSerializableLambdaTest.staticPrivateField = ""; 20.32 + 20.33 + packageField = ""; 20.34 + protectedField = ""; 20.35 + privateField = ""; 20.36 + 20.37 + WarnSerializableLambdaTest.packageClassMethod(null); 20.38 + WarnSerializableLambdaTest.protectedClassMethod(null); 20.39 + WarnSerializableLambdaTest.privateClassMethod(null); 20.40 + 20.41 + packageInstanceMethod(null); 20.42 + protectedInstanceMethod(null); 20.43 + privateInstanceMethod(null); 20.44 + 20.45 + PrivateClass.effectivelyNonPublicStaticField = ""; 20.46 + PrivateClass.effectivelyNonPublicClassMethod(); 20.47 + 20.48 + PrivateClass p = new PrivateClass(); 20.49 + p.effectivelyNonPublicInstanceField = ""; 20.50 + p.effectivelyNonPublicInstanceMethod(); 20.51 + 20.52 + return null; 20.53 + }; 20.54 + } 20.55 + 20.56 + private void warnAnoInnerClass() throws Exception { 20.57 + new SerializableDesc() { 20.58 + public void m(Object param) throws Exception { 20.59 + WarnSerializableLambdaTest.staticPackageField = ""; 20.60 + WarnSerializableLambdaTest.staticProtectedField = ""; 20.61 + WarnSerializableLambdaTest.staticPrivateField = ""; 20.62 + 20.63 + packageField = ""; 20.64 + protectedField = ""; 20.65 + privateField = ""; 20.66 + 20.67 + WarnSerializableLambdaTest.packageClassMethod(null); 20.68 + WarnSerializableLambdaTest.protectedClassMethod(null); 20.69 + WarnSerializableLambdaTest.privateClassMethod(null); 20.70 + 20.71 + packageInstanceMethod(null); 20.72 + protectedInstanceMethod(null); 20.73 + privateInstanceMethod(null); 20.74 + 20.75 + PrivateClass.effectivelyNonPublicStaticField = ""; 20.76 + PrivateClass.effectivelyNonPublicClassMethod(); 20.77 + 20.78 + PrivateClass p = new PrivateClass(); 20.79 + p.effectivelyNonPublicInstanceField = ""; 20.80 + p.effectivelyNonPublicInstanceMethod(); 20.81 + } 20.82 + }; 20.83 + } 20.84 + 20.85 + void dontWarnLambda() throws Exception { 20.86 + SAM t1 = (SAM & Serializable)WarnSerializableLambdaTest::publicClassMethod; 20.87 + 20.88 + WarnSerializableLambdaTest test = new WarnSerializableLambdaTest(); 20.89 + SAM t2 = (SAM & Serializable)test::publicInstanceMethod; 20.90 + 20.91 + int[] buffer = {0}; 20.92 + 20.93 + SAM t3 = (SAM & Serializable) param -> { 20.94 + Object localVar; 20.95 + localVar = null; 20.96 + param = null; 20.97 + 20.98 + WarnSerializableLambdaTest.staticPublicField = ""; 20.99 + publicField = ""; 20.100 + WarnSerializableLambdaTest.publicClassMethod(null); 20.101 + publicInstanceMethod(null); 20.102 + 20.103 + PublicClass.effectivelyPublicStaticField = ""; 20.104 + PublicClass.effectivelyPublicClassMethod(); 20.105 + 20.106 + PublicClass p = new PublicClass(); 20.107 + p.effectivelyPublicInstanceField = ""; 20.108 + p.effectivelyPublicInstanceMethod(); 20.109 + 20.110 + int l = buffer.length; 20.111 + 20.112 + return null; 20.113 + }; 20.114 + } 20.115 + 20.116 + private void dontWarnAnoInnerClass() throws Exception { 20.117 + final int[] buffer = {0}; 20.118 + new SerializableDesc() { 20.119 + public void m(Object param) throws Exception { 20.120 + Object localVar; 20.121 + localVar = null; 20.122 + param = null; 20.123 + 20.124 + WarnSerializableLambdaTest.staticPublicField = ""; 20.125 + publicField = ""; 20.126 + WarnSerializableLambdaTest.publicClassMethod(null); 20.127 + publicInstanceMethod(null); 20.128 + 20.129 + PublicClass.effectivelyPublicStaticField = ""; 20.130 + PublicClass.effectivelyPublicClassMethod(); 20.131 + 20.132 + PublicClass p = new PublicClass(); 20.133 + p.effectivelyPublicInstanceField = ""; 20.134 + p.effectivelyPublicInstanceMethod(); 20.135 + 20.136 + int l = buffer.length; 20.137 + } 20.138 + }; 20.139 + } 20.140 + 20.141 + enum WarnEnum { 20.142 + A { 20.143 + public void m() throws Exception { 20.144 + WarnSerializableLambdaTest.staticPackageField = ""; 20.145 + WarnSerializableLambdaTest.staticProtectedField = ""; 20.146 + WarnSerializableLambdaTest.staticPrivateField = ""; 20.147 + 20.148 + WarnSerializableLambdaTest test = 20.149 + new WarnSerializableLambdaTest(); 20.150 + 20.151 + test.packageField = ""; 20.152 + test.protectedField = ""; 20.153 + test.privateField = ""; 20.154 + 20.155 + WarnSerializableLambdaTest.packageClassMethod(null); 20.156 + WarnSerializableLambdaTest.protectedClassMethod(null); 20.157 + WarnSerializableLambdaTest.privateClassMethod(null); 20.158 + 20.159 + test.packageInstanceMethod(null); 20.160 + test.protectedInstanceMethod(null); 20.161 + test.privateInstanceMethod(null); 20.162 + 20.163 + PrivateClass.effectivelyNonPublicStaticField = ""; 20.164 + PrivateClass.effectivelyNonPublicClassMethod(); 20.165 + 20.166 + PrivateClass p = new PrivateClass(); 20.167 + p.effectivelyNonPublicInstanceField = ""; 20.168 + p.effectivelyNonPublicInstanceMethod(); 20.169 + } 20.170 + }; 20.171 + 20.172 + public void m() throws Exception {} 20.173 + } 20.174 + 20.175 + static String staticPackageField; 20.176 + static private String staticPrivateField; 20.177 + static protected String staticProtectedField; 20.178 + static public String staticPublicField; 20.179 + 20.180 + String packageField; 20.181 + private String privateField; 20.182 + protected String protectedField; 20.183 + public String publicField; 20.184 + 20.185 + static Object packageClassMethod(String s) { 20.186 + return null; 20.187 + } 20.188 + 20.189 + static private Object privateClassMethod(String s) { 20.190 + return null; 20.191 + } 20.192 + 20.193 + static protected Object protectedClassMethod(String s) { 20.194 + return null; 20.195 + } 20.196 + 20.197 + static public Object publicClassMethod(String s) { 20.198 + return null; 20.199 + } 20.200 + 20.201 + Object packageInstanceMethod(String s) { 20.202 + return null; 20.203 + } 20.204 + 20.205 + protected Object protectedInstanceMethod(String s) { 20.206 + return null; 20.207 + } 20.208 + 20.209 + private Object privateInstanceMethod(String s) { 20.210 + return null; 20.211 + } 20.212 + 20.213 + public Object publicInstanceMethod(String s) { 20.214 + return null; 20.215 + } 20.216 + 20.217 + interface SAM { 20.218 + Object apply(String s) throws Exception; 20.219 + } 20.220 + 20.221 + interface SAM2 { 20.222 + Object apply(String arg1, String arg2); 20.223 + } 20.224 + 20.225 + class SerializableDesc implements Serializable { 20.226 + public void m(Object param) throws Exception {} 20.227 + } 20.228 + 20.229 + static private class PrivateClass { 20.230 + static public String effectivelyNonPublicStaticField; 20.231 + public String effectivelyNonPublicInstanceField; 20.232 + 20.233 + static public void effectivelyNonPublicClassMethod() {} 20.234 + public void effectivelyNonPublicInstanceMethod() {} 20.235 + } 20.236 + 20.237 + static public class PublicClass { 20.238 + static public String effectivelyPublicStaticField; 20.239 + public String effectivelyPublicInstanceField; 20.240 + 20.241 + static public void effectivelyPublicClassMethod() {} 20.242 + public void effectivelyPublicInstanceMethod() {} 20.243 + } 20.244 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/T8029102/WarnSerializableLambdaTest.out Wed May 14 11:01:08 2014 -0700 21.3 @@ -0,0 +1,57 @@ 21.4 +WarnSerializableLambdaTest.java:15:38: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String) 21.5 +WarnSerializableLambdaTest.java:16:38: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String) 21.6 +WarnSerializableLambdaTest.java:17:38: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String) 21.7 +WarnSerializableLambdaTest.java:20:38: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String) 21.8 +WarnSerializableLambdaTest.java:21:38: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String) 21.9 +WarnSerializableLambdaTest.java:22:38: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String) 21.10 +WarnSerializableLambdaTest.java:26:39: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPackageField 21.11 +WarnSerializableLambdaTest.java:27:39: compiler.warn.access.to.sensitive.member.from.serializable.element: staticProtectedField 21.12 +WarnSerializableLambdaTest.java:28:39: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPrivateField 21.13 +WarnSerializableLambdaTest.java:30:13: compiler.warn.access.to.sensitive.member.from.serializable.element: packageField 21.14 +WarnSerializableLambdaTest.java:31:13: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedField 21.15 +WarnSerializableLambdaTest.java:32:13: compiler.warn.access.to.sensitive.member.from.serializable.element: privateField 21.16 +WarnSerializableLambdaTest.java:34:39: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String) 21.17 +WarnSerializableLambdaTest.java:35:39: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String) 21.18 +WarnSerializableLambdaTest.java:36:39: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String) 21.19 +WarnSerializableLambdaTest.java:38:13: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String) 21.20 +WarnSerializableLambdaTest.java:39:13: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String) 21.21 +WarnSerializableLambdaTest.java:40:13: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String) 21.22 +WarnSerializableLambdaTest.java:42:25: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicStaticField 21.23 +WarnSerializableLambdaTest.java:43:25: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicClassMethod() 21.24 +WarnSerializableLambdaTest.java:46:14: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceField 21.25 +WarnSerializableLambdaTest.java:47:14: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceMethod() 21.26 +WarnSerializableLambdaTest.java:56:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPackageField 21.27 +WarnSerializableLambdaTest.java:57:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticProtectedField 21.28 +WarnSerializableLambdaTest.java:58:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPrivateField 21.29 +WarnSerializableLambdaTest.java:60:17: compiler.warn.access.to.sensitive.member.from.serializable.element: packageField 21.30 +WarnSerializableLambdaTest.java:61:17: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedField 21.31 +WarnSerializableLambdaTest.java:62:17: compiler.warn.access.to.sensitive.member.from.serializable.element: privateField 21.32 +WarnSerializableLambdaTest.java:64:43: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String) 21.33 +WarnSerializableLambdaTest.java:65:43: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String) 21.34 +WarnSerializableLambdaTest.java:66:43: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String) 21.35 +WarnSerializableLambdaTest.java:68:17: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String) 21.36 +WarnSerializableLambdaTest.java:69:17: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String) 21.37 +WarnSerializableLambdaTest.java:70:17: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String) 21.38 +WarnSerializableLambdaTest.java:72:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicStaticField 21.39 +WarnSerializableLambdaTest.java:73:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicClassMethod() 21.40 +WarnSerializableLambdaTest.java:76:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceField 21.41 +WarnSerializableLambdaTest.java:77:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceMethod() 21.42 +WarnSerializableLambdaTest.java:141:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPackageField 21.43 +WarnSerializableLambdaTest.java:142:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticProtectedField 21.44 +WarnSerializableLambdaTest.java:143:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPrivateField 21.45 +WarnSerializableLambdaTest.java:148:21: compiler.warn.access.to.sensitive.member.from.serializable.element: packageField 21.46 +WarnSerializableLambdaTest.java:149:21: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedField 21.47 +WarnSerializableLambdaTest.java:150:21: compiler.warn.access.to.sensitive.member.from.serializable.element: privateField 21.48 +WarnSerializableLambdaTest.java:152:43: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String) 21.49 +WarnSerializableLambdaTest.java:153:43: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String) 21.50 +WarnSerializableLambdaTest.java:154:43: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String) 21.51 +WarnSerializableLambdaTest.java:156:21: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String) 21.52 +WarnSerializableLambdaTest.java:157:21: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String) 21.53 +WarnSerializableLambdaTest.java:158:21: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String) 21.54 +WarnSerializableLambdaTest.java:160:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicStaticField 21.55 +WarnSerializableLambdaTest.java:161:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicClassMethod() 21.56 +WarnSerializableLambdaTest.java:164:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceField 21.57 +WarnSerializableLambdaTest.java:165:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceMethod() 21.58 +- compiler.err.warnings.and.werror 21.59 +1 error 21.60 +54 warnings
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/test/tools/javac/T8029102/WarnSerializableLambdaTestb.java Wed May 14 11:01:08 2014 -0700 22.3 @@ -0,0 +1,56 @@ 22.4 +/* 22.5 + * @test /nodynamiccopyright/ 22.6 + * @bug 8029102 22.7 + * @summary Enhance compiler warnings for Lambda 22.8 + * Checks that the warning for accessing non public members of a class is 22.9 + * fired correctly. 22.10 + * @compile/fail/ref=WarnSerializableLambdaTestb.out -XDrawDiagnostics -Werror -XDwarnOnAccessToSensitiveMembers WarnSerializableLambdaTestb.java 22.11 + */ 22.12 + 22.13 +import java.io.Serializable; 22.14 + 22.15 +public class WarnSerializableLambdaTestb { 22.16 + public void foo(Secret1 secret) { 22.17 + Object o = (Runnable & java.io.Serializable) () -> { secret.test(); }; 22.18 + } 22.19 + 22.20 + public void bar(Secret2 secret) { 22.21 + Object o = (Runnable & java.io.Serializable) () -> { secret.test(); }; 22.22 + } 22.23 + 22.24 + private class Secret1 { 22.25 + public void test() {} 22.26 + } 22.27 + 22.28 + static private class Secret2 { 22.29 + public void test() {} 22.30 + } 22.31 + 22.32 + class TestInner { 22.33 + private int j = 0; 22.34 + void m() { 22.35 + Serializable s = new Serializable() { 22.36 + int i; 22.37 + void m() { 22.38 + i = 0; // don't warn 22.39 + System.out.println(j); //warn 22.40 + } 22.41 + }; 22.42 + } 22.43 + } 22.44 + 22.45 + class TestInner2 { 22.46 + class W implements Serializable { 22.47 + public int p = 0; 22.48 + class I { 22.49 + public int r = 0; 22.50 + class K implements Serializable { 22.51 + void m() { 22.52 + p = 1; // don't warn owner is serializable 22.53 + r = 2; // warn owner is not serializable 22.54 + } 22.55 + } 22.56 + } 22.57 + } 22.58 + } 22.59 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/tools/javac/T8029102/WarnSerializableLambdaTestb.out Wed May 14 11:01:08 2014 -0700 23.3 @@ -0,0 +1,7 @@ 23.4 +WarnSerializableLambdaTestb.java:14:69: compiler.warn.access.to.sensitive.member.from.serializable.element: test() 23.5 +WarnSerializableLambdaTestb.java:18:69: compiler.warn.access.to.sensitive.member.from.serializable.element: test() 23.6 +WarnSerializableLambdaTestb.java:36:40: compiler.warn.access.to.sensitive.member.from.serializable.element: j 23.7 +WarnSerializableLambdaTestb.java:50:25: compiler.warn.access.to.sensitive.member.from.serializable.element: r 23.8 +- compiler.err.warnings.and.werror 23.9 +1 error 23.10 +4 warnings
24.1 --- a/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.java Tue May 13 23:18:48 2014 -0700 24.2 +++ b/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.java Wed May 14 11:01:08 2014 -0700 24.3 @@ -1,30 +1,8 @@ 24.4 /* 24.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 24.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 - * 24.8 - * This code is free software; you can redistribute it and/or modify it 24.9 - * under the terms of the GNU General Public License version 2 only, as 24.10 - * published by the Free Software Foundation. 24.11 - * 24.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 24.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.15 - * version 2 for more details (a copy is included in the LICENSE file that 24.16 - * accompanied this code). 24.17 - * 24.18 - * You should have received a copy of the GNU General Public License version 24.19 - * 2 along with this work; if not, write to the Free Software Foundation, 24.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.21 - * 24.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24.23 - * or visit www.oracle.com if you need additional information or have any 24.24 - * questions. 24.25 - */ 24.26 - 24.27 -/* 24.28 - * @test 24.29 - * @bug 8029569 24.30 + * @test /nodynamiccopyright/ 24.31 + * @bug 8029569 8037379 24.32 * @summary internal javac cast exception when resolving varargs ambiguity 24.33 + * fix for JDK-8029569 doesn't cover all possible cases 24.34 * @compile/fail/ref=VarargsAmbiguityCrashTest.out -XDrawDiagnostics VarargsAmbiguityCrashTest.java 24.35 */ 24.36
25.1 --- a/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.out Tue May 13 23:18:48 2014 -0700 25.2 +++ b/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.out Wed May 14 11:01:08 2014 -0700 25.3 @@ -1,2 +1,2 @@ 25.4 -VarargsAmbiguityCrashTest.java:33:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Exception...), VarargsAmbiguityCrashTest, kindname.method, m2(java.lang.Long,java.lang.Exception...), VarargsAmbiguityCrashTest 25.5 +VarargsAmbiguityCrashTest.java:11:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Exception...), VarargsAmbiguityCrashTest, kindname.method, m2(java.lang.Long,java.lang.Exception...), VarargsAmbiguityCrashTest 25.6 1 error
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/tools/javac/api/taskListeners/EventsBalancedTest.java Wed May 14 11:01:08 2014 -0700 26.3 @@ -0,0 +1,127 @@ 26.4 +/* 26.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. 26.11 + * 26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 + * version 2 for more details (a copy is included in the LICENSE file that 26.16 + * accompanied this code). 26.17 + * 26.18 + * You should have received a copy of the GNU General Public License version 26.19 + * 2 along with this work; if not, write to the Free Software Foundation, 26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 + * 26.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.23 + * or visit www.oracle.com if you need additional information or have any 26.24 + * questions. 26.25 + */ 26.26 + 26.27 +/* 26.28 + * @test 26.29 + * @bug 8040822 26.30 + * @summary Check that all TaskEvents are balanced. 26.31 + */ 26.32 + 26.33 +import java.io.*; 26.34 +import java.net.URI; 26.35 +import java.util.*; 26.36 +import java.util.Map.Entry; 26.37 + 26.38 +import javax.tools.*; 26.39 + 26.40 +import com.sun.source.util.*; 26.41 +import com.sun.source.util.TaskEvent.Kind; 26.42 +import com.sun.tools.javac.api.JavacTool; 26.43 +import com.sun.tools.javac.comp.CompileStates.CompileState; 26.44 + 26.45 +public class EventsBalancedTest { 26.46 + JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler(); 26.47 + StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null); 26.48 + 26.49 + public static void main(String... args) throws IOException { 26.50 + new EventsBalancedTest().test(); 26.51 + } 26.52 + 26.53 + void test() throws IOException { 26.54 + TestSource a = new TestSource("B", "class B extends A { }"); 26.55 + TestSource b = new TestSource("A", "abstract class A { }"); 26.56 + 26.57 + test(null, Arrays.asList(a, b)); 26.58 + test(null, Arrays.asList(b, a)); 26.59 + test(Arrays.asList("-XD-relax"), Arrays.asList(a, b)); 26.60 + test(Arrays.asList("-XD-relax"), Arrays.asList(b, a)); 26.61 + 26.62 + for (CompileState stop : CompileState.values()) { 26.63 + test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop, 26.64 + "-XDshouldStopPolicyIfError=" + stop), 26.65 + Arrays.asList(a, b)); 26.66 + test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop, 26.67 + "-XDshouldStopPolicyIfError=" + stop), 26.68 + Arrays.asList(b, a)); 26.69 + } 26.70 + } 26.71 + 26.72 + void test(Iterable<String> options, Iterable<JavaFileObject> files) throws IOException { 26.73 + StringWriter sw = new StringWriter(); 26.74 + PrintWriter pw = new PrintWriter(sw); 26.75 + TestListener listener = new TestListener(); 26.76 + JavacTask task = tool.getTask(pw, fm, null, options, null, files); 26.77 + 26.78 + task.setTaskListener(listener); 26.79 + 26.80 + task.call(); 26.81 + 26.82 + for (Entry<Kind, Integer> e : listener.kind2Count.entrySet()) { 26.83 + if (e.getValue() != null && e.getValue() != 0) { 26.84 + throw new IllegalStateException("Not balanced event: " + e.getKey()); 26.85 + } 26.86 + } 26.87 + } 26.88 + 26.89 + static class TestListener implements TaskListener { 26.90 + final Map<Kind, Integer> kind2Count = new HashMap<>(); 26.91 + 26.92 + int get(Kind k) { 26.93 + Integer count = kind2Count.get(k); 26.94 + 26.95 + if (count == null) 26.96 + kind2Count.put(k, count = 0); 26.97 + 26.98 + return count; 26.99 + } 26.100 + 26.101 + @Override 26.102 + public void started(TaskEvent e) { 26.103 + kind2Count.put(e.getKind(), get(e.getKind()) + 1); 26.104 + } 26.105 + 26.106 + @Override 26.107 + public void finished(TaskEvent e) { 26.108 + int count = get(e.getKind()); 26.109 + 26.110 + if (count <= 0) 26.111 + throw new IllegalStateException("count<=0 for: " + e.getKind()); 26.112 + 26.113 + kind2Count.put(e.getKind(), count - 1); 26.114 + } 26.115 + 26.116 + } 26.117 + static class TestSource extends SimpleJavaFileObject { 26.118 + final String content; 26.119 + public TestSource(String fileName, String content) { 26.120 + super(URI.create("myfo:/" + fileName + ".java"), JavaFileObject.Kind.SOURCE); 26.121 + this.content = content; 26.122 + } 26.123 + 26.124 + @Override 26.125 + public CharSequence getCharContent(boolean ignoreEncodingErrors) { 26.126 + return content; 26.127 + } 26.128 + } 26.129 + 26.130 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/tools/javac/diags/examples/WarnSerializableLambda.java Wed May 14 11:01:08 2014 -0700 27.3 @@ -0,0 +1,41 @@ 27.4 +/* 27.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.7 + * 27.8 + * This code is free software; you can redistribute it and/or modify it 27.9 + * under the terms of the GNU General Public License version 2 only, as 27.10 + * published by the Free Software Foundation. 27.11 + * 27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.15 + * version 2 for more details (a copy is included in the LICENSE file that 27.16 + * accompanied this code). 27.17 + * 27.18 + * You should have received a copy of the GNU General Public License version 27.19 + * 2 along with this work; if not, write to the Free Software Foundation, 27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.21 + * 27.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 27.23 + * or visit www.oracle.com if you need additional information or have any 27.24 + * questions. 27.25 + */ 27.26 + 27.27 +// key: compiler.warn.access.to.sensitive.member.from.serializable.element 27.28 +// options: -XDwarnOnAccessToSensitiveMembers 27.29 + 27.30 +import java.io.Serializable; 27.31 + 27.32 +public class WarnSerializableLambda { 27.33 + interface SAM { 27.34 + void apply(String s); 27.35 + } 27.36 + 27.37 + private void m1() { 27.38 + SAM s = (SAM & Serializable) c -> { 27.39 + packageField = ""; 27.40 + }; 27.41 + } 27.42 + 27.43 + String packageField; 27.44 +}
28.1 --- a/test/tools/javac/generics/inference/7086586/T7086586.out Tue May 13 23:18:48 2014 -0700 28.2 +++ b/test/tools/javac/generics/inference/7086586/T7086586.out Wed May 14 11:01:08 2014 -0700 28.3 @@ -1,5 +1,5 @@ 28.4 -T7086586.java:14:20: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)) 28.5 -T7086586.java:15:20: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)) 28.6 -T7086586.java:16:23: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)) 28.7 -T7086586.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<? super T>, java.util.List<compiler.misc.type.captureof: 1, ?>, kindname.class, T7086586, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super T>)) 28.8 +T7086586.java:14:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, java.lang.String) 28.9 +T7086586.java:15:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, java.lang.Number) 28.10 +T7086586.java:16:31: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.type.captureof: 1, ?, java.lang.Exception) 28.11 +T7086586.java:17:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location: kindname.interface, java.util.List<compiler.misc.type.captureof: 1, ?>, null) 28.12 4 errors
29.1 --- a/test/tools/javac/generics/inference/7086586/T7086586b.java Tue May 13 23:18:48 2014 -0700 29.2 +++ b/test/tools/javac/generics/inference/7086586/T7086586b.java Wed May 14 11:01:08 2014 -0700 29.3 @@ -23,9 +23,10 @@ 29.4 29.5 /* 29.6 * @test 29.7 - * @bug 7086586 29.8 + * @bug 7086586 8033718 29.9 * 29.10 - * @summary Inference producing null type argument 29.11 + * @summary Inference producing null type argument; inference ignores capture 29.12 + * variable as upper bound 29.13 */ 29.14 import java.util.List; 29.15 29.16 @@ -40,8 +41,8 @@ 29.17 assertionCount++; 29.18 } 29.19 29.20 - <T> void m(List<? super T> dummy) { assertTrue(false); } 29.21 - <T> void m(Object dummy) { assertTrue(true); } 29.22 + <T> void m(List<? super T> dummy) { assertTrue(true); } 29.23 + <T> void m(Object dummy) { assertTrue(false); } 29.24 29.25 void test(List<?> l) { 29.26 m(l);
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/test/tools/javac/generics/inference/LowerBoundGLB.java Wed May 14 11:01:08 2014 -0700 30.3 @@ -0,0 +1,47 @@ 30.4 +/* 30.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.7 + * 30.8 + * This code is free software; you can redistribute it and/or modify it 30.9 + * under the terms of the GNU General Public License version 2 only, as 30.10 + * published by the Free Software Foundation. 30.11 + * 30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.15 + * version 2 for more details (a copy is included in the LICENSE file that 30.16 + * accompanied this code). 30.17 + * 30.18 + * You should have received a copy of the GNU General Public License version 30.19 + * 2 along with this work; if not, write to the Free Software Foundation, 30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.21 + * 30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 30.23 + * or visit www.oracle.com if you need additional information or have any 30.24 + * questions. 30.25 + */ 30.26 + 30.27 +/** 30.28 + * @test 30.29 + * @bug 8033718 30.30 + * @author dlsmith 30.31 + * @summary GLB for two capture variables with lower bounds 30.32 + * @compile LowerBoundGLB.java 30.33 + */ 30.34 + 30.35 +public class LowerBoundGLB { 30.36 + 30.37 + interface Box<T> { 30.38 + T get(); 30.39 + void set(T arg); 30.40 + } 30.41 + 30.42 + <T> T doGLB(Box<? super T> b1, Box<? super T> b2) { 30.43 + return null; 30.44 + } 30.45 + 30.46 + void test(Box<? super String> l1, Box<? super CharSequence> l2) { 30.47 + doGLB(l1, l2).substring(3); 30.48 + } 30.49 + 30.50 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/test/tools/javac/generics/inference/T8028503/PrimitiveTypeInBoundForMethodRefTest.java Wed May 14 11:01:08 2014 -0700 31.3 @@ -0,0 +1,48 @@ 31.4 +/* 31.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.7 + * 31.8 + * This code is free software; you can redistribute it and/or modify it 31.9 + * under the terms of the GNU General Public License version 2 only, as 31.10 + * published by the Free Software Foundation. 31.11 + * 31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 31.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 31.15 + * version 2 for more details (a copy is included in the LICENSE file that 31.16 + * accompanied this code). 31.17 + * 31.18 + * You should have received a copy of the GNU General Public License version 31.19 + * 2 along with this work; if not, write to the Free Software Foundation, 31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 31.21 + * 31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 31.23 + * or visit www.oracle.com if you need additional information or have any 31.24 + * questions. 31.25 + */ 31.26 + 31.27 +/** 31.28 + * @test 31.29 + * @bug 8028503 31.30 + * @summary javac, for method references a primitive type can be added as a bound 31.31 + * @compile PrimitiveTypeInBoundForMethodRefTest.java 31.32 + */ 31.33 + 31.34 +class PrimitiveTypeInBoundForMethodRefTest { 31.35 + 31.36 + interface Mapper<T, U> { 31.37 + U map(T t); 31.38 + } 31.39 + 31.40 + static <U> Iterable<U> map(Mapper<String, U> mapper) { 31.41 + return null; 31.42 + } 31.43 + 31.44 + static void test() { 31.45 + Iterable<Integer> map = map(PrimitiveTypeInBoundForMethodRefTest::length); 31.46 + } 31.47 + 31.48 + public static <T> int length(String s) { 31.49 + return 0; 31.50 + } 31.51 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/test/tools/javac/generics/typevars/IntersectionSubVar.java Wed May 14 11:01:08 2014 -0700 32.3 @@ -0,0 +1,49 @@ 32.4 +/* 32.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.7 + * 32.8 + * This code is free software; you can redistribute it and/or modify it 32.9 + * under the terms of the GNU General Public License version 2 only, as 32.10 + * published by the Free Software Foundation. 32.11 + * 32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.15 + * version 2 for more details (a copy is included in the LICENSE file that 32.16 + * accompanied this code). 32.17 + * 32.18 + * You should have received a copy of the GNU General Public License version 32.19 + * 2 along with this work; if not, write to the Free Software Foundation, 32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.21 + * 32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 32.23 + * or visit www.oracle.com if you need additional information or have any 32.24 + * questions. 32.25 + */ 32.26 + 32.27 +/* 32.28 + * @test 32.29 + * @bug 8042656 32.30 + * @summary Subtyping for intersection types containing type variables 32.31 + * @compile IntersectionSubVar.java 32.32 + */ 32.33 + 32.34 +class IntersectionSubVar { 32.35 + 32.36 + interface Box<T> { 32.37 + void set(T arg); 32.38 + T get(); 32.39 + } 32.40 + 32.41 + <I> Box<I> glb(Box<? super I> arg1, Box<? super I> arg2) { 32.42 + return null; 32.43 + } 32.44 + 32.45 + <E extends Cloneable> void takeBox(Box<? super E> box) {} 32.46 + 32.47 + <T> void test(Box<T> arg1, Box<Cloneable> arg2, Box<? super T> arg3) { 32.48 + T t = glb(arg1, arg2).get(); // assign T&Cloneable to T 32.49 + takeBox(arg3); // inference tests Box<CAP> <: Box<? super CAP&Cloneable> 32.50 + } 32.51 + 32.52 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java Wed May 14 11:01:08 2014 -0700 33.3 @@ -0,0 +1,78 @@ 33.4 +/* 33.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.7 + * 33.8 + * This code is free software; you can redistribute it and/or modify it 33.9 + * under the terms of the GNU General Public License version 2 only, as 33.10 + * published by the Free Software Foundation. Oracle designates this 33.11 + * particular file as subject to the "Classpath" exception as provided 33.12 + * by Oracle in the LICENSE file that accompanied this code. 33.13 + * 33.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 33.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33.17 + * version 2 for more details (a copy is included in the LICENSE file that 33.18 + * accompanied this code). 33.19 + * 33.20 + * You should have received a copy of the GNU General Public License version 33.21 + * 2 along with this work; if not, write to the Free Software Foundation, 33.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 33.23 + * 33.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 33.25 + * or visit www.oracle.com if you need additional information or have any 33.26 + * questions. 33.27 + */ 33.28 + 33.29 +/* 33.30 + * @test 33.31 + * @bug 8030741 33.32 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 33.33 + * @compile EagerReturnTypeResolutionTesta.java 33.34 + */ 33.35 + 33.36 +public class EagerReturnTypeResolutionTesta { 33.37 + 33.38 + abstract class Test1<T>{ 33.39 + abstract <S> S foo(S x, S y); 33.40 + <S extends Number & Comparable<? extends Number>> void baz(Test1<S> a){} 33.41 + 33.42 + void bar(Test1<Long> x, Test1<Integer> y){ 33.43 + baz(foo(x, y)); 33.44 + } 33.45 + } 33.46 + 33.47 + abstract class Test2<T>{ 33.48 + abstract <S> S foo(S x, S y); 33.49 + abstract <S1> void baz(Test2<S1> a); 33.50 + 33.51 + void bar(Test2<Integer> y, Test2<Long> x){ 33.52 + baz(foo(x, y)); 33.53 + } 33.54 + } 33.55 + 33.56 + abstract class Test3<T>{ 33.57 + abstract <S> S foo(S x, S y); 33.58 + <T extends Number & Comparable<?>, 33.59 + S extends Number & Comparable<? extends T>> void baz(Test3<S> a){} 33.60 + 33.61 + void bar(Test3<Long> x, Test3<Integer> y){ 33.62 + baz(foo(x, y)); 33.63 + } 33.64 + } 33.65 + 33.66 + abstract class Test4 { 33.67 + abstract class A0<T> {} 33.68 + 33.69 + abstract class A1<T> extends A0<T> {} 33.70 + 33.71 + abstract class A2<T> extends A0<T> {} 33.72 + 33.73 + abstract <S> S foo(S x, S y); 33.74 + abstract <S1> void baz(A0<S1> a); 33.75 + 33.76 + void bar(A2<Integer> y, A1<Long> x){ 33.77 + baz(foo(x, y)); 33.78 + } 33.79 + } 33.80 + 33.81 +}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java Wed May 14 11:01:08 2014 -0700 34.3 @@ -0,0 +1,182 @@ 34.4 +/* 34.5 + * @test /nodynamiccopyright/ 34.6 + * @bug 8030741 34.7 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 34.8 + * @compile/fail/ref=EagerReturnTypeResolutionTestb.out -XDrawDiagnostics EagerReturnTypeResolutionTestb.java 34.9 + * @author Dan Smith 34.10 + */ 34.11 + 34.12 +import java.util.List; 34.13 + 34.14 +public class EagerReturnTypeResolutionTestb { 34.15 + interface I<S> {} 34.16 + interface J<S> extends I<S> {} 34.17 + interface K extends I<String> {} 34.18 + interface L<S> extends I {} 34.19 + 34.20 + <T> T lower(List<? extends T> l) { return null; } 34.21 + <T> T lower2(List<? extends T> l1, List<? extends T> l2) { return null; } 34.22 + 34.23 + <T> T upper(List<? super T> l) { return null; } 34.24 + <T> T upper2(List<? super T> l1, List<? super T> l2) { return null; } 34.25 + 34.26 + <T> T eq(List<T> l) { return null; } 34.27 + <T> T eq2(List<T> l1, List<T> l2) { return null; } 34.28 + 34.29 + <X> void takeI(I<X> i) {} 34.30 + void takeIString(I<String> i) {} 34.31 + I<String> iStringField; 34.32 + 34.33 + void takeLong(long arg) {} 34.34 + long longField; 34.35 + 34.36 + void testSimpleCaptureOK(List<I<?>> i1) { 34.37 + takeI(lower(i1)); // ok* 34.38 + takeI(eq(i1)); // ok* 34.39 + takeI(upper(i1)); // ok, no capture 34.40 + takeIString(upper(i1)); // ok 34.41 + iStringField = upper(i1); // ok 34.42 + } 34.43 + 34.44 + void testSimpleCaptureKO(List<I<?>> i1) { 34.45 + takeIString(lower(i1)); // ERROR 34.46 + takeIString(eq(i1)); // ERROR 34.47 + iStringField = lower(i1); // ERROR 34.48 + iStringField = eq(i1); // ERROR 34.49 + } 34.50 + 34.51 + void testMultiCaptureOK(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 34.52 + List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 34.53 + /* Lines marked with JDK-8029002 should be uncommented once this bug is 34.54 + * fixed 34.55 + */ 34.56 + takeI(lower2(i1, i2)); // ok* 34.57 + takeI(lower2(i1, i3)); // ok* 34.58 + takeI(upper2(i1, i3)); // ok, no capture* JDK-8029002 34.59 + 34.60 + takeIString(upper2(i1, i3)); // ok, no capture 34.61 + iStringField = upper2(i1, i3); // ok, no capture 34.62 + 34.63 + takeI(lower2(j1, j2)); // ok* 34.64 + takeI(lower2(j1, k1)); // ok, no capture 34.65 + takeI(upper2(j1, k1)); // ok, no capture* JDK-8029002 34.66 + 34.67 + takeIString(lower2(j1, k1)); // ok, no capture 34.68 + takeIString(upper2(j1, k1)); // ok, no capture 34.69 + 34.70 + iStringField = lower2(j1, k1); // ok, no capture 34.71 + iStringField = upper2(j1, k1); // ok, no capture 34.72 + takeI(lower2(j2, k1)); // ok* 34.73 + } 34.74 + 34.75 + void testMultiCaptureKO(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 34.76 + List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 34.77 + takeI(eq2(i1, i2)); // ERROR, bad bounds 34.78 + takeI(upper2(i1, i2)); // ERROR, bad bounds 34.79 + 34.80 + takeIString(lower2(i1, i2)); // ERROR 34.81 + takeIString(eq2(i1, i2)); // ERROR, bad bounds 34.82 + takeIString(upper2(i1, i2)); // ERROR, bad bounds 34.83 + 34.84 + iStringField = lower2(i1, i2); // ERROR 34.85 + iStringField = eq2(i1, i2); // ERROR, bad bounds 34.86 + iStringField = upper2(i1, i2); // ERROR, bad bounds 34.87 + 34.88 + takeI(eq2(i1, i3)); // ERROR, bad bounds 34.89 + takeIString(lower2(i1, i3)); // ERROR 34.90 + takeIString(eq2(i1, i3)); // ERROR, bad bounds 34.91 + 34.92 + iStringField = lower2(i1, i3); // ERROR 34.93 + iStringField = eq2(i1, i3); // ERROR, bad bounds 34.94 + takeI(eq2(j1, j2)); // ERROR, bad bounds 34.95 + takeI(upper2(j1, j2)); // ERROR, bad bounds 34.96 + 34.97 + takeIString(lower2(j1, j2)); // ERROR 34.98 + takeIString(eq2(j1, j2)); // ERROR, bad bounds 34.99 + takeIString(upper2(j1, j2)); // ERROR, bad bounds 34.100 + 34.101 + iStringField = lower2(j1, j2); // ERROR 34.102 + iStringField = eq2(j1, j2); // ERROR, bad bounds 34.103 + iStringField = upper2(j1, j2); // ERROR, bad bounds 34.104 + 34.105 + takeI(eq2(j1, k1)); // ERROR, bad bounds 34.106 + takeIString(eq2(j1, k1)); // ERROR, bad bounds 34.107 + iStringField = eq2(j1, k1); // ERROR, bad bounds 34.108 + takeI(eq2(j2, k1)); // ERROR, bad bounds 34.109 + takeI(upper2(j2, k1)); // ERROR, bad bounds; actual: no error, see JDK-8037474 34.110 + 34.111 + takeIString(lower2(j2, k1)); // ERROR 34.112 + takeIString(eq2(j2, k1)); // ERROR, bad bounds 34.113 + takeIString(upper2(j2, k1)); // ERROR, bad bounds 34.114 + 34.115 + iStringField = lower2(j2, k1); // ERROR 34.116 + iStringField = eq2(j2, k1); // ERROR, bad bounds 34.117 + iStringField = upper2(j2, k1); // ERROR, bad bounds 34.118 + } 34.119 + 34.120 + void testRawOK(List<I> i1, List<J> j1, List<L<String>> l1) { 34.121 + takeI(lower(i1)); // ok, unchecked 34.122 + takeI(eq(i1)); // ok, unchecked 34.123 + takeI(upper(i1)); // ok, no capture, not unchecked 34.124 + 34.125 + takeIString(lower(i1)); // ok, unchecked 34.126 + takeIString(eq(i1)); // ok, unchecked 34.127 + takeIString(upper(i1)); // ok, no capture, not unchecked 34.128 + 34.129 + iStringField = lower(i1); // ok, unchecked 34.130 + iStringField = eq(i1); // ok, unchecked 34.131 + iStringField = upper(i1); // ok, no capture, not unchecked 34.132 + 34.133 + takeI(lower(j1)); // ok, unchecked 34.134 + takeI(eq(j1)); // ok, unchecked 34.135 + takeI(upper(j1)); // bad bounds? -- spec is unclear 34.136 + 34.137 + takeIString(lower(j1)); // ok, unchecked 34.138 + takeIString(eq(j1)); // ok, unchecked 34.139 + takeIString(upper(j1)); // bad bounds? -- spec is unclear 34.140 + 34.141 + iStringField = lower(j1); // ok, unchecked 34.142 + iStringField = eq(j1); // ok, unchecked 34.143 + iStringField = upper(j1); // bad bounds? -- spec is unclear 34.144 + 34.145 + takeI(lower(l1)); // ok, unchecked 34.146 + takeI(eq(l1)); // ok, unchecked 34.147 + takeI(upper(l1)); // bad bounds? -- spec is unclear 34.148 + 34.149 + takeIString(lower(l1)); // ok, unchecked 34.150 + takeIString(eq(l1)); // ok, unchecked 34.151 + takeIString(upper(l1)); // bad bounds? -- spec is unclear 34.152 + 34.153 + iStringField = lower(l1); // ok, unchecked 34.154 + iStringField = eq(l1); // ok, unchecked 34.155 + iStringField = upper(l1); // bad bounds? -- spec is unclear 34.156 + } 34.157 + 34.158 + void testPrimOK(List<Integer> i1, List<Long> l1, List<Double> d1) { 34.159 + takeLong(lower(i1)); // ok 34.160 + takeLong(eq(i1)); // ok 34.161 + takeLong(upper(i1)); // ok* 34.162 + 34.163 + longField = lower(i1); // ok 34.164 + longField = eq(i1); // ok 34.165 + longField = upper(i1); // ok* 34.166 + 34.167 + takeLong(lower(l1)); // ok 34.168 + takeLong(eq(l1)); // ok 34.169 + takeLong(upper(l1)); // ok 34.170 + 34.171 + longField = lower(l1); // ok 34.172 + longField = eq(l1); // ok 34.173 + longField = upper(l1); // ok 34.174 + } 34.175 + 34.176 + void testPrimKO(List<Integer> i1, List<Long> l1, List<Double> d1) { 34.177 + takeLong(lower(d1)); // ERROR 34.178 + takeLong(eq(d1)); // ERROR 34.179 + takeLong(upper(d1)); // ERROR 34.180 + 34.181 + longField = lower(d1); // ERROR 34.182 + longField = eq(d1); // ERROR 34.183 + longField = upper(d1); // ERROR 34.184 + } 34.185 +}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 35.2 +++ b/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out Wed May 14 11:01:08 2014 -0700 35.3 @@ -0,0 +1,45 @@ 35.4 +EagerReturnTypeResolutionTestb.java:42:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 35.5 +EagerReturnTypeResolutionTestb.java:43:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 35.6 +EagerReturnTypeResolutionTestb.java:44:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.7 +EagerReturnTypeResolutionTestb.java:45:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.8 +EagerReturnTypeResolutionTestb.java:74:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 35.9 +EagerReturnTypeResolutionTestb.java:75:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.10 +EagerReturnTypeResolutionTestb.java:77:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 35.11 +EagerReturnTypeResolutionTestb.java:78:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 35.12 +EagerReturnTypeResolutionTestb.java:79:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.13 +EagerReturnTypeResolutionTestb.java:81:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.14 +EagerReturnTypeResolutionTestb.java:82:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 35.15 +EagerReturnTypeResolutionTestb.java:83:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.16 +EagerReturnTypeResolutionTestb.java:85:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 35.17 +EagerReturnTypeResolutionTestb.java:86:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 35.18 +EagerReturnTypeResolutionTestb.java:87:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 35.19 +EagerReturnTypeResolutionTestb.java:89:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.20 +EagerReturnTypeResolutionTestb.java:90:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 35.21 +EagerReturnTypeResolutionTestb.java:91:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 35.22 +EagerReturnTypeResolutionTestb.java:92:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 35.23 +EagerReturnTypeResolutionTestb.java:94:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.J<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 35.24 +EagerReturnTypeResolutionTestb.java:95:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 35.25 +EagerReturnTypeResolutionTestb.java:96:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 35.26 +EagerReturnTypeResolutionTestb.java:98:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.27 +EagerReturnTypeResolutionTestb.java:99:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 35.28 +EagerReturnTypeResolutionTestb.java:100:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 35.29 +EagerReturnTypeResolutionTestb.java:102:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 35.30 +EagerReturnTypeResolutionTestb.java:103:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 35.31 +EagerReturnTypeResolutionTestb.java:104:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 35.32 +EagerReturnTypeResolutionTestb.java:105:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 35.33 +EagerReturnTypeResolutionTestb.java:106:9: compiler.err.cant.apply.symbol: kindname.method, takeI, EagerReturnTypeResolutionTestb.I<X>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Integer, java.lang.Integer,java.lang.String) 35.34 +EagerReturnTypeResolutionTestb.java:108:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 35.35 +EagerReturnTypeResolutionTestb.java:109:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 35.36 +EagerReturnTypeResolutionTestb.java:110:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)) 35.37 +EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 35.38 +EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 35.39 +EagerReturnTypeResolutionTestb.java:114:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object) 35.40 +EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 35.41 +EagerReturnTypeResolutionTestb.java:175:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 35.42 +EagerReturnTypeResolutionTestb.java:176:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 35.43 +EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 35.44 +EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 35.45 +EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 35.46 +- compiler.note.unchecked.filename: EagerReturnTypeResolutionTestb.java 35.47 +- compiler.note.unchecked.recompile 35.48 +42 errors
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java Wed May 14 11:01:08 2014 -0700 36.3 @@ -0,0 +1,25 @@ 36.4 +/* 36.5 + * @test /nodynamiccopyright/ 36.6 + * @bug 8030741 36.7 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 36.8 + * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java 36.9 + */ 36.10 + 36.11 +public class PrimitiveTypeBoxingTest { 36.12 + 36.13 + static void foo(long arg) {} 36.14 + static void bar(int arg) {} 36.15 + 36.16 + interface F<X> { void get(X arg); } 36.17 + 36.18 + <Z> void m1(F<Z> f, Z arg) {} 36.19 + <Z> void m2(Z arg, F<Z> f) {} 36.20 + 36.21 + void test() { 36.22 + m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error 36.23 + m2(23, PrimitiveTypeBoxingTest::foo); // expected: error 36.24 + 36.25 + m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success 36.26 + m2(23, PrimitiveTypeBoxingTest::bar); // expected: success 36.27 + } 36.28 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out Wed May 14 11:01:08 2014 -0700 37.3 @@ -0,0 +1,3 @@ 37.4 +PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @490,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object) 37.5 +PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@559, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object) 37.6 +2 errors
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/test/tools/javac/lambda/LambdaLocalTest.java Wed May 14 11:01:08 2014 -0700 38.3 @@ -0,0 +1,55 @@ 38.4 +/* 38.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 38.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.7 + * 38.8 + * This code is free software; you can redistribute it and/or modify it 38.9 + * under the terms of the GNU General Public License version 2 only, as 38.10 + * published by the Free Software Foundation. 38.11 + * 38.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 38.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 38.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 38.15 + * version 2 for more details (a copy is included in the LICENSE file that 38.16 + * accompanied this code). 38.17 + * 38.18 + * You should have received a copy of the GNU General Public License version 38.19 + * 2 along with this work; if not, write to the Free Software Foundation, 38.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 38.21 + * 38.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 38.23 + * or visit www.oracle.com if you need additional information or have any 38.24 + * questions. 38.25 + */ 38.26 + 38.27 +/* 38.28 + * @test 38.29 + * @bug 8029725 38.30 + * @summary Lambda reference to containing local class causes javac infinite recursion 38.31 + * @author Robert Field 38.32 + * @run main LambdaLocalTest 38.33 + */ 38.34 + 38.35 +public class LambdaLocalTest { 38.36 + interface F {void f();} 38.37 + 38.38 + static F f; 38.39 + static StringBuffer sb = new StringBuffer(); 38.40 + 38.41 + static void assertEquals(Object val, Object expected) { 38.42 + if (!val.equals(expected)) { 38.43 + throw new AssertionError("expected '" + expected + "' got '" + val + "'"); 38.44 + } 38.45 + } 38.46 + 38.47 + public static void main(String[] args) { 38.48 + class Local { 38.49 + public Local() { 38.50 + f = () -> new Local(); 38.51 + sb.append("+"); 38.52 + } 38.53 + } 38.54 + new Local(); 38.55 + f.f(); 38.56 + assertEquals(sb.toString(), "++"); 38.57 + } 38.58 +}
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/test/tools/javac/lambda/LambdaMultiCatchTest.java Wed May 14 11:01:08 2014 -0700 39.3 @@ -0,0 +1,58 @@ 39.4 +/* 39.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 39.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.7 + * 39.8 + * This code is free software; you can redistribute it and/or modify it 39.9 + * under the terms of the GNU General Public License version 2 only, as 39.10 + * published by the Free Software Foundation. Oracle designates this 39.11 + * particular file as subject to the "Classpath" exception as provided 39.12 + * by Oracle in the LICENSE file that accompanied this code. 39.13 + * 39.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 39.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.17 + * version 2 for more details (a copy is included in the LICENSE file that 39.18 + * accompanied this code). 39.19 + * 39.20 + * You should have received a copy of the GNU General Public License version 39.21 + * 2 along with this work; if not, write to the Free Software Foundation, 39.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.23 + * 39.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 39.25 + * or visit www.oracle.com if you need additional information or have any 39.26 + * questions. 39.27 + */ 39.28 + 39.29 +/** 39.30 + * @test 39.31 + * @bug 8036942 39.32 + * @summary javac generates incorrect exception table for multi-catch statements inside a lambda 39.33 + * @run main LambdaMultiCatchTest 39.34 + */ 39.35 + 39.36 +import java.io.IOException; 39.37 +import java.util.function.Function; 39.38 + 39.39 +public class LambdaMultiCatchTest { 39.40 + public static void main(String[] args) { 39.41 + Function<String,String> fi = x -> { 39.42 + String result = "nada"; 39.43 + try { 39.44 + switch (x) { 39.45 + case "IO": throw new IOException(); 39.46 + case "Illegal": throw new IllegalArgumentException(); 39.47 + case "Run": throw new RuntimeException(); 39.48 + } 39.49 + } catch (IOException|IllegalArgumentException ex) { 39.50 + result = "IO/Illegal"; 39.51 + } catch (Exception ex) { 39.52 + result = "Any"; 39.53 + }; 39.54 + return result; 39.55 + }; 39.56 + String val = fi.apply("Run"); 39.57 + if (!val.equals("Any")) { 39.58 + throw new AssertionError("Fail: Expected 'Any' but got '" + val + "'"); 39.59 + } 39.60 + } 39.61 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/test/tools/javac/lambda/LambdaOuterLocalTest.java Wed May 14 11:01:08 2014 -0700 40.3 @@ -0,0 +1,61 @@ 40.4 +/* 40.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.7 + * 40.8 + * This code is free software; you can redistribute it and/or modify it 40.9 + * under the terms of the GNU General Public License version 2 only, as 40.10 + * published by the Free Software Foundation. 40.11 + * 40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 40.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 40.15 + * version 2 for more details (a copy is included in the LICENSE file that 40.16 + * accompanied this code). 40.17 + * 40.18 + * You should have received a copy of the GNU General Public License version 40.19 + * 2 along with this work; if not, write to the Free Software Foundation, 40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 40.21 + * 40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 40.23 + * or visit www.oracle.com if you need additional information or have any 40.24 + * questions. 40.25 + */ 40.26 + 40.27 +/* 40.28 + * @test 40.29 + * @bug 8029725 40.30 + * @summary Lambda reference to containing local class causes javac infinite recursion 40.31 + * @author Robert Field 40.32 + * @run main LambdaOuterLocalTest 40.33 + */ 40.34 + 40.35 +public class LambdaOuterLocalTest { 40.36 + interface F {void f();} 40.37 + 40.38 + static F f; 40.39 + static StringBuffer sb = new StringBuffer(); 40.40 + 40.41 + static void assertEquals(Object val, Object expected) { 40.42 + if (!val.equals(expected)) { 40.43 + throw new AssertionError("expected '" + expected + "' got '" + val + "'"); 40.44 + } 40.45 + } 40.46 + 40.47 + public static void main(String[] args) { 40.48 + class Local1 { 40.49 + public Local1() { 40.50 + class Local2 { 40.51 + public Local2() { 40.52 + f = () -> new Local1(); 40.53 + sb.append("2"); 40.54 + } 40.55 + } 40.56 + sb.append("1"); 40.57 + new Local2(); 40.58 + } 40.59 + } 40.60 + new Local1(); 40.61 + f.f(); 40.62 + assertEquals(sb.toString(), "1212"); 40.63 + } 40.64 +}
41.1 --- a/test/tools/javac/lambda/MethodReference42.out Tue May 13 23:18:48 2014 -0700 41.2 +++ b/test/tools/javac/lambda/MethodReference42.out Wed May 14 11:01:08 2014 -0700 41.3 @@ -1,4 +1,4 @@ 41.4 -MethodReference42.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference42.SAM1, @811, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)) 41.5 -MethodReference42.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference42.SAM3, @855, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)) 41.6 +MethodReference42.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference42.SAM1, @811, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))) 41.7 +MethodReference42.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference42.SAM3, @855, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number))) 41.8 MethodReference42.java:41:9: compiler.err.ref.ambiguous: m4, kindname.method, m4(MethodReference42.SAM2), MethodReference42, kindname.method, m4(MethodReference42.SAM3), MethodReference42 41.9 3 errors
42.1 --- a/test/tools/javac/lambda/MethodReference44.out Tue May 13 23:18:48 2014 -0700 42.2 +++ b/test/tools/javac/lambda/MethodReference44.out Wed May 14 11:01:08 2014 -0700 42.3 @@ -1,4 +1,4 @@ 42.4 -MethodReference44.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference44.SAM1, @864, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)) 42.5 -MethodReference44.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference44.SAM3, @932, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)) 42.6 +MethodReference44.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference44.SAM1, @864, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))) 42.7 +MethodReference44.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference44.SAM3, @932, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number))) 42.8 MethodReference44.java:43:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference44.SAM2), MethodReference44, kindname.method, g4(MethodReference44.SAM3), MethodReference44 42.9 3 errors
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/test/tools/javac/lambda/SingleLocalTest.java Wed May 14 11:01:08 2014 -0700 43.3 @@ -0,0 +1,50 @@ 43.4 +/* 43.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.7 + * 43.8 + * This code is free software; you can redistribute it and/or modify it 43.9 + * under the terms of the GNU General Public License version 2 only, as 43.10 + * published by the Free Software Foundation. 43.11 + * 43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.15 + * version 2 for more details (a copy is included in the LICENSE file that 43.16 + * accompanied this code). 43.17 + * 43.18 + * You should have received a copy of the GNU General Public License version 43.19 + * 2 along with this work; if not, write to the Free Software Foundation, 43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.21 + * 43.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 43.23 + * or visit www.oracle.com if you need additional information or have any 43.24 + * questions. 43.25 + */ 43.26 + 43.27 +/* 43.28 + * @test 43.29 + * @bug 8029852 43.30 + * @summary Bad code generated (VerifyError) when lambda instantiates 43.31 + * enclosing local class and has captured variables 43.32 + */ 43.33 +public class SingleLocalTest { 43.34 + interface F {void f();} 43.35 + 43.36 + static F f; 43.37 + 43.38 + public static void main(String[] args) { 43.39 + StringBuffer sb = new StringBuffer(); 43.40 + class Local1 { 43.41 + public Local1() { 43.42 + f = () -> new Local1(); 43.43 + sb.append("1"); 43.44 + } 43.45 + } 43.46 + new Local1(); 43.47 + f.f(); 43.48 + String s = sb.toString(); 43.49 + if (!s.equals("11")) { 43.50 + throw new AssertionError("Expected '11' got '" + s + "'"); 43.51 + } 43.52 + } 43.53 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/test/tools/javac/resolve/AmbiguityErrorTest.java Wed May 14 11:01:08 2014 -0700 44.3 @@ -0,0 +1,75 @@ 44.4 +/* 44.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 44.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 44.7 + * 44.8 + * This code is free software; you can redistribute it and/or modify it 44.9 + * under the terms of the GNU General Public License version 2 only, as 44.10 + * published by the Free Software Foundation. 44.11 + * 44.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 44.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 44.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 44.15 + * version 2 for more details (a copy is included in the LICENSE file that 44.16 + * accompanied this code). 44.17 + * 44.18 + * You should have received a copy of the GNU General Public License version 44.19 + * 2 along with this work; if not, write to the Free Software Foundation, 44.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 44.21 + * 44.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 44.23 + * or visit www.oracle.com if you need additional information or have any 44.24 + * questions. 44.25 + */ 44.26 + 44.27 +/** 44.28 + * @test 44.29 + * @bug 8041663 44.30 + */ 44.31 + 44.32 +public class AmbiguityErrorTest { 44.33 + 44.34 + public interface A { } 44.35 + 44.36 + public interface B extends A { } 44.37 + 44.38 + public interface C { 44.39 + A m(B strategy); 44.40 + } 44.41 + 44.42 + public interface D { 44.43 + A m(A strategy); 44.44 + A m(B strategy); 44.45 + } 44.46 + 44.47 + public interface T1 extends C, D { } 44.48 + public interface T2 extends D, C { } 44.49 + 44.50 + int count; 44.51 + 44.52 + class T1Impl implements T1, T2 { 44.53 + public A m(B strategy) { 44.54 + count++; 44.55 + return null; 44.56 + } 44.57 + public A m(A strategy) { 44.58 + throw new AssertionError("Should not get here."); 44.59 + } 44.60 + } 44.61 + 44.62 + public static void main(String... args) { 44.63 + new AmbiguityErrorTest().test(); 44.64 + } 44.65 + 44.66 + void test() { 44.67 + T1 t1 = new T1Impl(); 44.68 + T2 t2 = new T1Impl(); 44.69 + final B b = new B() { }; 44.70 + t1.m(b); 44.71 + t2.m(b); 44.72 + 44.73 + if (count != 2) { 44.74 + throw new IllegalStateException("Did not call the methods properly"); 44.75 + } 44.76 + } 44.77 + 44.78 +}