From vicente.romero at oracle.com Fri Dec 1 14:34:56 2017 From: vicente.romero at oracle.com (Vicente Romero) Date: Fri, 1 Dec 2017 09:34:56 -0500 Subject: RFR JDK-8191969: javac produces incorrect RuntimeInvisibleTypeAnnotations length attribute In-Reply-To: <5A202E89.9090808@oracle.com> References: <5A1D4C66.5010605@oracle.com> <5A202E89.9090808@oracle.com> Message-ID: <82bfb1b2-c917-bf88-7e71-9334035b4631@oracle.com> looks good, Vicente On 11/30/2017 11:15 AM, Jan Lahoda wrote: > To me, looks OK, but unfortunately I not a jdk8u Reviewer. > > Jan > > On 28.11.2017 12:45, Srikanth wrote: >> >> Hello, >> >> JDK-8191969 is a JDK8u backport task created for JDK-8144185 which was >> pushed for JDK10 >> here: http://hg.openjdk.java.net/jdk10/jdk10/langtools/rev/0b32afcabef4 >> >> We have a request from asm tool maintainers and also from other sources >> through the sustenance channel for a backport. >> >> Synopsis: >> >> Basically problem arises when metadata that models the type annotations >> on a captured outer local are shared with the lambda implementation >> method's formal parameter that corresponds to the >> captured outer local. >> >> Any changes to one will invalidate the other. This is in fact what >> causes grief for asm. >> >> However, as per the spec clarification spelled out here: >> http://mail.openjdk.java.net/pipermail/compiler-dev/2015-December/009866.html >> >> we should not be transmitting the annotations from the captured outer >> locals to any formal parameter that represents/reifies the captured >> outer local in a synthetic lambda implementation method. >> >> Thus aligning to the spec, makes the problem vanish automatically. >> >> 8u webrev: >> >> http://cr.openjdk.java.net/~sadayapalam/JDK-8191969/webrev.00/ >> >> (This is essentially the same fix pushed for jdk10, with the patch >> manually applied to jdk8u-dev) >> >> All relevant tests are green. Please review. >> Thanks in advance. >> Srikanth >> >> From kumar.x.srinivasan at oracle.com Fri Dec 1 14:41:44 2017 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Fri, 01 Dec 2017 06:41:44 -0800 Subject: RFR: 8189102: All tools should support -?, -h and --help In-Reply-To: References: <4a021bc072f24c7b9d1bb3b00b774867@sap.com> <5A1C4081.2090107@oracle.com> Message-ID: <5A216A28.3030702@oracle.com> Hi, Besides my private comments to you, there are 2-3 internal tests which fail. Have you run all the langtools tests ? There are 4 Windows tests that fail with langtools: jdk/javadoc/doclet/testHelpOption/TestHelpOption.java jdk/javadoc/tool/CheckResourceKeys.java jdk/javadoc/tool/ToolProviderTest.java tools/javap/InvalidOptions.java tools/jdeps/MultiReleaseJar.java This changeset needs to be vetted thoroughly using internal build and test systems. Any Oracle engineer willing to sponsor this ? Kumar On 11/28/2017 3:16 AM, Lindenmaier, Goetz wrote: > Hi, > > I uploaded a new webrev: > http://cr.openjdk.java.net/~goetz/wr17/8189102-helpMessage/webrev.04/ > > This includes the changes > - to jshell requested by Robert > - to the test as requested by Kumar. > > See also incremental patch and the test output including all the > help messages referenced in the webrev. > > Best regards, > Goetz. > >> -----Original Message----- >> From: Kumar Srinivasan [mailto:kumar.x.srinivasan at oracle.com] >> Sent: Montag, 27. November 2017 17:43 >> To: Lindenmaier, Goetz >> Cc: core-libs-dev at openjdk.java.net; 'compiler-dev at openjdk.java.net' >> ; serviceability-dev (serviceability- >> dev at openjdk.java.net) >> Subject: Re: RFR: 8189102: All tools should support -?, -h and --help >> >> Hi, >> >> I looked at some of the components I maintain, and they look good. >> >> Wrt. the test: >> >> 1. The local variables/fields don't comply with the coding conventions, >> we have been >> following in the JDK. >> >> 2. Hmm, someone parked a .ini file in bin directory, later removed, >> perhaps on windows simply check for .exe ? Should a check exist >> to verify if file has executable permissions ?"File.canExecute". >> >> 171 // Returns true if the file is not a tool. >> 172 static boolean notATool(String file) { >> 173 file = file.toLowerCase(); >> 174 if (file.endsWith(".dll") || >> 175 file.endsWith(".map") || >> 176 file.endsWith(".pdb") || >> 177 file.equals("server")) { // server subdir on windows. >> 178 return true; >> 179 } >> 180 return false; >> 181 } >> >> >> 3. Typo in comment >> >> 201 // Check whether 'flag' appears in 'line' as a word of itself. I must not >> >> s/I must/It must/ >> >> >> 4. There is a method to check for isEnglishLocale in TestHelper, perhaps >> use it >> to have the test bale out in non english locales as early as possible ? >> >> 5. Has this been tested on all platforms ? do you need help testing it ? >> >> Kumar >> >> >> On 11/17/2017 3:23 AM, Lindenmaier, Goetz wrote: >>> Hi, >>> >>> please review this change. I also filed a CSR for this: >>> http://cr.openjdk.java.net/~goetz/wr17/8189102- >> helpMessage/webrev.02/ >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8189102 >>> CSR: https://bugs.openjdk.java.net/browse/JDK-8191477 >>> >>> See the webrev for a detailed description of the changes. >>> >>> If required, I'll make break-out changes to be reviewed separately. >>> >>> I had posted a RFR before, but improved the change to >>> give a more complete overview of currently supported flags >>> for the CSR: >>> http://mail.openjdk.java.net/pipermail/hotspot-dev/2017- >> October/028615.html >>> Best regards, >>> Goetz. >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From goetz.lindenmaier at sap.com Fri Dec 1 15:16:47 2017 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Fri, 1 Dec 2017 15:16:47 +0000 Subject: RFR: 8189102: All tools should support -?, -h and --help In-Reply-To: <5A216A28.3030702@oracle.com> References: <4a021bc072f24c7b9d1bb3b00b774867@sap.com> <5A1C4081.2090107@oracle.com> <5A216A28.3030702@oracle.com> Message-ID: <2ac9c1e37d8e493aa5b581d1a69862e8@sap.com> Hi Kumar, I'm already looking at the issues from your other mail. Detailed comments will follow. I'll also check and fix the new tests you report. I think we don't run the langtool tests, i.e. I know we didn't run them before the repos were merged. Obviously we should add them to our testing :) Thanks for further testing and best regards, Goetz. > -----Original Message----- > From: Kumar Srinivasan [mailto:kumar.x.srinivasan at oracle.com] > Sent: Freitag, 1. Dezember 2017 15:42 > To: Lindenmaier, Goetz > Cc: core-libs-dev at openjdk.java.net; 'compiler-dev at openjdk.java.net' > ; serviceability-dev (serviceability- > dev at openjdk.java.net) > Subject: Re: RFR: 8189102: All tools should support -?, -h and --help > > Hi, > > Besides my private comments to you, there are 2-3 internal tests > which fail. > > Have you run all the langtools tests ? There are 4 Windows tests > that fail with langtools: > > jdk/javadoc/doclet/testHelpOption/TestHelpOption.java > jdk/javadoc/tool/CheckResourceKeys.java > jdk/javadoc/tool/ToolProviderTest.java > tools/javap/InvalidOptions.java > tools/jdeps/MultiReleaseJar.java > > This changeset needs to be vetted thoroughly using internal build and test > systems. > Any Oracle engineer willing to sponsor this ? > > Kumar > > > On 11/28/2017 3:16 AM, Lindenmaier, Goetz wrote: > > > Hi, > > I uploaded a new webrev: > http://cr.openjdk.java.net/~goetz/wr17/8189102- > helpMessage/webrev.04/ > > This includes the changes > - to jshell requested by Robert > - to the test as requested by Kumar. > > See also incremental patch and the test output including all the > help messages referenced in the webrev. > > Best regards, > Goetz. > > > -----Original Message----- > From: Kumar Srinivasan > [mailto:kumar.x.srinivasan at oracle.com] > Sent: Montag, 27. November 2017 17:43 > To: Lindenmaier, Goetz > > Cc: core-libs-dev at openjdk.java.net dev at openjdk.java.net> ; 'compiler-dev at openjdk.java.net > ' > dev at openjdk.java.net> ; serviceability-dev (serviceability- > dev at openjdk.java.net ) > dev at openjdk.java.net> > Subject: Re: RFR: 8189102: All tools should support -?, -h and - > -help > > Hi, > > I looked at some of the components I maintain, and they look > good. > > Wrt. the test: > > 1. The local variables/fields don't comply with the coding > conventions, > we have been > following in the JDK. > > 2. Hmm, someone parked a .ini file in bin directory, later > removed, > perhaps on windows simply check for .exe ? Should a > check exist > to verify if file has executable permissions > ?"File.canExecute". > > 171 // Returns true if the file is not a tool. > 172 static boolean notATool(String file) { > 173 file = file.toLowerCase(); > 174 if (file.endsWith(".dll") || > 175 file.endsWith(".map") || > 176 file.endsWith(".pdb") || > 177 file.equals("server")) { // server subdir on > windows. > 178 return true; > 179 } > 180 return false; > 181 } > > > 3. Typo in comment > > 201 // Check whether 'flag' appears in 'line' as a word of > itself. I must not > > s/I must/It must/ > > > 4. There is a method to check for isEnglishLocale in > TestHelper, perhaps > use it > to have the test bale out in non english locales as early as > possible ? > > 5. Has this been tested on all platforms ? do you need help > testing it ? > > Kumar > > > On 11/17/2017 3:23 AM, Lindenmaier, Goetz wrote: > > Hi, > > please review this change. I also filed a CSR for this: > http://cr.openjdk.java.net/~goetz/wr17/8189102- > > helpMessage/webrev.02/ > > Bug: https://bugs.openjdk.java.net/browse/JDK- > 8189102 > CSR: https://bugs.openjdk.java.net/browse/JDK- > 8191477 > > See the webrev for a detailed description of the > changes. > > If required, I'll make break-out changes to be > reviewed separately. > > I had posted a RFR before, but improved the change > to > give a more complete overview of currently > supported flags > for the CSR: > http://mail.openjdk.java.net/pipermail/hotspot- > dev/2017- > > October/028615.html > > > Best regards, > Goetz. > > > > From jonathan.gibbons at oracle.com Sat Dec 2 00:29:38 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Fri, 01 Dec 2017 16:29:38 -0800 Subject: RFR 8189749: Devise strategy for making source level checks more uniform In-Reply-To: <0d223e68-de26-1e59-adad-1f57c9d28762@oracle.com> References: <0d223e68-de26-1e59-adad-1f57c9d28762@oracle.com> Message-ID: <5A21F3F2.2060609@oracle.com> +1. Very nice. Nit: I would suggest changing multi-catch statements to the plural form. tests/MulticatchNotSupported.java:39: error: multi-catch statement is not supported in -source 6 -- Jon On 11/28/2017 06:19 AM, Maurizio Cimadamore wrote: > Updated webrev here: > > http://cr.openjdk.java.net/~mcimadamore/8189749-v2/ > > I've included a report of the diagnostics that have been tweaked by > this webrev here to make sure that singular vs. plural is used > effectively: > > http://cr.openjdk.java.net/~mcimadamore/8189749-v2/diags.html > > Cheers > Maurizio > > > On 20/10/17 19:07, Maurizio Cimadamore wrote: >> Hi, >> this biggie patch allows the treatment of source level checks to be >> more uniform. The general problem is explained in details here: >> >> https://bugs.openjdk.java.net/browse/JDK-8189749 >> >> Webrev is here: >> >> http://cr.openjdk.java.net/~mcimadamore/8189749/ >> >> The way I approached this, was to create a first class entity, an >> enum called Feature. Each 'feature' has: >> >> * a min source level (e.g. what is the min source level required to >> compile that feature, meaning that lower levels will result in errors) >> * a max source level (e.g. what is the max source level required to >> compile that feature, meaning that higher levels will result in errors) >> * an optional resource key >> >> The first two properties are obviously used to decided if feature XYZ >> can be used given source level N. The last property is used to >> automate generation of source check diagnostics. Note that this patch >> introduce a _single_ source check diagnostic: >> >> # 0: message segment (feature), 1: string (found version), 2: string >> (expected version) >> compiler.misc.feature.not.supported.in.source=\ >> {0} not supported in -source {1}\n\ >> (use -source {2} or higher to enable {0}) >> >> And then there's a bunch of feature fragments, example: >> >> compiler.misc.feature.modules=\ >> modules >> >> compiler.misc.feature.diamond.and.anon.class=\ >> ''<>'' with anonymous inner classes >> >> compiler.misc.feature.binary.lit=\ >> binary literals >> >> (and many more :-)) >> >> Since each feature 'knows' its fragment, it is super easy for the >> compiler to generate the source level check diagnostic for any >> feature. And, if you need to add a new feature, you just need to add >> an enum value, and wired it up with the corresponding resource key - >> done :-) >> >> Since this change affects the way in which source check diagnostics >> are generated, quite a lot of changes were required to adjust >> expected output in golden files. Aside from those changes, I also >> addressed the following issues: >> >> * JavaTokenizer was not using SOURCE_LEVEL flags for its diagnostics, >> and it was not using the new diagnostic framework to generate errors, >> which made the porting harder - so I've fixed that >> * CALog in Completeness analyzer required a new override for an >> AbstractLog::error variant that was probably forgotten (this was >> required otherwise CompletenessAnalyzerTest was failing after the >> change above) >> * Log has a 'feature' so that diagnostics marked with the >> SOURCE_LEVEL flag can be reported only once per source. But this >> check was only looking at the 'head' of a diagnostic, ignoring all >> arguments. Since now all source level check diagnostics share the >> same head, I needed to tweak the logic to also compare arguments - or >> else, one source level check error being reported would also disable >> unrelated source level check diags. >> >> Then there were a bunch of mechanical translation, for instance >> idioms such as: >> >> allowSimplifiedVarargs = source.allowSimplifiedVarargs(); >> >> Were rewritten as: >> >> allowSimplifiedVarargs = source.allowed(Feature.SIMPLIFIED_VARARGS); >> >> Also, in JavacParser, this idiom: >> >> checkTypeAnnotations(); >> >> has been replaced with >> >> checkSourceLevel(Feature.TYPE_ANNOTATIONS); >> >> Where checkSourceLevel is a new general routine that works on any >> Feature. >> >> Finally, where possible, I also got rid of the various boolean flags >> of the kind 'allowPrivateMethodInInterfaces' - if the class already >> had a 'source' field, the boolean flag can be omitted, and the check >> can be performed on the source object itself. >> >> Cheers >> Maurizio >> >> >> > From maurizio.cimadamore at oracle.com Mon Dec 4 12:22:19 2017 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Mon, 4 Dec 2017 12:22:19 +0000 Subject: RFR 8189749: Devise strategy for making source level checks more uniform In-Reply-To: <5A21F3F2.2060609@oracle.com> References: <0d223e68-de26-1e59-adad-1f57c9d28762@oracle.com> <5A21F3F2.2060609@oracle.com> Message-ID: Thanks, I will make the change ahead of the push (w/o submitting another round) if that's ok Maurizio On 02/12/17 00:29, Jonathan Gibbons wrote: > +1. Very nice. > > Nit: I would suggest changing multi-catch statements to the plural form. > > tests/MulticatchNotSupported.java:39: error: multi-catch statement is > not supported in -source 6 > > -- Jon > > On 11/28/2017 06:19 AM, Maurizio Cimadamore wrote: >> Updated webrev here: >> >> http://cr.openjdk.java.net/~mcimadamore/8189749-v2/ >> >> I've included a report of the diagnostics that have been tweaked by >> this webrev here to make sure that singular vs. plural is used >> effectively: >> >> http://cr.openjdk.java.net/~mcimadamore/8189749-v2/diags.html >> >> Cheers >> Maurizio >> >> >> On 20/10/17 19:07, Maurizio Cimadamore wrote: >>> Hi, >>> this biggie patch allows the treatment of source level checks to be >>> more uniform. The general problem is explained in details here: >>> >>> https://bugs.openjdk.java.net/browse/JDK-8189749 >>> >>> Webrev is here: >>> >>> http://cr.openjdk.java.net/~mcimadamore/8189749/ >>> >>> The way I approached this, was to create a first class entity, an >>> enum called Feature. Each 'feature' has: >>> >>> * a min source level (e.g. what is the min source level required to >>> compile that feature, meaning that lower levels will result in errors) >>> * a max source level (e.g. what is the max source level required to >>> compile that feature, meaning that higher levels will result in errors) >>> * an optional resource key >>> >>> The first two properties are obviously used to decided if feature >>> XYZ can be used given source level N. The last property is used to >>> automate generation of source check diagnostics. Note that this >>> patch introduce a _single_ source check diagnostic: >>> >>> # 0: message segment (feature), 1: string (found version), 2: string >>> (expected version) >>> compiler.misc.feature.not.supported.in.source=\ >>> ?? {0} not supported in -source {1}\n\ >>> ??? (use -source {2} or higher to enable {0}) >>> >>> And then there's a bunch of feature fragments, example: >>> >>> compiler.misc.feature.modules=\ >>> ??? modules >>> >>> compiler.misc.feature.diamond.and.anon.class=\ >>> ??? ''<>'' with anonymous inner classes >>> >>> compiler.misc.feature.binary.lit=\ >>> ??? binary literals >>> >>> (and many more :-)) >>> >>> Since each feature 'knows' its fragment, it is super easy for the >>> compiler to generate the source level check diagnostic for any >>> feature. And, if you need to add a new feature, you just need to add >>> an enum value, and wired it up with the corresponding resource key - >>> done :-) >>> >>> Since this change affects the way in which source check diagnostics >>> are generated, quite a lot of changes were required to adjust >>> expected output in golden files. Aside from those changes, I also >>> addressed the following issues: >>> >>> * JavaTokenizer was not using SOURCE_LEVEL flags for its >>> diagnostics, and it was not using the new diagnostic framework to >>> generate errors, which made the porting harder - so I've fixed that >>> * CALog in Completeness analyzer required a new override for an >>> AbstractLog::error variant that was probably forgotten (this was >>> required otherwise CompletenessAnalyzerTest was failing after the >>> change above) >>> * Log has a 'feature' so that diagnostics marked with the >>> SOURCE_LEVEL flag can be reported only once per source. But this >>> check was only looking at the 'head' of a diagnostic, ignoring all >>> arguments. Since now all source level check diagnostics share the >>> same head, I needed to tweak the logic to also compare arguments - >>> or else, one source level check error being reported would also >>> disable unrelated source level check diags. >>> >>> Then there were a bunch of mechanical translation, for instance >>> idioms such as: >>> >>> allowSimplifiedVarargs = source.allowSimplifiedVarargs(); >>> >>> Were rewritten as: >>> >>> allowSimplifiedVarargs = source.allowed(Feature.SIMPLIFIED_VARARGS); >>> >>> Also, in JavacParser, this idiom: >>> >>> checkTypeAnnotations(); >>> >>> has been replaced with >>> >>> checkSourceLevel(Feature.TYPE_ANNOTATIONS); >>> >>> Where checkSourceLevel is a new general routine that works on any >>> Feature. >>> >>> Finally, where possible, I also got rid of the various boolean flags >>> of the kind 'allowPrivateMethodInInterfaces' - if the class already >>> had a 'source' field, the boolean flag can be omitted, and the check >>> can be performed on the source object itself. >>> >>> Cheers >>> Maurizio >>> >>> >>> >> > From jonathan.gibbons at oracle.com Mon Dec 4 17:15:34 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Mon, 4 Dec 2017 09:15:34 -0800 Subject: RFR 8189749: Devise strategy for making source level checks more uniform In-Reply-To: References: <0d223e68-de26-1e59-adad-1f57c9d28762@oracle.com> <5A21F3F2.2060609@oracle.com> Message-ID: <2157ce58-237e-4698-50c7-79bd4fa79b3e@oracle.com> Yes, that was my expectation. -- Jon On 12/4/17 4:22 AM, Maurizio Cimadamore wrote: > Thanks, > I will make the change ahead of the push (w/o submitting another > round) if that's ok > > Maurizio > > > On 02/12/17 00:29, Jonathan Gibbons wrote: >> +1. Very nice. >> >> Nit: I would suggest changing multi-catch statements to the plural form. >> >> tests/MulticatchNotSupported.java:39: error: multi-catch statement is >> not supported in -source 6 >> >> -- Jon >> >> On 11/28/2017 06:19 AM, Maurizio Cimadamore wrote: >>> Updated webrev here: >>> >>> http://cr.openjdk.java.net/~mcimadamore/8189749-v2/ >>> >>> I've included a report of the diagnostics that have been tweaked by >>> this webrev here to make sure that singular vs. plural is used >>> effectively: >>> >>> http://cr.openjdk.java.net/~mcimadamore/8189749-v2/diags.html >>> >>> Cheers >>> Maurizio >>> >>> >>> On 20/10/17 19:07, Maurizio Cimadamore wrote: >>>> Hi, >>>> this biggie patch allows the treatment of source level checks to be >>>> more uniform. The general problem is explained in details here: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8189749 >>>> >>>> Webrev is here: >>>> >>>> http://cr.openjdk.java.net/~mcimadamore/8189749/ >>>> >>>> The way I approached this, was to create a first class entity, an >>>> enum called Feature. Each 'feature' has: >>>> >>>> * a min source level (e.g. what is the min source level required to >>>> compile that feature, meaning that lower levels will result in errors) >>>> * a max source level (e.g. what is the max source level required to >>>> compile that feature, meaning that higher levels will result in >>>> errors) >>>> * an optional resource key >>>> >>>> The first two properties are obviously used to decided if feature >>>> XYZ can be used given source level N. The last property is used to >>>> automate generation of source check diagnostics. Note that this >>>> patch introduce a _single_ source check diagnostic: >>>> >>>> # 0: message segment (feature), 1: string (found version), 2: >>>> string (expected version) >>>> compiler.misc.feature.not.supported.in.source=\ >>>> ?? {0} not supported in -source {1}\n\ >>>> ??? (use -source {2} or higher to enable {0}) >>>> >>>> And then there's a bunch of feature fragments, example: >>>> >>>> compiler.misc.feature.modules=\ >>>> ??? modules >>>> >>>> compiler.misc.feature.diamond.and.anon.class=\ >>>> ??? ''<>'' with anonymous inner classes >>>> >>>> compiler.misc.feature.binary.lit=\ >>>> ??? binary literals >>>> >>>> (and many more :-)) >>>> >>>> Since each feature 'knows' its fragment, it is super easy for the >>>> compiler to generate the source level check diagnostic for any >>>> feature. And, if you need to add a new feature, you just need to >>>> add an enum value, and wired it up with the corresponding resource >>>> key - done :-) >>>> >>>> Since this change affects the way in which source check diagnostics >>>> are generated, quite a lot of changes were required to adjust >>>> expected output in golden files. Aside from those changes, I also >>>> addressed the following issues: >>>> >>>> * JavaTokenizer was not using SOURCE_LEVEL flags for its >>>> diagnostics, and it was not using the new diagnostic framework to >>>> generate errors, which made the porting harder - so I've fixed that >>>> * CALog in Completeness analyzer required a new override for an >>>> AbstractLog::error variant that was probably forgotten (this was >>>> required otherwise CompletenessAnalyzerTest was failing after the >>>> change above) >>>> * Log has a 'feature' so that diagnostics marked with the >>>> SOURCE_LEVEL flag can be reported only once per source. But this >>>> check was only looking at the 'head' of a diagnostic, ignoring all >>>> arguments. Since now all source level check diagnostics share the >>>> same head, I needed to tweak the logic to also compare arguments - >>>> or else, one source level check error being reported would also >>>> disable unrelated source level check diags. >>>> >>>> Then there were a bunch of mechanical translation, for instance >>>> idioms such as: >>>> >>>> allowSimplifiedVarargs = source.allowSimplifiedVarargs(); >>>> >>>> Were rewritten as: >>>> >>>> allowSimplifiedVarargs = source.allowed(Feature.SIMPLIFIED_VARARGS); >>>> >>>> Also, in JavacParser, this idiom: >>>> >>>> checkTypeAnnotations(); >>>> >>>> has been replaced with >>>> >>>> checkSourceLevel(Feature.TYPE_ANNOTATIONS); >>>> >>>> Where checkSourceLevel is a new general routine that works on any >>>> Feature. >>>> >>>> Finally, where possible, I also got rid of the various boolean >>>> flags of the kind 'allowPrivateMethodInInterfaces' - if the class >>>> already had a 'source' field, the boolean flag can be omitted, and >>>> the check can be performed on the source object itself. >>>> >>>> Cheers >>>> Maurizio >>>> >>>> >>>> >>> >> > From maurizio.cimadamore at oracle.com Mon Dec 4 18:04:30 2017 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Mon, 4 Dec 2017 18:04:30 +0000 Subject: RFR 8189749: Devise strategy for making source level checks more uniform In-Reply-To: <2157ce58-237e-4698-50c7-79bd4fa79b3e@oracle.com> References: <0d223e68-de26-1e59-adad-1f57c9d28762@oracle.com> <5A21F3F2.2060609@oracle.com> <2157ce58-237e-4698-50c7-79bd4fa79b3e@oracle.com> Message-ID: Thanks - fixed and pushed! Maurizio On 04/12/17 17:15, Jonathan Gibbons wrote: > Yes, that was my expectation. > > -- Jon > > > On 12/4/17 4:22 AM, Maurizio Cimadamore wrote: >> Thanks, >> I will make the change ahead of the push (w/o submitting another >> round) if that's ok >> >> Maurizio >> >> >> On 02/12/17 00:29, Jonathan Gibbons wrote: >>> +1. Very nice. >>> >>> Nit: I would suggest changing multi-catch statements to the plural >>> form. >>> >>> tests/MulticatchNotSupported.java:39: error: multi-catch statement >>> is not supported in -source 6 >>> >>> -- Jon >>> >>> On 11/28/2017 06:19 AM, Maurizio Cimadamore wrote: >>>> Updated webrev here: >>>> >>>> http://cr.openjdk.java.net/~mcimadamore/8189749-v2/ >>>> >>>> I've included a report of the diagnostics that have been tweaked by >>>> this webrev here to make sure that singular vs. plural is used >>>> effectively: >>>> >>>> http://cr.openjdk.java.net/~mcimadamore/8189749-v2/diags.html >>>> >>>> Cheers >>>> Maurizio >>>> >>>> >>>> On 20/10/17 19:07, Maurizio Cimadamore wrote: >>>>> Hi, >>>>> this biggie patch allows the treatment of source level checks to >>>>> be more uniform. The general problem is explained in details here: >>>>> >>>>> https://bugs.openjdk.java.net/browse/JDK-8189749 >>>>> >>>>> Webrev is here: >>>>> >>>>> http://cr.openjdk.java.net/~mcimadamore/8189749/ >>>>> >>>>> The way I approached this, was to create a first class entity, an >>>>> enum called Feature. Each 'feature' has: >>>>> >>>>> * a min source level (e.g. what is the min source level required >>>>> to compile that feature, meaning that lower levels will result in >>>>> errors) >>>>> * a max source level (e.g. what is the max source level required >>>>> to compile that feature, meaning that higher levels will result in >>>>> errors) >>>>> * an optional resource key >>>>> >>>>> The first two properties are obviously used to decided if feature >>>>> XYZ can be used given source level N. The last property is used to >>>>> automate generation of source check diagnostics. Note that this >>>>> patch introduce a _single_ source check diagnostic: >>>>> >>>>> # 0: message segment (feature), 1: string (found version), 2: >>>>> string (expected version) >>>>> compiler.misc.feature.not.supported.in.source=\ >>>>> ?? {0} not supported in -source {1}\n\ >>>>> ??? (use -source {2} or higher to enable {0}) >>>>> >>>>> And then there's a bunch of feature fragments, example: >>>>> >>>>> compiler.misc.feature.modules=\ >>>>> ??? modules >>>>> >>>>> compiler.misc.feature.diamond.and.anon.class=\ >>>>> ??? ''<>'' with anonymous inner classes >>>>> >>>>> compiler.misc.feature.binary.lit=\ >>>>> ??? binary literals >>>>> >>>>> (and many more :-)) >>>>> >>>>> Since each feature 'knows' its fragment, it is super easy for the >>>>> compiler to generate the source level check diagnostic for any >>>>> feature. And, if you need to add a new feature, you just need to >>>>> add an enum value, and wired it up with the corresponding resource >>>>> key - done :-) >>>>> >>>>> Since this change affects the way in which source check >>>>> diagnostics are generated, quite a lot of changes were required to >>>>> adjust expected output in golden files. Aside from those changes, >>>>> I also addressed the following issues: >>>>> >>>>> * JavaTokenizer was not using SOURCE_LEVEL flags for its >>>>> diagnostics, and it was not using the new diagnostic framework to >>>>> generate errors, which made the porting harder - so I've fixed that >>>>> * CALog in Completeness analyzer required a new override for an >>>>> AbstractLog::error variant that was probably forgotten (this was >>>>> required otherwise CompletenessAnalyzerTest was failing after the >>>>> change above) >>>>> * Log has a 'feature' so that diagnostics marked with the >>>>> SOURCE_LEVEL flag can be reported only once per source. But this >>>>> check was only looking at the 'head' of a diagnostic, ignoring all >>>>> arguments. Since now all source level check diagnostics share the >>>>> same head, I needed to tweak the logic to also compare arguments - >>>>> or else, one source level check error being reported would also >>>>> disable unrelated source level check diags. >>>>> >>>>> Then there were a bunch of mechanical translation, for instance >>>>> idioms such as: >>>>> >>>>> allowSimplifiedVarargs = source.allowSimplifiedVarargs(); >>>>> >>>>> Were rewritten as: >>>>> >>>>> allowSimplifiedVarargs = source.allowed(Feature.SIMPLIFIED_VARARGS); >>>>> >>>>> Also, in JavacParser, this idiom: >>>>> >>>>> checkTypeAnnotations(); >>>>> >>>>> has been replaced with >>>>> >>>>> checkSourceLevel(Feature.TYPE_ANNOTATIONS); >>>>> >>>>> Where checkSourceLevel is a new general routine that works on any >>>>> Feature. >>>>> >>>>> Finally, where possible, I also got rid of the various boolean >>>>> flags of the kind 'allowPrivateMethodInInterfaces' - if the class >>>>> already had a 'source' field, the boolean flag can be omitted, and >>>>> the check can be performed on the source object itself. >>>>> >>>>> Cheers >>>>> Maurizio >>>>> >>>>> >>>>> >>>> >>> >> > From cushon at google.com Mon Dec 4 21:37:37 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Mon, 4 Dec 2017 13:37:37 -0800 Subject: RFR 8189708: class reading issue with named and annotated parameters In-Reply-To: References: <59E9A5B5.5060200@oracle.com> Message-ID: Hi, is there any more feedback on this? On Fri, Oct 20, 2017 at 5:51 PM, Liam Miller-Cushon wrote: > Here's an updated patch that incorporates your approach: > http://cr.openjdk.java.net/~cushon/8007720/webrev.01/ > > I included the fix for JDK-8177486 so I could test the inner class / enum > constructor case. If this looks like it's on the right track I'll move that > part (and the corresponding tests) back into a separate change. > > On Fri, Oct 20, 2017 at 9:30 AM, Liam Miller-Cushon > wrote: > >> Thanks for the comments, >> >> On Fri, Oct 20, 2017 at 12:28 AM, Jan Lahoda >> wrote: >>> >>> -what happens if there are both runtime invisible and visible >>> annotations of method's parameters? Seems those that appear later will >>> overwrite those that appear sooner? >>> >> >> Oops, thanks. The way your patch handles that looks good to me. >> >> >>> -the MethodSymbol.savedParameterAnnotations is only used during reading >>> inside the ClassReader, right? It seems wasteful to have it as a field on >>> each MethodSymbol, better would be a field in ClassReader. >>> >> >> Sounds good. I'll try to avoid having savedParameterNames as a field in >> MethodSymbol also. Do you remember if you encountered any issues with that >> in your patch? >> >> >>> -please check what happens for annotations on constructors of >>> enums/non-static innerclasses >>> >> >> Will do. (Also, note that there appears to be an issue with reading >> MethodParameters on constructors of enums/non-static inner classes: >> JDK-8177486) >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cushon at google.com Tue Dec 5 23:39:18 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Tue, 5 Dec 2017 15:39:18 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? Message-ID: I have a question about the logic in JavacProcessingEnvironment's treeCleaner that resets package-info state between annotation processing rounds [1]. JDK-8193037 describes an issue where package-infos loaded from the classpath are reset by treeCleaner. Those symbols doesn't get reinitialized correctly, and package annotations are not visible during subsequent annotation processing rounds. I wondered if the logic was only meant to apply to package-infos being compiled from source in the current compilation (similar to how module-infos are handle by treeCleaner), but I'm having trouble understanding when that logic is necessary. Commenting out `node.packge.package_info.reset();` and `node.packge.reset();` in treeCleaner doesn't break any jtreg tests. Does anyone have examples where that code is needed? I'd like to add a regression test to ensure the fix for JDK-8193037 doesn't interfere with the original purpose of that code. Thanks, [1] http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#l1518 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.gibbons at oracle.com Wed Dec 6 00:46:35 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Tue, 05 Dec 2017 16:46:35 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: References: Message-ID: <5A273DEB.5060402@oracle.com> Liam, What about the case where an annotation processor generates the package-info.java file? Is that a case where it is important to reinit the packge symbol correctly, so that the newly generated code is read? -- Jon On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: > I have a question about the logic in JavacProcessingEnvironment's > treeCleaner that resets package-info state between annotation > processing rounds [1]. > > JDK-8193037 describes an issue where package-infos loaded from the > classpath are reset by treeCleaner. Those symbols doesn't get > reinitialized correctly, and package annotations are not visible > during subsequent annotation processing rounds. > > I wondered if the logic was only meant to apply to package-infos being > compiled from source in the current compilation (similar to how > module-infos are handle by treeCleaner), but I'm having trouble > understanding when that logic is necessary. Commenting out > `node.packge.package_info.reset();` and `node.packge.reset();` in > treeCleaner doesn't break any jtreg tests. Does anyone have examples > where that code is needed? I'd like to add a regression test to ensure > the fix for JDK-8193037 doesn't interfere with the original purpose of > that code. > > Thanks, > > [1] > http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#l1518 From cushon at google.com Wed Dec 6 01:39:43 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Tue, 5 Dec 2017 17:39:43 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: <5A273DEB.5060402@oracle.com> References: <5A273DEB.5060402@oracle.com> Message-ID: Thanks! If an annotated package-info is loaded from the class path, and then a processor generates a package-info that contains no annotations, the reset is necessary. (The reset isn't necessary if the new package-info is annotated, since the old annotations get overwritten even if they weren't reset between rounds.) On Tue, Dec 5, 2017 at 4:46 PM, Jonathan Gibbons < jonathan.gibbons at oracle.com> wrote: > Liam, > > What about the case where an annotation processor generates the > package-info.java file? Is that a case where it is important to reinit the > packge symbol correctly, so that the newly generated code is read? > > -- Jon > > > On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: > >> I have a question about the logic in JavacProcessingEnvironment's >> treeCleaner that resets package-info state between annotation processing >> rounds [1]. >> >> JDK-8193037 describes an issue where package-infos loaded from the >> classpath are reset by treeCleaner. Those symbols doesn't get reinitialized >> correctly, and package annotations are not visible during subsequent >> annotation processing rounds. >> >> I wondered if the logic was only meant to apply to package-infos being >> compiled from source in the current compilation (similar to how >> module-infos are handle by treeCleaner), but I'm having trouble >> understanding when that logic is necessary. Commenting out >> `node.packge.package_info.reset();` and `node.packge.reset();` in >> treeCleaner doesn't break any jtreg tests. Does anyone have examples where >> that code is needed? I'd like to add a regression test to ensure the fix >> for JDK-8193037 doesn't interfere with the original purpose of that code. >> >> Thanks, >> >> [1] http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk >> .compiler/share/classes/com/sun/tools/javac/processing/Jav >> acProcessingEnvironment.java#l1518 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cushon at google.com Wed Dec 6 01:49:22 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Tue, 5 Dec 2017 17:49:22 -0800 Subject: RFR: 8193037 package-info annotations are not reported when annotation processing is enabled Message-ID: Hello, Please review the following fix for JDK-8193037. javac should only reset package-info symbols between annotation processing rounds if the package-info is being compiled from source. Previously package-infos loaded from the classpath were reset and not reinitialized, leading to package annotations being unavailable during later annotation processing rounds. I included an additional test case to ensure that package-infos are still reset when necessary. Related discussion: http://mail.openjdk.java.net/pipermail/compiler-dev/2017-December/011398.html bug: https://bugs.openjdk.java.net/browse/JDK-8193037 webrev: http://cr.openjdk.java.net/~cushon/8193037/webrev.00/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.gibbons at oracle.com Wed Dec 6 02:09:10 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Tue, 05 Dec 2017 18:09:10 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: References: <5A273DEB.5060402@oracle.com> Message-ID: <5A275146.3080903@oracle.com> Generally, annotation processing is supposed to only create information where there was no information previously, so if a package had a package-info with annotations, it seems like it should be an error to override it with another package-info, with or without annotations. -- Jon On 12/05/2017 05:39 PM, Liam Miller-Cushon wrote: > Thanks! If an annotated package-info is loaded from the class path, > and then a processor generates a package-info that contains no > annotations, the reset is necessary. (The reset isn't necessary if the > new package-info is annotated, since the old annotations get > overwritten even if they weren't reset between rounds.) > > On Tue, Dec 5, 2017 at 4:46 PM, Jonathan Gibbons > > wrote: > > Liam, > > What about the case where an annotation processor generates the > package-info.java file? Is that a case where it is important to > reinit the packge symbol correctly, so that the newly generated > code is read? > > -- Jon > > > On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: > > I have a question about the logic in > JavacProcessingEnvironment's treeCleaner that resets > package-info state between annotation processing rounds [1]. > > JDK-8193037 describes an issue where package-infos loaded from > the classpath are reset by treeCleaner. Those symbols doesn't > get reinitialized correctly, and package annotations are not > visible during subsequent annotation processing rounds. > > I wondered if the logic was only meant to apply to > package-infos being compiled from source in the current > compilation (similar to how module-infos are handle by > treeCleaner), but I'm having trouble understanding when that > logic is necessary. Commenting out > `node.packge.package_info.reset();` and `node.packge.reset();` > in treeCleaner doesn't break any jtreg tests. Does anyone have > examples where that code is needed? I'd like to add a > regression test to ensure the fix for JDK-8193037 doesn't > interfere with the original purpose of that code. > > Thanks, > > [1] > http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#l1518 > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cushon at google.com Wed Dec 6 02:24:36 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Tue, 5 Dec 2017 18:24:36 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: <5A275146.3080903@oracle.com> References: <5A273DEB.5060402@oracle.com> <5A275146.3080903@oracle.com> Message-ID: Is overriding package-infos different or worse than overriding other symbols? I've seen a number of examples where the same source file was compiled multiple times and the earlier results ended up on the class path of the later compilations, so a processor-generated class was both on the class path and generated during the compilation. Making that an error would be a somewhat invasive breaking change. I agree that it should be discouraged, but I'm not sure it's worth making an error? (Unless there's something special about package-infos that I'm missing.) On Tue, Dec 5, 2017 at 6:09 PM, Jonathan Gibbons < jonathan.gibbons at oracle.com> wrote: > Generally, annotation processing is supposed to only create information > where there was no information previously, so if a package had a > package-info with annotations, it seems like it should be an error to > override it with another package-info, with or without annotations. > > -- Jon > > > On 12/05/2017 05:39 PM, Liam Miller-Cushon wrote: > > Thanks! If an annotated package-info is loaded from the class path, and > then a processor generates a package-info that contains no annotations, the > reset is necessary. (The reset isn't necessary if the new package-info is > annotated, since the old annotations get overwritten even if they weren't > reset between rounds.) > > On Tue, Dec 5, 2017 at 4:46 PM, Jonathan Gibbons < > jonathan.gibbons at oracle.com> wrote: > >> Liam, >> >> What about the case where an annotation processor generates the >> package-info.java file? Is that a case where it is important to reinit the >> packge symbol correctly, so that the newly generated code is read? >> >> -- Jon >> >> >> On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: >> >>> I have a question about the logic in JavacProcessingEnvironment's >>> treeCleaner that resets package-info state between annotation processing >>> rounds [1]. >>> >>> JDK-8193037 describes an issue where package-infos loaded from the >>> classpath are reset by treeCleaner. Those symbols doesn't get reinitialized >>> correctly, and package annotations are not visible during subsequent >>> annotation processing rounds. >>> >>> I wondered if the logic was only meant to apply to package-infos being >>> compiled from source in the current compilation (similar to how >>> module-infos are handle by treeCleaner), but I'm having trouble >>> understanding when that logic is necessary. Commenting out >>> `node.packge.package_info.reset();` and `node.packge.reset();` in >>> treeCleaner doesn't break any jtreg tests. Does anyone have examples where >>> that code is needed? I'd like to add a regression test to ensure the fix >>> for JDK-8193037 doesn't interfere with the original purpose of that code. >>> >>> Thanks, >>> >>> [1] http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk >>> .compiler/share/classes/com/sun/tools/javac/processing/Javac >>> ProcessingEnvironment.java#l1518 >>> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonathan.gibbons at oracle.com Wed Dec 6 07:48:14 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Tue, 5 Dec 2017 23:48:14 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: References: <5A273DEB.5060402@oracle.com> <5A275146.3080903@oracle.com> Message-ID: <7c9034fd-c538-44a0-95b6-c0b91ee71f43@oracle.com> We'll need Joe "Mr Annotation Processing" Darcy to chime in here, but the Filer is supposed to detect clashes, and prevent overwriting/overriding symbols. That's definitely supposed to happen for normal classes/interfaces; I could believe that package-info has been overlooked, but I would expect it to follow the same guidelines. -- Jon On 12/5/17 6:24 PM, Liam Miller-Cushon wrote: > Is overriding package-infos different or worse than overriding other > symbols? I've seen a number of examples where the same source file was > compiled multiple times and the earlier results ended up on the class > path of the later compilations, so a processor-generated class was > both on the class path and generated during the compilation. Making > that an error would be a somewhat invasive breaking change. I agree > that it should be discouraged, but I'm not sure it's worth making an > error? (Unless there's something special about package-infos that I'm > missing.) > > On Tue, Dec 5, 2017 at 6:09 PM, Jonathan Gibbons > > wrote: > > Generally, annotation processing is supposed to only create > information where there was no information previously,? so if a > package had a package-info with annotations, it seems like it > should be an error to override it with another package-info, with > or without annotations. > > -- Jon > > > On 12/05/2017 05:39 PM, Liam Miller-Cushon wrote: >> Thanks! If an annotated package-info is loaded from the class >> path, and then a processor generates a package-info that contains >> no annotations, the reset is necessary. (The reset isn't >> necessary if the new package-info is annotated, since the old >> annotations get overwritten even if they weren't reset between >> rounds.) >> >> On Tue, Dec 5, 2017 at 4:46 PM, Jonathan Gibbons >> > > wrote: >> >> Liam, >> >> What about the case where an annotation processor generates >> the package-info.java file? Is that a case where it is >> important to reinit the packge symbol correctly, so that the >> newly generated code is read? >> >> -- Jon >> >> >> On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: >> >> I have a question about the logic in >> JavacProcessingEnvironment's treeCleaner that resets >> package-info state between annotation processing rounds [1]. >> >> JDK-8193037 describes an issue where package-infos loaded >> from the classpath are reset by treeCleaner. Those >> symbols doesn't get reinitialized correctly, and package >> annotations are not visible during subsequent annotation >> processing rounds. >> >> I wondered if the logic was only meant to apply to >> package-infos being compiled from source in the current >> compilation (similar to how module-infos are handle by >> treeCleaner), but I'm having trouble understanding when >> that logic is necessary. Commenting out >> `node.packge.package_info.reset();` and >> `node.packge.reset();` in treeCleaner doesn't break any >> jtreg tests. Does anyone have examples where that code is >> needed? I'd like to add a regression test to ensure the >> fix for JDK-8193037 doesn't interfere with the original >> purpose of that code. >> >> Thanks, >> >> [1] >> http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#l1518 >> >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cushon at google.com Wed Dec 6 09:11:56 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Wed, 6 Dec 2017 01:11:56 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: <7c9034fd-c538-44a0-95b6-c0b91ee71f43@oracle.com> References: <5A273DEB.5060402@oracle.com> <5A275146.3080903@oracle.com> <7c9034fd-c538-44a0-95b6-c0b91ee71f43@oracle.com> Message-ID: I think the current implementation of Filer doesn't check if generated classes override arbitrary classes on the classpath, it only checks if they clash with previously generated classes, or the sources and classes that were explicit inputs to the compilation: http://hg.openjdk.java.net/jdk/jdk/file/a9405d9ca8a8/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java#l719 On Tue, Dec 5, 2017 at 11:48 PM, Jonathan Gibbons < jonathan.gibbons at oracle.com> wrote: > We'll need Joe "Mr Annotation Processing" Darcy to chime in here, but the > Filer is supposed to detect clashes, and prevent overwriting/overriding > symbols. That's definitely supposed to happen for normal > classes/interfaces; I could believe that package-info has been overlooked, > but I would expect it to follow the same guidelines. > > -- Jon > > On 12/5/17 6:24 PM, Liam Miller-Cushon wrote: > > Is overriding package-infos different or worse than overriding other > symbols? I've seen a number of examples where the same source file was > compiled multiple times and the earlier results ended up on the class path > of the later compilations, so a processor-generated class was both on the > class path and generated during the compilation. Making that an error would > be a somewhat invasive breaking change. I agree that it should be > discouraged, but I'm not sure it's worth making an error? (Unless there's > something special about package-infos that I'm missing.) > > On Tue, Dec 5, 2017 at 6:09 PM, Jonathan Gibbons < > jonathan.gibbons at oracle.com> wrote: > >> Generally, annotation processing is supposed to only create information >> where there was no information previously, so if a package had a >> package-info with annotations, it seems like it should be an error to >> override it with another package-info, with or without annotations. >> >> -- Jon >> >> >> On 12/05/2017 05:39 PM, Liam Miller-Cushon wrote: >> >> Thanks! If an annotated package-info is loaded from the class path, and >> then a processor generates a package-info that contains no annotations, the >> reset is necessary. (The reset isn't necessary if the new package-info is >> annotated, since the old annotations get overwritten even if they weren't >> reset between rounds.) >> >> On Tue, Dec 5, 2017 at 4:46 PM, Jonathan Gibbons < >> jonathan.gibbons at oracle.com> wrote: >> >>> Liam, >>> >>> What about the case where an annotation processor generates the >>> package-info.java file? Is that a case where it is important to reinit the >>> packge symbol correctly, so that the newly generated code is read? >>> >>> -- Jon >>> >>> >>> On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: >>> >>>> I have a question about the logic in JavacProcessingEnvironment's >>>> treeCleaner that resets package-info state between annotation processing >>>> rounds [1]. >>>> >>>> JDK-8193037 describes an issue where package-infos loaded from the >>>> classpath are reset by treeCleaner. Those symbols doesn't get reinitialized >>>> correctly, and package annotations are not visible during subsequent >>>> annotation processing rounds. >>>> >>>> I wondered if the logic was only meant to apply to package-infos being >>>> compiled from source in the current compilation (similar to how >>>> module-infos are handle by treeCleaner), but I'm having trouble >>>> understanding when that logic is necessary. Commenting out >>>> `node.packge.package_info.reset();` and `node.packge.reset();` in >>>> treeCleaner doesn't break any jtreg tests. Does anyone have examples where >>>> that code is needed? I'd like to add a regression test to ensure the fix >>>> for JDK-8193037 doesn't interfere with the original purpose of that code. >>>> >>>> Thanks, >>>> >>>> [1] http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk >>>> .compiler/share/classes/com/sun/tools/javac/processing/Javac >>>> ProcessingEnvironment.java#l1518 >>>> >>> >>> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.lahoda at oracle.com Wed Dec 6 21:11:58 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Wed, 6 Dec 2017 22:11:58 +0100 Subject: RFR: JDK-8189778: Jshell crash on tab for StringBuilder.append( In-Reply-To: <59FB10F5.4000407@oracle.com> References: <59F1AC72.4020202@oracle.com> <59F8A8E6.6030609@oracle.com> <59FB10F5.4000407@oracle.com> Message-ID: <5A285D1E.5090205@oracle.com> Hi, A webrev updated to the current state and with some further fixes is here: http://cr.openjdk.java.net/~jlahoda/8189778/webrev.02/ On 2.11.2017 13:35, Kumar Srinivasan wrote: > > Hi Jan, > > Generally it looks fine to me, a few nits... > > JavadocHelper.java > > 1. > > - //which will be resolve in visitInheritDoc: > suggest.... > + //which will be resolved in visitInheritDoc: Done. > > 2. Suggest adding a space after /** or /* makes it a little easier > to read the comments. Done. > > 3. > > - //insertPos (as future missing elements should be inserted behind > + //insertPos (as future missing elements should be inserted before The missing elements are inserted behind the tree that was visited by the method. > > 4. > - //if there is a newline immediatelly after this tree, insert after > + //if there is a newline immediately after this tree, insert after Done. Also changed "after" to "behind". > > 5. Several private methods have have javadoc comments /**, do you > run javadoc -private on jshell sources ? Changed to comments to /*. Any feedback is welcome! Thanks, Jan > > You may want to get Jon's review on this, he is much more familiar > with these things, than I. > > Thanks > Kumar > >> I've updated to patch to have some comments at places that seemed >> important: >> http://cr.openjdk.java.net/~jlahoda/8189778/webrev.01/ >> >> Jan >> >> On 26.10.2017 11:35, Jan Lahoda wrote: >>> Hi, >>> >>> Typing: >>> jshell> StringBuilder sb = new StringBuilder(); >>> jshell> sb.append( >>> >>> Will lead to an exception: >>> jshell> sb.append(Exception in thread "main" >>> java.lang.StringIndexOutOfBoundsException: start -59, end -59, length >>> 238 >>> [snip] >>> jdk.compiler/jdk.internal.shellsupport.doc.JavadocHelper$OnDemandJavadocHelper.getResolvedDocComment(JavadocHelper.java:481) >>> >>> >>> >>> The reason is that the javadoc for StringBuilder.append(CharSequence, >>> int, int) is: >>> /** >>> * @throws IndexOutOfBoundsException {@inheritDoc} >>> */ >>> >>> The JavadocHelper tries to fill in the missing javadoc entries, but that >>> fails because it tries to insert the preceding entries at an >>> uninitialized place. >>> >>> The proposed patch: >>> -fixes the above >>> -adds a test that runs the JavadocHelper on all >>> methods/fields/constructors of top-level types in all exported packages >>> (this runs for a considerable time, and we may need to disable this test >>> if it proves to be too heavyweight) >>> -adds a few more test cases for problems found by the above test >>> -fixes the javadoc resolution to treat missing javadoc body as >>> {@inheritDoc} (so that the overridden method's javadoc text is used if >>> missing in this method) >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8189778 >>> Webrev: http://cr.openjdk.java.net/~jlahoda/8189778/webrev.00/ >>> >>> Feedback is welcome. >>> >>> Thanks, >>> Jan > From goetz.lindenmaier at sap.com Thu Dec 7 11:20:40 2017 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Thu, 7 Dec 2017 11:20:40 +0000 Subject: FW: RFR(M): 8189102: All tools should support -?, -h and --help In-Reply-To: <8aa25976d496465fac00a4ae3628e533@sap.com> References: <8aa25976d496465fac00a4ae3628e533@sap.com> Message-ID: <456c694ec25a42658af1b8600aaa136d@sap.com> Hi, ... missed some lists in my first post ... I prepared a fifth webrev for this change. Please review. It incorporates the changes requested by the CSR reviewers (not to remove docuemtation of '-help' where is was documented before) and the changes proposed by Kumar: http://cr.openjdk.java.net/~goetz/wr17/8189102-helpMessage/webrev.05/ See also the information in the webrev itself, there are also patch files with the incremental builds. This change contains fixes for some langtool tests. I ran the following test suites on it: hotspot, jdk, langtools, nashorn, jaxp, most of them on all the platforms we build. Best regards, Goetz. > -----Original Message----- > From: Lindenmaier, Goetz > Sent: Mittwoch, 11. Oktober 2017 22:07 > To: hotspot-dev developers > Subject: RFR(M): 8189102: All tools should support -?, -h and --help > > Hi > > The tools in jdk should all show the same behavior wrt. help flags. > This change normalizes the help flags of a row of the tools in the jdk. > Java accepts -?, -h and --help, thus I changed the tools to support > these, too. Some tools exited with '1' after displaying the help message, > I turned this to '0'. > > Maybe this is not the right mailing list for this, please advise. > > Please review this change. I please need a sponsor. > http://cr.openjdk.java.net/~goetz/wr17/8189102-helpMessage/webrev.01/ > > In detail, this fixes the help message of the following tools: > jar -? -h --help; added -?. > jarsigner -? -h --help; added --help. -help accepted but not documented. > javac -? --help; added -?. Removed -help. -h is taken for other purpose > javadoc -? -h --help; added -h -?. Removed -help > javap -? -h --help; added -h. -help accepted but no more documented. > jcmd -? -h --help; added -? --help. -help accepted but no more > documented. Changed return value to '0' > jdb -? -h --help; added -? -h --help. -help accepted but no more > documented. > jdeprscan -? -h --help; added -? > jinfo -? -h --help; added -? --help. -help accepted but no more > documented. > jjs -h --help; Replaced -help by --help. Adding more not straight > forward. > jps -? -h --help; added -? --help. -help accepted but no more > documented. > jshell -? -h --help; added -? > jstat -? -h --help; added -h --help. -help accepted but no more > documented. > > Best regards, > Goetz. From joe.darcy at oracle.com Thu Dec 7 17:12:05 2017 From: joe.darcy at oracle.com (joe darcy) Date: Thu, 7 Dec 2017 09:12:05 -0800 Subject: JDK 10 RFR of JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10 Message-ID: Hello, Please review the straightforward patch below to update the JavacTestingAbstractProcessor utility superclass to JDK 10. JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10 Besides the use of Set.of, most of the updates are just bumping @SupportedSourceVersion annotation from 9 to 10. Thanks, -Joe diff -r 56d3576aadd5 test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java --- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Mon Dec 04 19:12:57 2017 +0100 +++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Thu Dec 07 09:04:27 2017 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,13 +31,7 @@ * An abstract annotation processor tailored to {@code javac} regression testing. */ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor { - private static final Set allAnnotations; - - static { - Set tmp = new HashSet<>(); - tmp.add("*"); - allAnnotations = Collections.unmodifiableSet(tmp); - } + private static final Set allAnnotations = Set.of("*"); protected Elements eltUtils; protected Elements elements; @@ -116,7 +110,7 @@ * corresponding platform visitor type. */ - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static abstract class AbstractAnnotationValueVisitor extends AbstractAnnotationValueVisitor9 { /** @@ -127,7 +121,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static abstract class AbstractElementVisitor extends AbstractElementVisitor9 { /** * Constructor for concrete subclasses to call. @@ -137,7 +131,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static abstract class AbstractTypeVisitor extends AbstractTypeVisitor9 { /** * Constructor for concrete subclasses to call. @@ -147,7 +141,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static class ElementKindVisitor extends ElementKindVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -168,7 +162,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static class ElementScanner extends ElementScanner9 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -187,7 +181,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static class SimpleAnnotationValueVisitor extends SimpleAnnotationValueVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -208,7 +202,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static class SimpleElementVisitor extends SimpleElementVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -229,7 +223,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static class SimpleTypeVisitor extends SimpleTypeVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -250,7 +244,7 @@ } } - @SupportedSourceVersion(RELEASE_9) + @SupportedSourceVersion(RELEASE_10) public static class TypeKindVisitor extends TypeKindVisitor9 { /** * Constructor for concrete subclasses to call; uses {@code null} From joe.darcy at oracle.com Thu Dec 7 17:29:10 2017 From: joe.darcy at oracle.com (joe darcy) Date: Thu, 7 Dec 2017 09:29:10 -0800 Subject: JDK 10 RFR of JDK-8193194: Update javax.lang.model.util visitors for 10 Message-ID: <83025f84-5fc1-4f27-3b02-dcb31e8e2639@oracle.com> Hello, The javax.lang.model API was introduced in JDK 6 via JSR 269. In JDK 7, 8, and 9 new sets of concrete visitors were added in the javax.lang.model.util package. In JDKs 7, 8, and 9, there were new language changes that required new modeling constructs. There are no such changes in JDK 10. Therefore, a new set of visitors will not be added for JDK 10. However, some minor updates to the JDK 9 visitors should be made to indicate they cover both JDK 9 and JDK 10 constructs. Please review the patch below which implements the updates. -Joe diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ /** * A skeletal visitor for annotation values with default behavior * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} - * source version. + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. * *

WARNING: The {@code AnnotationValueVisitor} interface * implemented by this class may have methods added to it in the @@ -59,7 +59,7 @@ * @see AbstractAnnotationValueVisitor8 * @since 9 */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public abstract class AbstractAnnotationValueVisitor9 extends AbstractAnnotationValueVisitor8 { /** diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -34,7 +34,7 @@ /** * A skeletal visitor of program elements with default behavior * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} - * source version. + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. * *

WARNING: The {@code ElementVisitor} interface * implemented by this class may have methods added to it in the @@ -65,7 +65,7 @@ * @since 9 * @spec JPMS */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public abstract class AbstractElementVisitor9 extends AbstractElementVisitor8 { /** * Constructor for concrete subclasses to call. diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,13 +27,13 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.type.*; - +import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; /** * A skeletal visitor of types with default behavior appropriate for - * the {@link javax.lang.model.SourceVersion#RELEASE_9 RELEASE_9} - * source version. + * the {@link SourceVersion#RELEASE_9 RELEASE_9} + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. * *

WARNING: The {@code TypeVisitor} interface implemented * by this class may have methods added to it in the future to @@ -63,7 +63,7 @@ * @see AbstractTypeVisitor8 * @since 9 */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public abstract class AbstractTypeVisitor9 extends AbstractTypeVisitor8 { /** * Constructor for concrete subclasses to call. diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -33,7 +33,8 @@ /** * A visitor of program elements based on their {@linkplain * ElementKind kind} with default behavior appropriate for the {@link - * SourceVersion#RELEASE_9 RELEASE_9} source version. For {@linkplain + * SourceVersion#RELEASE_9 RELEASE_9} and {@link + * SourceVersion#RELEASE_10 RELEASE_10} source versions. For {@linkplain * Element elements} Xyz that may have more than one * kind, the visitXyz methods in this class delegate * to the visitXyzAsKind method corresponding to the @@ -77,7 +78,7 @@ * @since 9 * @spec JPMS */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public class ElementKindVisitor9 extends ElementKindVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Thu Dec 07 09:28:13 2017 -0800 @@ -34,7 +34,8 @@ /** * A scanning visitor of program elements with default behavior * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} - * source version. The visitXyz methods in this + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. + * The visitXyz methods in this * class scan their component elements by calling {@code scan} on * their {@linkplain Element#getEnclosedElements enclosed elements}, * {@linkplain ExecutableElement#getParameters parameters}, etc., as @@ -90,7 +91,7 @@ * @since 9 * @spec JPMS */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public class ElementScanner9 extends ElementScanner8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,8 @@ /** * A simple visitor for annotation values with default behavior * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} - * source version. Visit methods call {@link #defaultAction + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. + * Visit methods call {@link #defaultAction * defaultAction} passing their arguments to {@code defaultAction}'s * corresponding parameters. * @@ -66,7 +67,7 @@ * @see SimpleAnnotationValueVisitor8 * @since 9 */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public class SimpleAnnotationValueVisitor9 extends SimpleAnnotationValueVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -33,7 +33,7 @@ /** * A simple visitor of program elements with default behavior * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} - * source version. + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. * * Visit methods corresponding to {@code RELEASE_9} and earlier * language constructs call {@link #defaultAction defaultAction}, @@ -73,7 +73,7 @@ * @since 9 * @spec JPMS */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public class SimpleElementVisitor9 extends SimpleElementVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -32,7 +32,8 @@ /** * A simple visitor of types with default behavior appropriate for the - * {@link SourceVersion#RELEASE_9 RELEASE_9} source version. + * {@link SourceVersion#RELEASE_9 RELEASE_9} and + * {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. * * Visit methods corresponding to {@code RELEASE_9} and earlier * language constructs call {@link #defaultAction defaultAction}, @@ -71,7 +72,7 @@ * @see SimpleTypeVisitor7 * @since 9 */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public class SimpleTypeVisitor9 extends SimpleTypeVisitor8 { /** * Constructor for concrete subclasses; uses {@code null} for the diff -r 56d3576aadd5 src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Mon Dec 04 19:12:57 2017 +0100 +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Thu Dec 07 09:28:13 2017 -0800 @@ -33,7 +33,8 @@ /** * A visitor of types based on their {@linkplain TypeKind kind} with * default behavior appropriate for the {@link SourceVersion#RELEASE_9 - * RELEASE_9} source version. For {@linkplain + * RELEASE_9} and {@link SourceVersion#RELEASE_10 RELEASE_10} source + * versions. For {@linkplain * TypeMirror types} Xyz that may have more than one * kind, the visitXyz methods in this class delegate * to the visitXyzAsKind method corresponding to the @@ -74,7 +75,7 @@ * @see TypeKindVisitor8 * @since 9 */ - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) public class TypeKindVisitor9 extends TypeKindVisitor8 { /** * Constructor for concrete subclasses to call; uses {@code null} From jonathan.gibbons at oracle.com Thu Dec 7 17:29:14 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Thu, 7 Dec 2017 09:29:14 -0800 Subject: JDK 10 RFR of JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10 In-Reply-To: References: Message-ID: +1 -- Jon On 12/7/17 9:12 AM, joe darcy wrote: > Hello, > > Please review the straightforward patch below to update the > JavacTestingAbstractProcessor utility superclass to JDK 10. > > ???? JDK-8193191: Update JavacTestingAbstractProcessor for JDK 10 > > Besides the use of Set.of, most of the updates are just bumping > @SupportedSourceVersion annotation from 9 to 10. > > Thanks, > > -Joe > > diff -r 56d3576aadd5 > test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java > --- > a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java > Thu Dec 07 09:04:27 2017 -0800 > @@ -1,5 +1,5 @@ > ?/* > - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights > reserved. > ? * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. > ? * > ? * This code is free software; you can redistribute it and/or modify it > @@ -31,13 +31,7 @@ > ? * An abstract annotation processor tailored to {@code javac} > regression testing. > ? */ > ?public abstract class JavacTestingAbstractProcessor extends > AbstractProcessor { > -??? private static final Set allAnnotations; > - > -??? static { > -??????? Set tmp = new HashSet<>(); > -??????? tmp.add("*"); > -??????? allAnnotations = Collections.unmodifiableSet(tmp); > -??? } > +??? private static final Set allAnnotations = Set.of("*"); > > ???? protected Elements eltUtils; > ???? protected Elements elements; > @@ -116,7 +110,7 @@ > ????? * corresponding platform visitor type. > ????? */ > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static abstract class AbstractAnnotationValueVisitor > extends AbstractAnnotationValueVisitor9 { > > ???????? /** > @@ -127,7 +121,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static abstract class AbstractElementVisitor extends > AbstractElementVisitor9 { > ???????? /** > ????????? * Constructor for concrete subclasses to call. > @@ -137,7 +131,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static abstract class AbstractTypeVisitor extends > AbstractTypeVisitor9 { > ???????? /** > ????????? * Constructor for concrete subclasses to call. > @@ -147,7 +141,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static class ElementKindVisitor extends > ElementKindVisitor9 { > ???????? /** > ????????? * Constructor for concrete subclasses; uses {@code null} for > the > @@ -168,7 +162,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static class ElementScanner extends > ElementScanner9 { > ???????? /** > ????????? * Constructor for concrete subclasses; uses {@code null} for > the > @@ -187,7 +181,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static class SimpleAnnotationValueVisitor extends > SimpleAnnotationValueVisitor9 { > ???????? /** > ????????? * Constructor for concrete subclasses; uses {@code null} for > the > @@ -208,7 +202,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static class SimpleElementVisitor extends > SimpleElementVisitor9 { > ???????? /** > ????????? * Constructor for concrete subclasses; uses {@code null} for > the > @@ -229,7 +223,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static class SimpleTypeVisitor extends > SimpleTypeVisitor9 { > ???????? /** > ????????? * Constructor for concrete subclasses; uses {@code null} for > the > @@ -250,7 +244,7 @@ > ???????? } > ???? } > > -??? @SupportedSourceVersion(RELEASE_9) > +??? @SupportedSourceVersion(RELEASE_10) > ???? public static class TypeKindVisitor extends > TypeKindVisitor9 { > ???????? /** > ????????? * Constructor for concrete subclasses to call; uses {@code > null} > From jonathan.gibbons at oracle.com Thu Dec 7 17:32:24 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Thu, 7 Dec 2017 09:32:24 -0800 Subject: JDK 10 RFR of JDK-8193194: Update javax.lang.model.util visitors for 10 In-Reply-To: <83025f84-5fc1-4f27-3b02-dcb31e8e2639@oracle.com> References: <83025f84-5fc1-4f27-3b02-dcb31e8e2639@oracle.com> Message-ID: +1 -- Jon On 12/7/17 9:29 AM, joe darcy wrote: > Hello, > > The javax.lang.model API was introduced in JDK 6 via JSR 269. In JDK > 7, 8, and 9 new sets of concrete visitors were added in the > javax.lang.model.util package. In JDKs 7, 8, and 9, there were new > language changes that required new modeling constructs. There are no > such changes in JDK 10. Therefore, a new set of visitors will not be > added for JDK 10. However, some minor updates to the JDK 9 visitors > should be made to indicate they cover both JDK 9 and JDK 10 constructs. > > Please review the patch below which implements the updates. > > -Joe > > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -1,5 +1,5 @@ > ?/* > - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights > reserved. > ? * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. > ? * > ? * This code is free software; you can redistribute it and/or modify it > @@ -32,7 +32,7 @@ > ?/** > ? * A skeletal visitor for annotation values with default behavior > ? * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} > - * source version. > + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. > ? * > ? *

WARNING: The {@code AnnotationValueVisitor} interface > ? * implemented by this class may have methods added to it in the > @@ -59,7 +59,7 @@ > ? * @see AbstractAnnotationValueVisitor8 > ? * @since 9 > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public abstract class AbstractAnnotationValueVisitor9 extends > AbstractAnnotationValueVisitor8 { > > ???? /** > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -34,7 +34,7 @@ > ?/** > ? * A skeletal visitor of program elements with default behavior > ? * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} > - * source version. > + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. > ? * > ? *

WARNING: The {@code ElementVisitor} interface > ? * implemented by this class may have methods added to it in the > @@ -65,7 +65,7 @@ > ? * @since 9 > ? * @spec JPMS > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public abstract class AbstractElementVisitor9 extends > AbstractElementVisitor8 { > ???? /** > ????? * Constructor for concrete subclasses to call. > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -1,5 +1,5 @@ > ?/* > - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights > reserved. > ? * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. > ? * > ? * This code is free software; you can redistribute it and/or modify it > @@ -27,13 +27,13 @@ > > ?import javax.annotation.processing.SupportedSourceVersion; > ?import javax.lang.model.type.*; > - > +import javax.lang.model.SourceVersion; > ?import static javax.lang.model.SourceVersion.*; > > ?/** > ? * A skeletal visitor of types with default behavior appropriate for > - * the {@link javax.lang.model.SourceVersion#RELEASE_9 RELEASE_9} > - * source version. > + * the {@link SourceVersion#RELEASE_9 RELEASE_9} > + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. > ? * > ? *

WARNING: The {@code TypeVisitor} interface implemented > ? * by this class may have methods added to it in the future to > @@ -63,7 +63,7 @@ > ? * @see AbstractTypeVisitor8 > ? * @since 9 > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public abstract class AbstractTypeVisitor9 extends > AbstractTypeVisitor8 { > ???? /** > ????? * Constructor for concrete subclasses to call. > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -33,7 +33,8 @@ > ?/** > ? * A visitor of program elements based on their {@linkplain > ? * ElementKind kind} with default behavior appropriate for the {@link > - * SourceVersion#RELEASE_9 RELEASE_9} source version.? For {@linkplain > + * SourceVersion#RELEASE_9 RELEASE_9} and {@link > + * SourceVersion#RELEASE_10 RELEASE_10} source versions. For {@linkplain > ? * Element elements} Xyz that may have more than one > ? * kind, the visitXyz methods in this class delegate > ? * to the visitXyzAsKind method > corresponding to the > @@ -77,7 +78,7 @@ > ? * @since 9 > ? * @spec JPMS > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public class ElementKindVisitor9 extends ElementKindVisitor8 P> { > ???? /** > ????? * Constructor for concrete subclasses; uses {@code null} for the > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -34,7 +34,8 @@ > ?/** > ? * A scanning visitor of program elements with default behavior > ? * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} > - * source version.? The visitXyz methods in this > + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. > + * The visitXyz methods in this > ? * class scan their component elements by calling {@code scan} on > ? * their {@linkplain Element#getEnclosedElements enclosed elements}, > ? * {@linkplain ExecutableElement#getParameters parameters}, etc., as > @@ -90,7 +91,7 @@ > ? * @since 9 > ? * @spec JPMS > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public class ElementScanner9 extends ElementScanner8 { > ???? /** > ????? * Constructor for concrete subclasses; uses {@code null} for the > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -1,5 +1,5 @@ > ?/* > - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights > reserved. > ? * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. > ? * > ? * This code is free software; you can redistribute it and/or modify it > @@ -32,7 +32,8 @@ > ?/** > ? * A simple visitor for annotation values with default behavior > ? * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} > - * source version.? Visit methods call {@link #defaultAction > + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. > + * Visit methods call {@link #defaultAction > ? * defaultAction} passing their arguments to {@code defaultAction}'s > ? * corresponding parameters. > ? * > @@ -66,7 +67,7 @@ > ? * @see SimpleAnnotationValueVisitor8 > ? * @since 9 > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public class SimpleAnnotationValueVisitor9 extends > SimpleAnnotationValueVisitor8 { > ???? /** > ????? * Constructor for concrete subclasses; uses {@code null} for the > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -33,7 +33,7 @@ > ?/** > ? * A simple visitor of program elements with default behavior > ? * appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9} > - * source version. > + * and {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. > ? * > ? * Visit methods corresponding to {@code RELEASE_9} and earlier > ? * language constructs call {@link #defaultAction defaultAction}, > @@ -73,7 +73,7 @@ > ? * @since 9 > ? * @spec JPMS > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public class SimpleElementVisitor9 extends > SimpleElementVisitor8 { > ???? /** > ????? * Constructor for concrete subclasses; uses {@code null} for the > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -32,7 +32,8 @@ > > ?/** > ? * A simple visitor of types with default behavior appropriate for the > - * {@link SourceVersion#RELEASE_9 RELEASE_9} source version. > + * {@link SourceVersion#RELEASE_9 RELEASE_9} and > + * {@link SourceVersion#RELEASE_10 RELEASE_10} source versions. > ? * > ? * Visit methods corresponding to {@code RELEASE_9} and earlier > ? * language constructs call {@link #defaultAction defaultAction}, > @@ -71,7 +72,7 @@ > ? * @see SimpleTypeVisitor7 > ? * @since 9 > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public class SimpleTypeVisitor9 extends SimpleTypeVisitor8 { > ???? /** > ????? * Constructor for concrete subclasses; uses {@code null} for the > diff -r 56d3576aadd5 > src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java > --- > a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java > Mon Dec 04 19:12:57 2017 +0100 > +++ > b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java > Thu Dec 07 09:28:13 2017 -0800 > @@ -33,7 +33,8 @@ > ?/** > ? * A visitor of types based on their {@linkplain TypeKind kind} with > ? * default behavior appropriate for the {@link SourceVersion#RELEASE_9 > - * RELEASE_9} source version.? For {@linkplain > + * RELEASE_9} and {@link SourceVersion#RELEASE_10 RELEASE_10} source > + * versions. For {@linkplain > ? * TypeMirror types} Xyz that may have more than one > ? * kind, the visitXyz methods in this class delegate > ? * to the visitXyzAsKind method > corresponding to the > @@ -74,7 +75,7 @@ > ? * @see TypeKindVisitor8 > ? * @since 9 > ? */ > - at SupportedSourceVersion(RELEASE_9) > + at SupportedSourceVersion(RELEASE_10) > ?public class TypeKindVisitor9 extends TypeKindVisitor8 { > ???? /** > ????? * Constructor for concrete subclasses to call; uses {@code null} > From cushon at google.com Thu Dec 7 21:29:20 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Thu, 7 Dec 2017 13:29:20 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: References: <5A273DEB.5060402@oracle.com> <5A275146.3080903@oracle.com> <7c9034fd-c538-44a0-95b6-c0b91ee71f43@oracle.com> Message-ID: The TODO in checkNameAndExistence seems relevant here. Implementing proc.type.already.exists sounds good, but I assume it would be a warning rather than a mandatory error? If so I think we should still improve the handling of overwriting symbols during annotation processing with something like the proposed fix for JDK-8193037. I filed a bug about implementing proc.type.already.exists: https://bugs.openjdk.java.net/browse/JDK-8193216 On Wed, Dec 6, 2017 at 1:11 AM, Liam Miller-Cushon wrote: > I think the current implementation of Filer doesn't check if generated > classes override arbitrary classes on the classpath, it only checks if they > clash with previously generated classes, or the sources and classes that > were explicit inputs to the compilation: http://hg.openjdk.java.net/ > jdk/jdk/file/a9405d9ca8a8/src/jdk.compiler/share/classes/ > com/sun/tools/javac/processing/JavacFiler.java#l719 > > On Tue, Dec 5, 2017 at 11:48 PM, Jonathan Gibbons < > jonathan.gibbons at oracle.com> wrote: > >> We'll need Joe "Mr Annotation Processing" Darcy to chime in here, but the >> Filer is supposed to detect clashes, and prevent overwriting/overriding >> symbols. That's definitely supposed to happen for normal >> classes/interfaces; I could believe that package-info has been overlooked, >> but I would expect it to follow the same guidelines. >> >> -- Jon >> >> On 12/5/17 6:24 PM, Liam Miller-Cushon wrote: >> >> Is overriding package-infos different or worse than overriding other >> symbols? I've seen a number of examples where the same source file was >> compiled multiple times and the earlier results ended up on the class path >> of the later compilations, so a processor-generated class was both on the >> class path and generated during the compilation. Making that an error would >> be a somewhat invasive breaking change. I agree that it should be >> discouraged, but I'm not sure it's worth making an error? (Unless there's >> something special about package-infos that I'm missing.) >> >> On Tue, Dec 5, 2017 at 6:09 PM, Jonathan Gibbons < >> jonathan.gibbons at oracle.com> wrote: >> >>> Generally, annotation processing is supposed to only create information >>> where there was no information previously, so if a package had a >>> package-info with annotations, it seems like it should be an error to >>> override it with another package-info, with or without annotations. >>> >>> -- Jon >>> >>> >>> On 12/05/2017 05:39 PM, Liam Miller-Cushon wrote: >>> >>> Thanks! If an annotated package-info is loaded from the class path, and >>> then a processor generates a package-info that contains no annotations, the >>> reset is necessary. (The reset isn't necessary if the new package-info is >>> annotated, since the old annotations get overwritten even if they weren't >>> reset between rounds.) >>> >>> On Tue, Dec 5, 2017 at 4:46 PM, Jonathan Gibbons < >>> jonathan.gibbons at oracle.com> wrote: >>> >>>> Liam, >>>> >>>> What about the case where an annotation processor generates the >>>> package-info.java file? Is that a case where it is important to reinit the >>>> packge symbol correctly, so that the newly generated code is read? >>>> >>>> -- Jon >>>> >>>> >>>> On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: >>>> >>>>> I have a question about the logic in JavacProcessingEnvironment's >>>>> treeCleaner that resets package-info state between annotation processing >>>>> rounds [1]. >>>>> >>>>> JDK-8193037 describes an issue where package-infos loaded from the >>>>> classpath are reset by treeCleaner. Those symbols doesn't get reinitialized >>>>> correctly, and package annotations are not visible during subsequent >>>>> annotation processing rounds. >>>>> >>>>> I wondered if the logic was only meant to apply to package-infos being >>>>> compiled from source in the current compilation (similar to how >>>>> module-infos are handle by treeCleaner), but I'm having trouble >>>>> understanding when that logic is necessary. Commenting out >>>>> `node.packge.package_info.reset();` and `node.packge.reset();` in >>>>> treeCleaner doesn't break any jtreg tests. Does anyone have examples where >>>>> that code is needed? I'd like to add a regression test to ensure the fix >>>>> for JDK-8193037 doesn't interfere with the original purpose of that code. >>>>> >>>>> Thanks, >>>>> >>>>> [1] http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk >>>>> .compiler/share/classes/com/sun/tools/javac/processing/Javac >>>>> ProcessingEnvironment.java#l1518 >>>>> >>>> >>>> >>> >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.lahoda at oracle.com Fri Dec 8 17:18:06 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Fri, 8 Dec 2017 18:18:06 +0100 Subject: RFR: JDK-8189782: As com.sun.tools.javac.api.JavacTool misreports number of arguments consumed Message-ID: <5A2AC94E.8070506@oracle.com> Hi, JavaCompiler.isSupportedOption returns 1 for options like "-proc:none", which does not seem right. The proposed patch resolves that. Bug: https://bugs.openjdk.java.net/browse/JDK-8189782 Webrev: http://cr.openjdk.java.net/~jlahoda/8189782/webrev.00/ How does it look? Thanks, Jan From chris.w.dennis at gmail.com Fri Dec 8 17:34:06 2017 From: chris.w.dennis at gmail.com (Chris Dennis) Date: Fri, 8 Dec 2017 12:34:06 -0500 Subject: Method invocation applicability rules confusion Message-ID: <24729CCB-552C-4294-9AC4-BA0D4B7A13E1@gmail.com> Hi All, I?ve hit an interesting issue with an API that I am responsible for whereby the equivalent to the following does not compile: public class TargetTypingWeirdness { public static void test() { Consumer stringConsumer = System.out::println; f(stringConsumer, o -> o.toString()); } static Runnable f(Consumer c, T t) { return () -> c.accept(t); } static Consumer f(Consumer c, Function ft) { return o -> c.accept(ft.apply(o)); } } with: TargetTypingWeirdness.java:9: error: reference to f is ambiguous f(stringConsumer, o -> o.toString()); ^ both method f(Consumer,T#1) in TargetTypingWeirdness and method f(Consumer,Function) in TargetTypingWeirdness match where T#1,T#2 are type-variables: T#1 extends Object declared in method f(Consumer,T#1) T#2 extends Object declared in method f(Consumer,Function) TargetTypingWeirdness.java:9: error: incompatible types: cannot infer type-variable(s) T f(stringConsumer, o -> o.toString()); ^ (argument mismatch; String is not a functional interface) where T is a type-variable: T extends Object declared in method f(Consumer,T) 2 errors I?m trying to figure out if this is an allowed behavior under the spec, or a bug in javac? Any help greatly appreciated, Chris From jonathan.gibbons at oracle.com Fri Dec 8 19:11:48 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Fri, 08 Dec 2017 11:11:48 -0800 Subject: RFR: JDK-8189782: As com.sun.tools.javac.api.JavacTool misreports number of arguments consumed In-Reply-To: <5A2AC94E.8070506@oracle.com> References: <5A2AC94E.8070506@oracle.com> Message-ID: <5A2AE3F4.9080401@oracle.com> OK. isSupportedOption is a sad method, but the patch is in line with its current spec. -- Jon On 12/08/2017 09:18 AM, Jan Lahoda wrote: > Hi, > > JavaCompiler.isSupportedOption returns 1 for options like > "-proc:none", which does not seem right. The proposed patch resolves > that. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8189782 > Webrev: http://cr.openjdk.java.net/~jlahoda/8189782/webrev.00/ > > How does it look? > > Thanks, > Jan From jonathan.gibbons at oracle.com Fri Dec 8 19:17:38 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Fri, 08 Dec 2017 11:17:38 -0800 Subject: RFR: JDK-8189778: Jshell crash on tab for StringBuilder.append( In-Reply-To: <5A285D1E.5090205@oracle.com> References: <59F1AC72.4020202@oracle.com> <59F8A8E6.6030609@oracle.com> <59FB10F5.4000407@oracle.com> <5A285D1E.5090205@oracle.com> Message-ID: <5A2AE552.9080507@oracle.com> OK. Long term, we should have a utility class/method somewhere, either in DocTrees, or in the jdk.javadoc module, to provide "official" support for obtaining a doc comment with `{@inheritDoc}` resolved. One gotcha in that sort of code that we are becoming more aware of, is the need to handle inline references using ``. At least for you in this Shell console world, that is not such an issue. -- Jon On 12/06/2017 01:11 PM, Jan Lahoda wrote: > Hi, > > A webrev updated to the current state and with some further fixes is > here: > http://cr.openjdk.java.net/~jlahoda/8189778/webrev.02/ > > On 2.11.2017 13:35, Kumar Srinivasan wrote: >> >> Hi Jan, >> >> Generally it looks fine to me, a few nits... >> >> JavadocHelper.java >> >> 1. >> >> - //which will be resolve in visitInheritDoc: >> suggest.... >> + //which will be resolved in visitInheritDoc: > > Done. > >> >> 2. Suggest adding a space after /** or /* makes it a little easier >> to read the comments. > > Done. > >> >> 3. >> >> - //insertPos (as future missing elements should be inserted behind >> + //insertPos (as future missing elements should be inserted before > > The missing elements are inserted behind the tree that was visited by > the method. > >> >> 4. >> - //if there is a newline immediatelly after this tree, insert after >> + //if there is a newline immediately after this tree, insert after > > Done. Also changed "after" to "behind". > >> >> 5. Several private methods have have javadoc comments /**, do you >> run javadoc -private on jshell sources ? > > Changed to comments to /*. > > Any feedback is welcome! > > Thanks, > Jan > >> >> You may want to get Jon's review on this, he is much more familiar >> with these things, than I. >> >> Thanks >> Kumar >> >>> I've updated to patch to have some comments at places that seemed >>> important: >>> http://cr.openjdk.java.net/~jlahoda/8189778/webrev.01/ >>> >>> Jan >>> >>> On 26.10.2017 11:35, Jan Lahoda wrote: >>>> Hi, >>>> >>>> Typing: >>>> jshell> StringBuilder sb = new StringBuilder(); >>>> jshell> sb.append( >>>> >>>> Will lead to an exception: >>>> jshell> sb.append(Exception in thread "main" >>>> java.lang.StringIndexOutOfBoundsException: start -59, end -59, length >>>> 238 >>>> [snip] >>>> jdk.compiler/jdk.internal.shellsupport.doc.JavadocHelper$OnDemandJavadocHelper.getResolvedDocComment(JavadocHelper.java:481) >>>> >>>> >>>> >>>> >>>> The reason is that the javadoc for StringBuilder.append(CharSequence, >>>> int, int) is: >>>> /** >>>> * @throws IndexOutOfBoundsException {@inheritDoc} >>>> */ >>>> >>>> The JavadocHelper tries to fill in the missing javadoc entries, but >>>> that >>>> fails because it tries to insert the preceding entries at an >>>> uninitialized place. >>>> >>>> The proposed patch: >>>> -fixes the above >>>> -adds a test that runs the JavadocHelper on all >>>> methods/fields/constructors of top-level types in all exported >>>> packages >>>> (this runs for a considerable time, and we may need to disable this >>>> test >>>> if it proves to be too heavyweight) >>>> -adds a few more test cases for problems found by the above test >>>> -fixes the javadoc resolution to treat missing javadoc body as >>>> {@inheritDoc} (so that the overridden method's javadoc text is used if >>>> missing in this method) >>>> >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8189778 >>>> Webrev: http://cr.openjdk.java.net/~jlahoda/8189778/webrev.00/ >>>> >>>> Feedback is welcome. >>>> >>>> Thanks, >>>> Jan >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From cushon at google.com Fri Dec 8 19:52:43 2017 From: cushon at google.com (Liam Miller-Cushon) Date: Fri, 8 Dec 2017 11:52:43 -0800 Subject: RFR 8193216: Filer should warn if processors redefine symbols from the classpath or sourcepath Message-ID: Hello, Please review the following fix for JDK-8193216. The patch causes Filer to emit a warning if an annotation processor redefines a symbol on the classpath or sourcepath. bug: https://bugs.openjdk.java.net/browse/JDK-8193216 webrev: http://cr.openjdk.java.net/~cushon/8193216/webrev.00/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From maurizio.cimadamore at oracle.com Fri Dec 8 21:39:31 2017 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Fri, 8 Dec 2017 21:39:31 +0000 Subject: Method invocation applicability rules confusion In-Reply-To: <24729CCB-552C-4294-9AC4-BA0D4B7A13E1@gmail.com> References: <24729CCB-552C-4294-9AC4-BA0D4B7A13E1@gmail.com> Message-ID: This is a tricky one - I'll try to explain what's happening :-) FIrst, let's leave lambdas on the side - this has nothing to do with it. And also simplify the program as follows (I've also alpha-renamed the type vars): static void f(Consumer c, T o) { } static void f(Consumer c, String s) { } And consider the following invocation: f(null, null) Now, looking at the available signatures, one might be tempted to conclude that the second signature is most specific. But that's not how the rules in JLS 15.12.2.5 work? - those rule say that we need to do two applicability tests: 1) is f(Consumer, T) applicable given argument types { Consumer, String } ? 2) is f(Consumer, String) applicable given argument types { Consumer, T } ? If the answer is yes to either (1) or (2), that that's the most specific method; if (1) and (2) are both true/false then the callsite is ambiguous. So, let's process the two questions: For (1) we have the following applicability tests (note that _only_ Z acts as an an inference variable in this test) Consumer <: Consumer T <: String now, no matter what we infer for Z, T<: String is always going to be false. So (1) is not satisfied. Let's move on to (2). For (2) we have the following applicability tests (this time _only_ T acts as an inference variable) Consumer <: Consumer String <: T This looks more interesting. From the first constraint we derive: Z = T But this means that, if we incorporate bounds, String <: T, T = Z --> String <: Z Which is, again, false. So, unfortunately, both applicability tests (1) and (2) fails, so neither method is more specific. Hence the ambiguity error. Cheers Maurizio On 08/12/17 17:34, Chris Dennis wrote: > Hi All, > > I?ve hit an interesting issue with an API that I am responsible for whereby the equivalent to the following does not compile: > > public class TargetTypingWeirdness { > > public static void test() { > Consumer stringConsumer = System.out::println; > > f(stringConsumer, o -> o.toString()); > } > > static Runnable f(Consumer c, T t) { > return () -> c.accept(t); > } > > static Consumer f(Consumer c, Function ft) { > return o -> c.accept(ft.apply(o)); > } > } > > with: > > TargetTypingWeirdness.java:9: error: reference to f is ambiguous > f(stringConsumer, o -> o.toString()); > ^ > both method f(Consumer,T#1) in TargetTypingWeirdness and method f(Consumer,Function) in TargetTypingWeirdness match > where T#1,T#2 are type-variables: > T#1 extends Object declared in method f(Consumer,T#1) > T#2 extends Object declared in method f(Consumer,Function) > TargetTypingWeirdness.java:9: error: incompatible types: cannot infer type-variable(s) T > f(stringConsumer, o -> o.toString()); > ^ > (argument mismatch; String is not a functional interface) > where T is a type-variable: > T extends Object declared in method f(Consumer,T) > 2 errors > > I?m trying to figure out if this is an allowed behavior under the spec, or a bug in javac? > > Any help greatly appreciated, > > Chris From chris.w.dennis at gmail.com Mon Dec 11 14:59:06 2017 From: chris.w.dennis at gmail.com (Chris Dennis) Date: Mon, 11 Dec 2017 09:59:06 -0500 Subject: Method invocation applicability rules confusion In-Reply-To: References: <24729CCB-552C-4294-9AC4-BA0D4B7A13E1@gmail.com> Message-ID: Forgive me, it?s too long since I was at university, and then I was a physicist, so I just pretended to be good at mathematics/computer science. My intuitive understanding says that f(Consumer, T>) shouldn't be considered applicable given the argument types (as per 15.12.2.3 https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.2.3 ). I?ve tried (and will continue to try) to work through the logic of that section and the accompanying details in Chapter 18, but if you could confirm that it is applicable then that would be great (at least then I?d know that what I?m doing is an academic exercise, and that I should end up proving the method is applicable). Thanks, Chris > On Dec 8, 2017, at 4:39 PM, Maurizio Cimadamore wrote: > > This is a tricky one - I'll try to explain what's happening :-) > > FIrst, let's leave lambdas on the side - this has nothing to do with it. And also simplify the program as follows (I've also alpha-renamed the type vars): > > static void f(Consumer c, T o) { } > > static void f(Consumer c, String s) { } > > > And consider the following invocation: > > f(null, null) > > Now, looking at the available signatures, one might be tempted to conclude that the second signature is most specific. But that's not how the rules in JLS 15.12.2.5 work - those rule say that we need to do two applicability tests: > > 1) is f(Consumer, T) applicable given argument types { Consumer, String } ? > 2) is f(Consumer, String) applicable given argument types { Consumer, T } ? > > If the answer is yes to either (1) or (2), that that's the most specific method; if (1) and (2) are both true/false then the callsite is ambiguous. > > So, let's process the two questions: > > For (1) we have the following applicability tests (note that _only_ Z acts as an an inference variable in this test) > > Consumer <: Consumer > T <: String > > now, no matter what we infer for Z, T<: String is always going to be false. So (1) is not satisfied. Let's move on to (2). > > For (2) we have the following applicability tests (this time _only_ T acts as an inference variable) > > Consumer <: Consumer > String <: T > > This looks more interesting. From the first constraint we derive: > > Z = T > > But this means that, if we incorporate bounds, > > String <: T, T = Z --> String <: Z > > Which is, again, false. > > So, unfortunately, both applicability tests (1) and (2) fails, so neither method is more specific. Hence the ambiguity error. > > Cheers > Maurizio > > > > > On 08/12/17 17:34, Chris Dennis wrote: >> Hi All, >> >> I?ve hit an interesting issue with an API that I am responsible for whereby the equivalent to the following does not compile: >> >> public class TargetTypingWeirdness { >> >> public static void test() { >> Consumer stringConsumer = System.out::println; >> >> f(stringConsumer, o -> o.toString()); >> } >> >> static Runnable f(Consumer c, T t) { >> return () -> c.accept(t); >> } >> >> static Consumer f(Consumer c, Function ft) { >> return o -> c.accept(ft.apply(o)); >> } >> } >> >> with: >> >> TargetTypingWeirdness.java:9: error: reference to f is ambiguous >> f(stringConsumer, o -> o.toString()); >> ^ >> both method f(Consumer,T#1) in TargetTypingWeirdness and method f(Consumer,Function) in TargetTypingWeirdness match >> where T#1,T#2 are type-variables: >> T#1 extends Object declared in method f(Consumer,T#1) >> T#2 extends Object declared in method f(Consumer,Function) >> TargetTypingWeirdness.java:9: error: incompatible types: cannot infer type-variable(s) T >> f(stringConsumer, o -> o.toString()); >> ^ >> (argument mismatch; String is not a functional interface) >> where T is a type-variable: >> T extends Object declared in method f(Consumer,T) >> 2 errors >> >> I?m trying to figure out if this is an allowed behavior under the spec, or a bug in javac? >> >> Any help greatly appreciated, >> >> Chris > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maurizio.cimadamore at oracle.com Mon Dec 11 16:26:59 2017 From: maurizio.cimadamore at oracle.com (Maurizio Cimadamore) Date: Mon, 11 Dec 2017 16:26:59 +0000 Subject: Method invocation applicability rules confusion In-Reply-To: References: <24729CCB-552C-4294-9AC4-BA0D4B7A13E1@gmail.com> Message-ID: <90d6a14d-166e-5bfb-33fd-56fc8f4224bb@oracle.com> Note that in your original example your second argument is: o -> o.toString() Whenever you have a lambda (implicit, or explicit) and the target type is some inference variable (like T in this case), the lambda is always considered potentially applicable (as per 15.12.2.1). Then, since this is an implicit lambda - implicit lambda don't do much in terms of ruling out applicable candidates. This is called pertinence to applicability - see 15.12.2.2. An implicit lambda is NOT pertinent to applicability, so it doesn't contribute to overload resolution. Hence, both methods in your example are applicable. Maurizio On 11/12/17 14:59, Chris Dennis wrote: > Forgive me, it?s too long since I was at university, and then I was a > physicist, so I just pretended to be good at mathematics/computer > science. My intuitive understanding says that f(Consumer, T>) > shouldn't be considered applicable given the argument types (as per > 15.12.2.3 > https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.2.3). > ?I?ve tried (and will continue to try) to work through the logic of > that section and the accompanying details in Chapter 18, but if you > could confirm that it is applicable then that would be great (at least > then I?d know that what I?m doing is an academic exercise, and that I > should end up proving the method is applicable). > > Thanks, > > Chris > > >> On Dec 8, 2017, at 4:39 PM, Maurizio Cimadamore >> > > wrote: >> >> This is a tricky one - I'll try to explain what's happening :-) >> >> FIrst, let's leave lambdas on the side - this has nothing to do with >> it. And also simplify the program as follows (I've also alpha-renamed >> the type vars): >> >> static void f(Consumer c, T o) { } >> >> static void f(Consumer c, String s) { } >> >> >> And consider the following invocation: >> >> f(null, null) >> >> Now, looking at the available signatures, one might be tempted to >> conclude that the second signature is most specific. But that's not >> how the rules in JLS 15.12.2.5 work? - those rule say that we need to >> do two applicability tests: >> >> 1) is f(Consumer, T) applicable given argument types { >> Consumer, String } ? >> 2) is f(Consumer, String) applicable given argument types { >> Consumer, T } ? >> >> If the answer is yes to either (1) or (2), that that's the most >> specific method; if (1) and (2) are both true/false then the callsite >> is ambiguous. >> >> So, let's process the two questions: >> >> For (1) we have the following applicability tests (note that _only_ Z >> acts as an an inference variable in this test) >> >> Consumer <: Consumer >> T <: String >> >> now, no matter what we infer for Z, T<: String is always going to be >> false. So (1) is not satisfied. Let's move on to (2). >> >> For (2) we have the following applicability tests (this time _only_ T >> acts as an inference variable) >> >> Consumer <: Consumer >> String <: T >> >> This looks more interesting. From the first constraint we derive: >> >> Z = T >> >> But this means that, if we incorporate bounds, >> >> String <: T, T = Z --> String <: Z >> >> Which is, again, false. >> >> So, unfortunately, both applicability tests (1) and (2) fails, so >> neither method is more specific. Hence the ambiguity error. >> >> Cheers >> Maurizio >> >> >> >> >> On 08/12/17 17:34, Chris Dennis wrote: >>> Hi All, >>> >>> I?ve hit an interesting issue with an API that I am responsible for >>> whereby the equivalent to the following does not compile: >>> >>> public class TargetTypingWeirdness { >>> >>> ??public static void test() { >>> ????Consumer stringConsumer = System.out::println; >>> >>> ????f(stringConsumer, o -> o.toString()); >>> ??} >>> >>> ??static Runnable f(Consumer c, T t) { >>> ????return () -> c.accept(t); >>> ??} >>> >>> ??static Consumer f(Consumer c, Function ft) { >>> ????return o -> c.accept(ft.apply(o)); >>> ??} >>> } >>> >>> with: >>> >>> TargetTypingWeirdness.java:9: error: reference to f is ambiguous >>> ????f(stringConsumer, o -> o.toString()); >>> ????^ >>> ??both method f(Consumer,T#1) in TargetTypingWeirdness and >>> method f(Consumer,Function) in >>> TargetTypingWeirdness match >>> ??where T#1,T#2 are type-variables: >>> ????T#1 extends Object declared in method f(Consumer,T#1) >>> ????T#2 extends Object declared in method >>> f(Consumer,Function) >>> TargetTypingWeirdness.java:9: error: incompatible types: cannot >>> infer type-variable(s) T >>> ????f(stringConsumer, o -> o.toString()); >>> ?????^ >>> ????(argument mismatch; String is not a functional interface) >>> ??where T is a type-variable: >>> ????T extends Object declared in method f(Consumer,T) >>> 2 errors >>> >>> I?m trying to figure out if this is an allowed behavior under the >>> spec, or a bug in javac? >>> >>> Any help greatly appreciated, >>> >>> Chris >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Alan.Bateman at oracle.com Mon Dec 11 16:52:38 2017 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 11 Dec 2017 16:52:38 +0000 Subject: FW: RFR(M): 8189102: All tools should support -?, -h and --help In-Reply-To: <456c694ec25a42658af1b8600aaa136d@sap.com> References: <8aa25976d496465fac00a4ae3628e533@sap.com> <456c694ec25a42658af1b8600aaa136d@sap.com> Message-ID: <6d7d895f-9f23-fd4b-39ca-ef9bb0331fb9@oracle.com> On 07/12/2017 11:20, Lindenmaier, Goetz wrote: > Hi, > > ... missed some lists in my first post ... > > I prepared a fifth webrev for this change. Please review. > > It incorporates the changes requested by the CSR reviewers > (not to remove docuemtation of '-help' where is was documented > before) and the changes proposed by Kumar: > http://cr.openjdk.java.net/~goetz/wr17/8189102-helpMessage/webrev.05/ > > Looks like it still drops -help from the javadoc usage message, I can't tell if you meant to do that. -Alan. From chris.w.dennis at gmail.com Mon Dec 11 19:11:13 2017 From: chris.w.dennis at gmail.com (Chris Dennis) Date: Mon, 11 Dec 2017 14:11:13 -0500 Subject: Method invocation applicability rules confusion In-Reply-To: <90d6a14d-166e-5bfb-33fd-56fc8f4224bb@oracle.com> References: <24729CCB-552C-4294-9AC4-BA0D4B7A13E1@gmail.com> <90d6a14d-166e-5bfb-33fd-56fc8f4224bb@oracle.com> Message-ID: <4B72017E-FC8E-498F-9045-3240C0706EAE@gmail.com> Thank you, I now understand whats going on, I just don?t like it that much. C?est la vie, Chris > On Dec 11, 2017, at 11:26 AM, Maurizio Cimadamore wrote: > > Note that in your original example your second argument is: > > o -> o.toString() > > Whenever you have a lambda (implicit, or explicit) and the target type is some inference variable (like T in this case), the lambda is always considered potentially applicable (as per 15.12.2.1). > > Then, since this is an implicit lambda - implicit lambda don't do much in terms of ruling out applicable candidates. This is called pertinence to applicability - see 15.12.2.2. An implicit lambda is NOT pertinent to applicability, so it doesn't contribute to overload resolution. > > Hence, both methods in your example are applicable. > > Maurizio > > > On 11/12/17 14:59, Chris Dennis wrote: >> Forgive me, it?s too long since I was at university, and then I was a physicist, so I just pretended to be good at mathematics/computer science. My intuitive understanding says that f(Consumer, T>) shouldn't be considered applicable given the argument types (as per 15.12.2.3 https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.2.3 ). I?ve tried (and will continue to try) to work through the logic of that section and the accompanying details in Chapter 18, but if you could confirm that it is applicable then that would be great (at least then I?d know that what I?m doing is an academic exercise, and that I should end up proving the method is applicable). >> >> Thanks, >> >> Chris >> >> >>> On Dec 8, 2017, at 4:39 PM, Maurizio Cimadamore > wrote: >>> >>> This is a tricky one - I'll try to explain what's happening :-) >>> >>> FIrst, let's leave lambdas on the side - this has nothing to do with it. And also simplify the program as follows (I've also alpha-renamed the type vars): >>> >>> static void f(Consumer c, T o) { } >>> >>> static void f(Consumer c, String s) { } >>> >>> >>> And consider the following invocation: >>> >>> f(null, null) >>> >>> Now, looking at the available signatures, one might be tempted to conclude that the second signature is most specific. But that's not how the rules in JLS 15.12.2.5 work - those rule say that we need to do two applicability tests: >>> >>> 1) is f(Consumer, T) applicable given argument types { Consumer, String } ? >>> 2) is f(Consumer, String) applicable given argument types { Consumer, T } ? >>> >>> If the answer is yes to either (1) or (2), that that's the most specific method; if (1) and (2) are both true/false then the callsite is ambiguous. >>> >>> So, let's process the two questions: >>> >>> For (1) we have the following applicability tests (note that _only_ Z acts as an an inference variable in this test) >>> >>> Consumer <: Consumer >>> T <: String >>> >>> now, no matter what we infer for Z, T<: String is always going to be false. So (1) is not satisfied. Let's move on to (2). >>> >>> For (2) we have the following applicability tests (this time _only_ T acts as an inference variable) >>> >>> Consumer <: Consumer >>> String <: T >>> >>> This looks more interesting. From the first constraint we derive: >>> >>> Z = T >>> >>> But this means that, if we incorporate bounds, >>> >>> String <: T, T = Z --> String <: Z >>> >>> Which is, again, false. >>> >>> So, unfortunately, both applicability tests (1) and (2) fails, so neither method is more specific. Hence the ambiguity error. >>> >>> Cheers >>> Maurizio >>> >>> >>> >>> >>> On 08/12/17 17:34, Chris Dennis wrote: >>>> Hi All, >>>> >>>> I?ve hit an interesting issue with an API that I am responsible for whereby the equivalent to the following does not compile: >>>> >>>> public class TargetTypingWeirdness { >>>> >>>> public static void test() { >>>> Consumer stringConsumer = System.out::println; >>>> >>>> f(stringConsumer, o -> o.toString()); >>>> } >>>> >>>> static Runnable f(Consumer c, T t) { >>>> return () -> c.accept(t); >>>> } >>>> >>>> static Consumer f(Consumer c, Function ft) { >>>> return o -> c.accept(ft.apply(o)); >>>> } >>>> } >>>> >>>> with: >>>> >>>> TargetTypingWeirdness.java:9: error: reference to f is ambiguous >>>> f(stringConsumer, o -> o.toString()); >>>> ^ >>>> both method f(Consumer,T#1) in TargetTypingWeirdness and method f(Consumer,Function) in TargetTypingWeirdness match >>>> where T#1,T#2 are type-variables: >>>> T#1 extends Object declared in method f(Consumer,T#1) >>>> T#2 extends Object declared in method f(Consumer,Function) >>>> TargetTypingWeirdness.java:9: error: incompatible types: cannot infer type-variable(s) T >>>> f(stringConsumer, o -> o.toString()); >>>> ^ >>>> (argument mismatch; String is not a functional interface) >>>> where T is a type-variable: >>>> T extends Object declared in method f(Consumer,T) >>>> 2 errors >>>> >>>> I?m trying to figure out if this is an allowed behavior under the spec, or a bug in javac? >>>> >>>> Any help greatly appreciated, >>>> >>>> Chris >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe.darcy at oracle.com Tue Dec 12 07:04:40 2017 From: joe.darcy at oracle.com (joe darcy) Date: Mon, 11 Dec 2017 23:04:40 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 Message-ID: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> Hello, With the JDK 11 line of development opening up in a few days, a few changes are needed to prepared to turn a JDK 10 code base into a JDK 11 one including: JDK-8173382: Add -source 11 and -target 11 to javac JDK-8193291: Add SourceVersion.RELEASE_11 Webev: http://cr.openjdk.java.net/~darcy/8173382.1/ CSRs: JDK-8193350: Add -source 11 and -target 11 to javac JDK-8193351: Add SourceVersion.RELEASE_11 Please review the preliminary webrev and CSRs. Note that breaking with previous contentions, the current iteration of the change does *not* add -source/-target "1.11" as an alias for "11". Only "11" is recognized. I didn't see how to add support for an "11" value for "--release" so I problem listed two tests until that is sorted out. The build is simultaneously updated to user -source/-target 11, hence the inclusion of build-dev. Various langtools tests and test infrastructure is updated too. Thanks, -Joe From goetz.lindenmaier at sap.com Tue Dec 12 10:36:51 2017 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Tue, 12 Dec 2017 10:36:51 +0000 Subject: FW: RFR(M): 8189102: All tools should support -?, -h and --help In-Reply-To: <6d7d895f-9f23-fd4b-39ca-ef9bb0331fb9@oracle.com> References: <8aa25976d496465fac00a4ae3628e533@sap.com> <456c694ec25a42658af1b8600aaa136d@sap.com> <6d7d895f-9f23-fd4b-39ca-ef9bb0331fb9@oracle.com> Message-ID: <7be3772e8060494cbecf3097bd0a8a85@sap.com> Hi Alan, Javadoc combines documentation and support of a flag in the way the flag handling is implemented. On the other side, it prints the help message anyways if a wrong flag is presented to it, so if you call it with -help you get the help message. Therefore, in my original change where I tried to get it more cleaned up, I removed -help support and documentation from Javadoc. I added it again and updated the table in the CSR: http://cr.openjdk.java.net/~goetz/wr17/8189102-helpMessage/webrev.06/ Best regards, Goetz. > -----Original Message----- > From: Alan Bateman [mailto:Alan.Bateman at oracle.com] > Sent: Montag, 11. Dezember 2017 17:53 > To: Lindenmaier, Goetz ; core-libs- > dev at openjdk.java.net; 'compiler-dev at openjdk.java.net' dev at openjdk.java.net>; serviceability-dev (serviceability- > dev at openjdk.java.net) > Subject: Re: FW: RFR(M): 8189102: All tools should support -?, -h and --help > > > > On 07/12/2017 11:20, Lindenmaier, Goetz wrote: > > Hi, > > > > ... missed some lists in my first post ... > > > > I prepared a fifth webrev for this change. Please review. > > > > It incorporates the changes requested by the CSR reviewers > > (not to remove docuemtation of '-help' where is was documented > > before) and the changes proposed by Kumar: > > http://cr.openjdk.java.net/~goetz/wr17/8189102- > helpMessage/webrev.05/ > > > > > Looks like it still drops -help from the javadoc usage message, I can't > tell if you meant to do that. > > -Alan. From erik.joelsson at oracle.com Tue Dec 12 15:36:11 2017 From: erik.joelsson at oracle.com (Erik Joelsson) Date: Tue, 12 Dec 2017 16:36:11 +0100 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> Message-ID: <5cc0a0e6-e2a5-5232-1070-50944acc0237@oracle.com> Build change looks good. /Erik On 2017-12-12 08:04, joe darcy wrote: > Hello, > > With the JDK 11 line of development opening up in a few days, a few > changes are needed to prepared to turn a JDK 10 code base into a JDK > 11 one including: > > ??? JDK-8173382: Add -source 11 and -target 11 to javac > ??? JDK-8193291: Add SourceVersion.RELEASE_11 > > ??? Webev: > ??????? http://cr.openjdk.java.net/~darcy/8173382.1/ > ??? CSRs: > ??????? JDK-8193350: Add -source 11 and -target 11 to javac > ??????? JDK-8193351: Add SourceVersion.RELEASE_11 > > Please review the preliminary webrev and CSRs. > > Note that breaking with previous contentions, the current iteration of > the change does *not* add -source/-target "1.11" as an alias for "11". > Only "11" is recognized. > > I didn't see how to add support for an "11" value for "--release" so I > problem listed two tests until that is sorted out. > > The build is simultaneously updated to user -source/-target 11, hence > the inclusion of build-dev. > > Various langtools tests and test infrastructure is updated too. > > Thanks, > > -Joe > From paul.sandoz at oracle.com Tue Dec 12 17:31:58 2017 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 12 Dec 2017 09:31:58 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> Message-ID: Hi Joe, I would like to see the class file version increment [*] in the same patch (the unified repo makes this easier now). Then we have everything in one changeset (except for any ctsym changes?) that can be easily templated when the next increment is required, since we will be doing this far more regularly from now on. Are there any technical impediments as to why this would be problematic? Thanks, Paul. [*] here is the increment to 54 http://hg.openjdk.java.net/jdk/jdk/rev/89829dd3cc54 > On 11 Dec 2017, at 23:04, joe darcy wrote: > > Hello, > > With the JDK 11 line of development opening up in a few days, a few changes are needed to prepared to turn a JDK 10 code base into a JDK 11 one including: > > JDK-8173382: Add -source 11 and -target 11 to javac > JDK-8193291: Add SourceVersion.RELEASE_11 > > Webev: > http://cr.openjdk.java.net/~darcy/8173382.1/ > CSRs: > JDK-8193350: Add -source 11 and -target 11 to javac > JDK-8193351: Add SourceVersion.RELEASE_11 > > Please review the preliminary webrev and CSRs. > > Note that breaking with previous contentions, the current iteration of the change does *not* add -source/-target "1.11" as an alias for "11". Only "11" is recognized. > > I didn't see how to add support for an "11" value for "--release" so I problem listed two tests until that is sorted out. > > The build is simultaneously updated to user -source/-target 11, hence the inclusion of build-dev. > > Various langtools tests and test infrastructure is updated too. > > Thanks, > > -Joe > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 873 bytes Desc: Message signed with OpenPGP URL: From joe.darcy at oracle.com Tue Dec 12 17:52:08 2017 From: joe.darcy at oracle.com (joe darcy) Date: Tue, 12 Dec 2017 09:52:08 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> Message-ID: <48fdaf67-bf68-2701-8951-753699029bf4@oracle.com> Hi Paul, There is sense in working in including the class file version update at the same time if the added complexity doesn't delay the changes. Did the patch for the increment to 54 require previous changes in the bundled ASM? Thanks, -Joe On 12/12/2017 9:31 AM, Paul Sandoz wrote: > Hi Joe, > > I would like to see the class file version increment [*] in the same > patch (the unified repo makes this easier now). > > Then we have everything in one changeset (except for any ctsym > changes?) that can be easily templated when the next increment is > required, since we will be doing this far more regularly from now on. > > Are there any technical impediments as to why this would be problematic? > > Thanks, > Paul. > > [*] here is the increment to 54 > http://hg.openjdk.java.net/jdk/jdk/rev/89829dd3cc54 > From paul.sandoz at oracle.com Tue Dec 12 18:03:31 2017 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 12 Dec 2017 10:03:31 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <48fdaf67-bf68-2701-8951-753699029bf4@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <48fdaf67-bf68-2701-8951-753699029bf4@oracle.com> Message-ID: <95C47796-7ED5-4855-95E4-85724A73143A@oracle.com> > On 12 Dec 2017, at 09:52, joe darcy wrote: > > Hi Paul, > > There is sense in working in including the class file version update at the same time if the added complexity doesn't delay the changes. > I sense it should be so complex and delay since the additional code changes can be copied from the prior changes which recently went through significant review. If it helps, and since i am proposing additional work, i can merge in such changes into your patch. > Did the patch for the increment to 54 require previous changes in the bundled ASM? > The increment in and of itself requires only minimal changes to the internal ASM, it does not require the integration of a new version of ASM. Constant dynamic only requires a minimal update to the internal ASM to skip over the new constant pool entry, since we don?t currently use ASM process or generate constant dynamic entries. Paul. > Thanks, > > -Joe > > > On 12/12/2017 9:31 AM, Paul Sandoz wrote: >> Hi Joe, >> >> I would like to see the class file version increment [*] in the same patch (the unified repo makes this easier now). >> >> Then we have everything in one changeset (except for any ctsym changes?) that can be easily templated when the next increment is required, since we will be doing this far more regularly from now on. >> >> Are there any technical impediments as to why this would be problematic? >> >> Thanks, >> Paul. >> >> [*] here is the increment to 54 http://hg.openjdk.java.net/jdk/jdk/rev/89829dd3cc54 >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 873 bytes Desc: Message signed with OpenPGP URL: From paul.sandoz at oracle.com Tue Dec 12 18:17:46 2017 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 12 Dec 2017 10:17:46 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <95C47796-7ED5-4855-95E4-85724A73143A@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <48fdaf67-bf68-2701-8951-753699029bf4@oracle.com> <95C47796-7ED5-4855-95E4-85724A73143A@oracle.com> Message-ID: > On 12 Dec 2017, at 10:03, Paul Sandoz wrote: > > > >> On 12 Dec 2017, at 09:52, joe darcy wrote: >> >> Hi Paul, >> >> There is sense in working in including the class file version update at the same time if the added complexity doesn't delay the changes. >> > > I sense it should be so complex and delay since the additional code changes can be copied from the prior changes which recently went through significant review. "I sense it should *not* be?? Paul. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 873 bytes Desc: Message signed with OpenPGP URL: From david.holmes at oracle.com Tue Dec 12 21:11:06 2017 From: david.holmes at oracle.com (David Holmes) Date: Wed, 13 Dec 2017 07:11:06 +1000 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> Message-ID: <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> Hi Joe, On 12/12/2017 5:04 PM, joe darcy wrote: > Hello, > > With the JDK 11 line of development opening up in a few days, a few > changes are needed to prepared to turn a JDK 10 code base into a JDK 11 > one including: > > ??? JDK-8173382: Add -source 11 and -target 11 to javac > ??? JDK-8193291: Add SourceVersion.RELEASE_11 > > ??? Webev: > ??????? http://cr.openjdk.java.net/~darcy/8173382.1/ > ??? CSRs: > ??????? JDK-8193350: Add -source 11 and -target 11 to javac > ??????? JDK-8193351: Add SourceVersion.RELEASE_11 > > Please review the preliminary webrev and CSRs. I don't see a change to the actual JDK version as part of this ?? hat's the change that will cause hotspot to fail to build in debug mode as soon as the version is bumped - I filed: https://bugs.openjdk.java.net/browse/JDK-8193364 to at least get over that. > Note that breaking with previous contentions, the current iteration of > the change does *not* add -source/-target "1.11" as an alias for "11". > Only "11" is recognized. > > I didn't see how to add support for an "11" value for "--release" so I > problem listed two tests until that is sorted out. Okay. It's very hard to discern what uses of "RELEASE_11" pertain to "-release" support and what just pertain to -source/-target. ?? > The build is simultaneously updated to user -source/-target 11, hence > the inclusion of build-dev. > > Various langtools tests and test infrastructure is updated too. test/langtools/tools/javac/versions/Versions.java looks like it needed some updates for JDK 10! Thanks, David > > Thanks, > > -Joe > From joe.darcy at oracle.com Tue Dec 12 21:27:06 2017 From: joe.darcy at oracle.com (joe darcy) Date: Tue, 12 Dec 2017 13:27:06 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> Message-ID: <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> Hi David, On 12/12/2017 1:11 PM, David Holmes wrote: > Hi Joe, > > On 12/12/2017 5:04 PM, joe darcy wrote: >> Hello, >> >> With the JDK 11 line of development opening up in a few days, a few >> changes are needed to prepared to turn a JDK 10 code base into a JDK >> 11 one including: >> >> JDK-8173382: Add -source 11 and -target 11 to javac >> JDK-8193291: Add SourceVersion.RELEASE_11 >> >> Webev: >> http://cr.openjdk.java.net/~darcy/8173382.1/ >> CSRs: >> JDK-8193350: Add -source 11 and -target 11 to javac >> JDK-8193351: Add SourceVersion.RELEASE_11 >> >> Please review the preliminary webrev and CSRs. > > I don't see a change to the actual JDK version as part of this ?? Correct; the webrev to date is the langtools portion of the new JDK groundbreaking, the same subset of groundbreaking I looked at for the 9 -> 10 transition. Other pieces are needed too, including HotSpot changes and the actual version update. > hat's the change that will cause hotspot to fail to build in debug > mode as soon as the version is bumped - I filed: > > https://bugs.openjdk.java.net/browse/JDK-8193364 > > to at least get over that. > >> Note that breaking with previous contentions, the current iteration >> of the change does *not* add -source/-target "1.11" as an alias for >> "11". Only "11" is recognized. >> >> I didn't see how to add support for an "11" value for "--release" so >> I problem listed two tests until that is sorted out. > > Okay. It's very hard to discern what uses of "RELEASE_11" pertain to > "-release" support and what just pertain to -source/-target. ?? In this iteration, mostly -source/-target. The code that populates the list of releases supported by --release has had some updates since I last looked at it and I didn't figure that part out before sending out this review. > >> The build is simultaneously updated to user -source/-target 11, hence >> the inclusion of build-dev. >> >> Various langtools tests and test infrastructure is updated too. > > test/langtools/tools/javac/versions/Versions.java looks like it needed > some updates for JDK 10! Better late than never ;-) Thanks, -Joe From david.holmes at oracle.com Tue Dec 12 21:32:04 2017 From: david.holmes at oracle.com (David Holmes) Date: Wed, 13 Dec 2017 07:32:04 +1000 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> Message-ID: <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> Hi Joe, On 13/12/2017 7:27 AM, joe darcy wrote: > Hi David, > > > On 12/12/2017 1:11 PM, David Holmes wrote: >> Hi Joe, >> >> On 12/12/2017 5:04 PM, joe darcy wrote: >>> Hello, >>> >>> With the JDK 11 line of development opening up in a few days, a few >>> changes are needed to prepared to turn a JDK 10 code base into a JDK >>> 11 one including: >>> >>> ???? JDK-8173382: Add -source 11 and -target 11 to javac >>> ???? JDK-8193291: Add SourceVersion.RELEASE_11 >>> >>> ???? Webev: >>> ???????? http://cr.openjdk.java.net/~darcy/8173382.1/ >>> ???? CSRs: >>> ???????? JDK-8193350: Add -source 11 and -target 11 to javac >>> ???????? JDK-8193351: Add SourceVersion.RELEASE_11 >>> >>> Please review the preliminary webrev and CSRs. >> >> I don't see a change to the actual JDK version as part of this ?? > > Correct; the webrev to date is the langtools portion of the new JDK > groundbreaking, the same subset of groundbreaking I looked at for the 9 > -> 10 transition. Other pieces are needed too, including HotSpot changes > and the actual version update. So what is the overall transition strategy here? I don't see how you can change javac to default to -source/-target 11 prior to bumping the actual version to 11. Or do you expect all the additional pieces to come together at the same time? Thanks, David >> hat's the change that will cause hotspot to fail to build in debug >> mode as soon as the version is bumped - I filed: >> >> https://bugs.openjdk.java.net/browse/JDK-8193364 >> >> to at least get over that. >> >>> Note that breaking with previous contentions, the current iteration >>> of the change does *not* add -source/-target "1.11" as an alias for >>> "11". Only "11" is recognized. >>> >>> I didn't see how to add support for an "11" value for "--release" so >>> I problem listed two tests until that is sorted out. >> >> Okay. It's very hard to discern what uses of "RELEASE_11" pertain to >> "-release" support and what just pertain to -source/-target. ?? > > In this iteration, mostly -source/-target. The code that populates the > list of releases supported by --release has had some updates since I > last looked at it and I didn't figure that part out before sending out > this review. > >> >>> The build is simultaneously updated to user -source/-target 11, hence >>> the inclusion of build-dev. >>> >>> Various langtools tests and test infrastructure is updated too. >> >> test/langtools/tools/javac/versions/Versions.java looks like it needed >> some updates for JDK 10! > > Better late than never ;-) > > Thanks, > > -Joe > From joe.darcy at oracle.com Tue Dec 12 23:20:26 2017 From: joe.darcy at oracle.com (joe darcy) Date: Tue, 12 Dec 2017 15:20:26 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> Message-ID: <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> Hi David, On 12/12/2017 1:32 PM, David Holmes wrote: > Hi Joe, > > On 13/12/2017 7:27 AM, joe darcy wrote: >> Hi David, >> >> >> On 12/12/2017 1:11 PM, David Holmes wrote: >>> Hi Joe, >>> >>> On 12/12/2017 5:04 PM, joe darcy wrote: >>>> Hello, >>>> >>>> With the JDK 11 line of development opening up in a few days, a few >>>> changes are needed to prepared to turn a JDK 10 code base into a >>>> JDK 11 one including: >>>> >>>> JDK-8173382: Add -source 11 and -target 11 to javac >>>> JDK-8193291: Add SourceVersion.RELEASE_11 >>>> >>>> Webev: >>>> http://cr.openjdk.java.net/~darcy/8173382.1/ >>>> CSRs: >>>> JDK-8193350: Add -source 11 and -target 11 to javac >>>> JDK-8193351: Add SourceVersion.RELEASE_11 >>>> >>>> Please review the preliminary webrev and CSRs. >>> >>> I don't see a change to the actual JDK version as part of this ?? >> >> Correct; the webrev to date is the langtools portion of the new JDK >> groundbreaking, the same subset of groundbreaking I looked at for the >> 9 -> 10 transition. Other pieces are needed too, including HotSpot >> changes and the actual version update. > > So what is the overall transition strategy here? I don't see how you > can change javac to default to -source/-target 11 prior to bumping the > actual version to 11. Or do you expect all the additional pieces to > come together at the same time? > For background, what we've done in the past is at the very start of a new JDK release, first create -source/-target ${N+1} that begin as aliases for ${N} and are the default -source/-target for javac. [1] As new language features are developed, the javac implementation adds allowFeatureFoo() predicates which turn into return sourceOptionBeingUsed >= firstSourceWhichAllowsFeature So the operational distinction between -source ${N} and -source ${N+1} comes about after language changes have been made for release ${N+1}. For -target, since there is often not a hard dependency between new Java language features and JVM features, an operational distinction between successive values of -target, and thus successive class file versions, can come about later in the release. For example, in JDK 10 the language feature var/local variable type inference enabled by -source 10 was in JDK 10 builds a few months before -target 10 mapped to an updated class file version. We could follow the same path for the JDK 10 -> 11 transition. Paul has suggested also updating the class file version at the same time this time around. HTH, -Joe [1] Way back when, the new -source/-target values were added without simultaneously being made the default. This increased maintenance costs of javac tests and led us to implement the current policy. From david.holmes at oracle.com Wed Dec 13 04:56:29 2017 From: david.holmes at oracle.com (David Holmes) Date: Wed, 13 Dec 2017 14:56:29 +1000 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> Message-ID: <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> Hi Joe, On 13/12/2017 9:20 AM, joe darcy wrote: > Hi David, > > > On 12/12/2017 1:32 PM, David Holmes wrote: >> Hi Joe, >> >> On 13/12/2017 7:27 AM, joe darcy wrote: >>> Hi David, >>> >>> >>> On 12/12/2017 1:11 PM, David Holmes wrote: >>>> Hi Joe, >>>> >>>> On 12/12/2017 5:04 PM, joe darcy wrote: >>>>> Hello, >>>>> >>>>> With the JDK 11 line of development opening up in a few days, a few >>>>> changes are needed to prepared to turn a JDK 10 code base into a >>>>> JDK 11 one including: >>>>> >>>>> ???? JDK-8173382: Add -source 11 and -target 11 to javac >>>>> ???? JDK-8193291: Add SourceVersion.RELEASE_11 >>>>> >>>>> ???? Webev: >>>>> ???????? http://cr.openjdk.java.net/~darcy/8173382.1/ >>>>> ???? CSRs: >>>>> ???????? JDK-8193350: Add -source 11 and -target 11 to javac >>>>> ???????? JDK-8193351: Add SourceVersion.RELEASE_11 >>>>> >>>>> Please review the preliminary webrev and CSRs. >>>> >>>> I don't see a change to the actual JDK version as part of this ?? >>> >>> Correct; the webrev to date is the langtools portion of the new JDK >>> groundbreaking, the same subset of groundbreaking I looked at for the >>> 9 -> 10 transition. Other pieces are needed too, including HotSpot >>> changes and the actual version update. >> >> So what is the overall transition strategy here? I don't see how you >> can change javac to default to -source/-target 11 prior to bumping the >> actual version to 11. Or do you expect all the additional pieces to >> come together at the same time? >> > > For background, what we've done in the past is at the very start of a > new JDK release, first create -source/-target ${N+1} that begin as > aliases for ${N} and are the default -source/-target for javac. [1] As > new language features are developed, the javac implementation adds > allowFeatureFoo() predicates which turn into > > ??? return sourceOptionBeingUsed >= firstSourceWhichAllowsFeature > > So the operational distinction between -source ${N} and -source ${N+1} > comes about after language changes have been made for release ${N+1}. > For -target, since there is often not a hard dependency between new Java > language features and JVM features, an operational distinction between > successive values of -target, and thus successive class file versions, > can come about later in the release. For example, in JDK 10 the language > feature var/local variable type inference enabled by -source 10 was in > JDK 10 builds a few months before -target 10 mapped to an updated class > file version. > > We could follow the same path for the JDK 10 -> 11 transition. Paul has > suggested also updating the class file version at the same time this > time around. I'm a little unclear as to the distinction between allowing for -source/-target 11 and switching them to be the default. Especially if you incorporate the classfile version change then we would have a JDK reporting itself as JDK 10 but which uses -source/-target 11 and produces version 55 classfiles. I would have thought it a two step process: - prepare for new defaults - switch to new defaults (in conjunction with version change) Anyway, none of the proposed changes have any impact on hotspot AFAICT. It is only when the actual version is updated to 11 that hotspot, and other entities will have to be updated. I'm still unclear if someone is actually driving the entire "update to version 11" process? Is there an umbrella issue for it? Thanks, David > > HTH, > > -Joe > > [1] Way back when, the new -source/-target values were added without > simultaneously being made the default. This increased maintenance costs > of javac tests and led us to implement the current policy. From joe.darcy at oracle.com Wed Dec 13 08:16:32 2017 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 13 Dec 2017 00:16:32 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: <7c9034fd-c538-44a0-95b6-c0b91ee71f43@oracle.com> References: <5A273DEB.5060402@oracle.com> <5A275146.3080903@oracle.com> <7c9034fd-c538-44a0-95b6-c0b91ee71f43@oracle.com> Message-ID: Hello, Catching up on email amid JDK 10 RDP1 activities, the Filer specification states: > During each run of an annotation processing tool, a file with a given > pathname may be created only once. If that file already exists before > the first attempt to create it, the old contents will be deleted. Any > subsequent attempt to create the same file during a run will throw a > |FilerException| > , > as will attempting to create both a class file and source file for the > same type name or same package name. The initial inputs > > to the tool are considered to be created by the zeroth round; > therefore, attempting to create a source or class file corresponding > to one of those inputs will result in a |FilerException| > . > > > In general, processors must not knowingly attempt to overwrite > existing files that were not generated by some processor. A |Filer| > may reject attempts to open a file corresponding to an existing type, > like |java.lang.Object|. Likewise, the invoker of the annotation > processing tool must not knowingly configure the tool such that the > discovered processors will attempt to overwrite existing files that > were not generated. > http://download.java.net/java/jdk10/docs/api/javax/annotation/processing/Filer.html For handling source files in particular: > A source file can also be created to hold information about a package, > including package annotations. To create a source file for a named > package, have the |name| argument be the package's name followed by > |".package-info"|; to create a source file for an unnamed package, use > |"package-info"|. To separate a few cases, the javac Filer implementation tracks state about which files have been opened through the Filer on previous rounds of processing and throws exceptions if an attempt is made to re-open a file. (The check is a bit more involved; the Filer also checks the you don't open a class file for a type you've already opened a source file for, etc.) Package info files are handled the same way too. There is a short regression test on that functionality test/langtools/tools/javac/processing/filer/TestPackageInfo.java but the exception on re-opening isn't explicitly tested there. Let me do a quick check... the implementation has the expected behavior for package-info files explicitly opened by annotation processors.. I'll file a RFE to enhance the test to explicitly cover this case. However, contrary to the documentation, the implementation does not handle the case of a package-info file given on the initial inputs, although types on the initial inputs are checked for properly. I believe something like the patch below to JavacFiler *should* resolve that discrepancy: - ClassSymbol existing; boolean alreadySeen = aggregateGeneratedSourceNames.contains(Pair.of(mod, typename)) || aggregateGeneratedClassNames.contains(Pair.of(mod, typename)) || initialClassNames.contains(typename) || - ((existing = elementUtils.getTypeElement(typename)) != null && - initialInputs.contains(existing.sourcefile)); + containedInInitialInputs(typename); if (alreadySeen) { if (lint) log.warning(Warnings.ProcTypeRecreate(typename)); @@ -731,6 +736,27 @@ } } + private boolean containedInInitialInputs(String typename) { + // Name could be a type name or the name of a package-info file + JavaFileObject sourceFile = null; + + ClassSymbol existingClass = elementUtils.getTypeElement(typename); + if (existingClass != null) { + sourceFile = existingClass.sourcefile; + } else if (typename.endsWith(".package-info")) { + String targetName = typename.substring(0, typename.length() - ".package-info".length()); + PackageSymbol existingPackage = elementUtils.getPackageElement(targetName); + if (existingPackage != null) + sourceFile = existingPackage.sourcefile; + } + return (sourceFile == null) ? false : initialInputs.contains(sourceFile); + } + *However,* the sourcefile field of the PackageSymbol doesn't seem to be getting set to a non-null value via the lookup process. I didn't fully run down which part of JavacElements or Symbol takes care of that. In the broader sense of the intention of the Filer, in the simplest case of input locations and output locations being disjoint, than the rules quoted above should be enforced. However, people can and do run configurations where the input and output locations overlap, complicating implementing the proper intentions. In general, package-info files should be handled analogously to source files for types. HTH, -Joe On 12/5/2017 11:48 PM, Jonathan Gibbons wrote: > > We'll need Joe "Mr Annotation Processing" Darcy to chime in here, but > the Filer is supposed to detect clashes, and prevent > overwriting/overriding symbols. That's definitely supposed to happen > for normal classes/interfaces; I could believe that package-info has > been overlooked, but I would expect it to follow the same guidelines. > > -- Jon > > > On 12/5/17 6:24 PM, Liam Miller-Cushon wrote: >> Is overriding package-infos different or worse than overriding other >> symbols? I've seen a number of examples where the same source file >> was compiled multiple times and the earlier results ended up on the >> class path of the later compilations, so a processor-generated class >> was both on the class path and generated during the compilation. >> Making that an error would be a somewhat invasive breaking change. I >> agree that it should be discouraged, but I'm not sure it's worth >> making an error? (Unless there's something special about >> package-infos that I'm missing.) >> >> On Tue, Dec 5, 2017 at 6:09 PM, Jonathan Gibbons >> > wrote: >> >> Generally, annotation processing is supposed to only create >> information where there was no information previously, so if a >> package had a package-info with annotations, it seems like it >> should be an error to override it with another package-info, with >> or without annotations. >> >> -- Jon >> >> >> On 12/05/2017 05:39 PM, Liam Miller-Cushon wrote: >>> Thanks! If an annotated package-info is loaded from the class >>> path, and then a processor generates a package-info that >>> contains no annotations, the reset is necessary. (The reset >>> isn't necessary if the new package-info is annotated, since the >>> old annotations get overwritten even if they weren't reset >>> between rounds.) >>> >>> On Tue, Dec 5, 2017 at 4:46 PM, Jonathan Gibbons >>> >> > wrote: >>> >>> Liam, >>> >>> What about the case where an annotation processor generates >>> the package-info.java file? Is that a case where it is >>> important to reinit the packge symbol correctly, so that the >>> newly generated code is read? >>> >>> -- Jon >>> >>> >>> On 12/05/2017 03:39 PM, Liam Miller-Cushon wrote: >>> >>> I have a question about the logic in >>> JavacProcessingEnvironment's treeCleaner that resets >>> package-info state between annotation processing rounds [1]. >>> >>> JDK-8193037 describes an issue where package-infos >>> loaded from the classpath are reset by treeCleaner. >>> Those symbols doesn't get reinitialized correctly, and >>> package annotations are not visible during subsequent >>> annotation processing rounds. >>> >>> I wondered if the logic was only meant to apply to >>> package-infos being compiled from source in the current >>> compilation (similar to how module-infos are handle by >>> treeCleaner), but I'm having trouble understanding when >>> that logic is necessary. Commenting out >>> `node.packge.package_info.reset();` and >>> `node.packge.reset();` in treeCleaner doesn't break any >>> jtreg tests. Does anyone have examples where that code >>> is needed? I'd like to add a regression test to ensure >>> the fix for JDK-8193037 doesn't interfere with the >>> original purpose of that code. >>> >>> Thanks, >>> >>> [1] >>> http://hg.openjdk.java.net/jdk/jdk/file/a358ebcfacfb/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#l1518 >>> >>> >>> >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.lahoda at oracle.com Wed Dec 13 13:01:50 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Wed, 13 Dec 2017 14:01:50 +0100 Subject: RFR 8189708: class reading issue with named and annotated parameters In-Reply-To: References: <59E9A5B5.5060200@oracle.com> Message-ID: <5A3124BE.6020202@oracle.com> Sorry for late reply. Seems OK to me, only: -the tests should be in: test/langtools/tools/javac/MethodParameters/8189708 not in: test/tools/javac/MethodParameters/8189708 -test/tools/javac/MethodParameters/8189708/Test.java has a weird license header Vicente, could you please take a look as well? Thanks, Jan On 4.12.2017 22:37, Liam Miller-Cushon wrote: > Hi, is there any more feedback on this? > > On Fri, Oct 20, 2017 at 5:51 PM, Liam Miller-Cushon > wrote: > > Here's an updated patch that incorporates your approach: > http://cr.openjdk.java.net/~cushon/8007720/webrev.01/ > > > I included the fix for JDK-8177486 so I could test the inner class / > enum constructor case. If this looks like it's on the right track > I'll move that part (and the corresponding tests) back into a > separate change. > > On Fri, Oct 20, 2017 at 9:30 AM, Liam Miller-Cushon > > wrote: > > Thanks for the comments, > > On Fri, Oct 20, 2017 at 12:28 AM, Jan Lahoda > > wrote: > > -what happens if there are both runtime invisible and > visible annotations of method's parameters? Seems those that > appear later will overwrite those that appear sooner? > > > Oops, thanks. The way your patch handles that looks good to me. > > -the MethodSymbol.savedParameterAnnotations is only used > during reading inside the ClassReader, right? It seems > wasteful to have it as a field on each MethodSymbol, better > would be a field in ClassReader. > > > Sounds good. I'll try to avoid having savedParameterNames as a > field in MethodSymbol also. Do you remember if you encountered > any issues with that in your patch? > > -please check what happens for annotations on constructors > of enums/non-static innerclasses > > > Will do. (Also, note that there appears to be an issue with > reading MethodParameters on constructors of enums/non-static > inner classes: JDK-8177486) > > > From paul.sandoz at oracle.com Wed Dec 13 16:44:33 2017 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 13 Dec 2017 08:44:33 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> Message-ID: <4AF5DB2E-1C34-4C4A-80BD-D965E1374A9C@oracle.com> > On 12 Dec 2017, at 20:56, David Holmes wrote: > > Anyway, none of the proposed changes have any impact on hotspot AFAICT. It is only when the actual version is updated to 11 that hotspot, and other entities will have to be updated. I'm still unclear if someone is actually driving the entire "update to version 11" process? Is there an umbrella issue for it? > No yet, i was hoping we could consolidate as much as possible under one issue thereby minimising coordination/process i.e. combine the release and class file versions under one patch. Then stand back and see what is missing e.g. ctsym stuff etc. Paul. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 873 bytes Desc: Message signed with OpenPGP URL: From paul.sandoz at oracle.com Wed Dec 13 18:22:33 2017 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 13 Dec 2017 10:22:33 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <4AF5DB2E-1C34-4C4A-80BD-D965E1374A9C@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> <4AF5DB2E-1C34-4C4A-80BD-D965E1374A9C@oracle.com> Message-ID: <65256BE6-46F9-4633-A6FA-455D58787C3A@oracle.com> Joe, Here's a patch on top of your patch: http://cr.openjdk.java.net/~psandoz/jdk/JDK-8173382-release-classfile-version/webrev/ Currently building/testing with both patches applied. Paul. > On 13 Dec 2017, at 08:44, Paul Sandoz wrote: > > > >> On 12 Dec 2017, at 20:56, David Holmes wrote: >> >> Anyway, none of the proposed changes have any impact on hotspot AFAICT. It is only when the actual version is updated to 11 that hotspot, and other entities will have to be updated. I'm still unclear if someone is actually driving the entire "update to version 11" process? Is there an umbrella issue for it? >> > > No yet, i was hoping we could consolidate as much as possible under one issue thereby minimising coordination/process i.e. combine the release and class file versions under one patch. Then stand back and see what is missing e.g. ctsym stuff etc. > > Paul. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 873 bytes Desc: Message signed with OpenPGP URL: From joe.darcy at oracle.com Wed Dec 13 18:36:33 2017 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 13 Dec 2017 10:36:33 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> Message-ID: Hi David, On 12/12/2017 8:56 PM, David Holmes wrote: > Hi Joe, > > On 13/12/2017 9:20 AM, joe darcy wrote: >> Hi David, >> >> >> On 12/12/2017 1:32 PM, David Holmes wrote: >>> [snip] >>> >> >> For background, what we've done in the past is at the very start of a >> new JDK release, first create -source/-target ${N+1} that begin as >> aliases for ${N} and are the default -source/-target for javac. [1] >> As new language features are developed, the javac implementation adds >> allowFeatureFoo() predicates which turn into >> >> return sourceOptionBeingUsed >= firstSourceWhichAllowsFeature >> >> So the operational distinction between -source ${N} and -source >> ${N+1} comes about after language changes have been made for release >> ${N+1}. For -target, since there is often not a hard dependency >> between new Java language features and JVM features, an operational >> distinction between successive values of -target, and thus successive >> class file versions, can come about later in the release. For >> example, in JDK 10 the language feature var/local variable type >> inference enabled by -source 10 was in JDK 10 builds a few months >> before -target 10 mapped to an updated class file version. >> >> We could follow the same path for the JDK 10 -> 11 transition. Paul >> has suggested also updating the class file version at the same time >> this time around. > > I'm a little unclear as to the distinction between allowing for > -source/-target 11 and switching them to be the default. Especially if > you incorporate the classfile version change then we would have a JDK > reporting itself as JDK 10 but which uses -source/-target 11 and > produces version 55 classfiles. I would have thought it a two step > process: > - prepare for new defaults > - switch to new defaults (in conjunction with version change) > > Anyway, none of the proposed changes have any impact on hotspot > AFAICT. It is only when the actual version is updated to 11 that > hotspot, and other entities will have to be updated. I'm still unclear > if someone is actually driving the entire "update to version 11" > process? Is there an umbrella issue for it? > There are various changes associated with a JDK N to (N+1) update including (but not limited to): 1) New -source/-target value in javac 2) Make new -source/-target value the default in javac 3) Change build of the JDK to use new -source/-target 4) Increment version 5) Support new --release value in javac 6) Output new class file format 7) Have HotSpot accept new class file format ... For the last few releases, we've done 1) through 4) in b01 of the new release, although typically via multiple changesets since 4) has been done separately from 1) through 3) and 3) had to be done separately from 1) and 2) since different repos were affected before the repo consolidation. It is desirable but not strictly necessary to bundle this set of updates into as few changesets as possible. In particular, I think it is acceptable if the master repo has source code states before the first promoted build where not all of 1) through 4) are fixed. Cheers, -Joe From joe.darcy at oracle.com Wed Dec 13 18:51:32 2017 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 13 Dec 2017 10:51:32 -0800 Subject: Do package-infos need to be reset between annotation processing rounds? In-Reply-To: References: <5A273DEB.5060402@oracle.com> <5A275146.3080903@oracle.com> <7c9034fd-c538-44a0-95b6-c0b91ee71f43@oracle.com> Message-ID: <40864745-48ce-740e-f35f-2454625fc484@oracle.com> PS Filed JDK-8193462: Fix Filer handling of package-info initial elements The not-quite-working version of the fix is at: http://cr.openjdk.java.net/~darcy/8193462.0/ -Joe From jonathan.gibbons at oracle.com Wed Dec 13 20:43:13 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Wed, 13 Dec 2017 12:43:13 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> Message-ID: On 12/13/17 10:36 AM, joe darcy wrote: > Hi David, > > > On 12/12/2017 8:56 PM, David Holmes wrote: >> Hi Joe, >> >> On 13/12/2017 9:20 AM, joe darcy wrote: >>> Hi David, >>> >>> >>> On 12/12/2017 1:32 PM, David Holmes wrote: >>>> > > [snip] > >>>> >>> >>> For background, what we've done in the past is at the very start of >>> a new JDK release, first create -source/-target ${N+1} that begin as >>> aliases for ${N} and are the default -source/-target for javac. [1] >>> As new language features are developed, the javac implementation >>> adds allowFeatureFoo() predicates which turn into >>> >>> ???? return sourceOptionBeingUsed >= firstSourceWhichAllowsFeature >>> >>> So the operational distinction between -source ${N} and -source >>> ${N+1} comes about after language changes have been made for release >>> ${N+1}. For -target, since there is often not a hard dependency >>> between new Java language features and JVM features, an operational >>> distinction between successive values of -target, and thus >>> successive class file versions, can come about later in the release. >>> For example, in JDK 10 the language feature var/local variable type >>> inference enabled by -source 10 was in JDK 10 builds a few months >>> before -target 10 mapped to an updated class file version. >>> >>> We could follow the same path for the JDK 10 -> 11 transition. Paul >>> has suggested also updating the class file version at the same time >>> this time around. >> >> I'm a little unclear as to the distinction between allowing for >> -source/-target 11 and switching them to be the default. Especially >> if you incorporate the classfile version change then we would have a >> JDK reporting itself as JDK 10 but which uses -source/-target 11 and >> produces version 55 classfiles. I would have thought it a two step >> process: >> - prepare for new defaults >> - switch to new defaults (in conjunction with version change) >> >> Anyway, none of the proposed changes have any impact on hotspot >> AFAICT. It is only when the actual version is updated to 11 that >> hotspot, and other entities will have to be updated. I'm still >> unclear if someone is actually driving the entire "update to version >> 11" process? Is there an umbrella issue for it? >> > > There are various changes associated with a JDK N to (N+1) update > including (but not limited to): > > ??? 1) New -source/-target value in javac > ??? 2) Make new -source/-target value the default in javac > ??? 3) Change build of the JDK to use new -source/-target > ??? 4) Increment version > ??? 5) Support new --release value in javac > ??? 6) Output new class file format > ??? 7) Have HotSpot accept new class file format > ??? ... > > For the last few releases, we've done 1) through 4) in b01 of the new > release, although typically via multiple changesets since 4) has been > done separately from 1) through 3) and 3) had to be done separately > from 1) and 2) since different repos were affected before the repo > consolidation. > > It is desirable but not strictly necessary to bundle this set of > updates into as few changesets as possible. In particular, I think it > is acceptable if the master repo has source code states before the > first promoted build where not all of 1) through 4) are fixed. > > Cheers, > > -Joe There's also 3a) Update build of the INTERIM components (used for bootstrapping the build) to use latest GA release Somewhat related, as a one-off,?? JDK 9 javac added a class called JDK9Wrappers to provide reflective access to new-in-JDK-9 API. These wrappers can now be removed, and the API used directly. -- Jon From mark.reinhold at oracle.com Wed Dec 13 21:18:43 2017 From: mark.reinhold at oracle.com (mark.reinhold at oracle.com) Date: Wed, 13 Dec 2017 13:18:43 -0800 Subject: Initial JDK 11 RFR of JDK-8173382: Add -source 11 and -target 11 to javac - Java Bug System & JDK-8193291: Add SourceVersion.RELEASE_11 In-Reply-To: <4AF5DB2E-1C34-4C4A-80BD-D965E1374A9C@oracle.com> References: <42594f6b-af60-3249-71d9-d64a39c802b4@oracle.com> <316a576c-6c87-fdc1-454d-102f3cfc1191@oracle.com> <30def987-3bf9-61f1-72fc-ce3b9114f555@oracle.com> <3de8b1ea-c737-2629-2689-3e8bda235689@oracle.com> <082194f6-38ca-1a10-4081-704dfb1af4a9@oracle.com> <33cac77e-a465-92c0-464e-9e086699786b@oracle.com> <4AF5DB2E-1C34-4C4A-80BD-D965E1374A9C@oracle.com> Message-ID: <20171213131843.760702080@eggemoggin.niobe.net> 2017/12/13 8:44:33 -0800, paul.sandoz at oracle.com: >> On 12 Dec 2017, at 20:56, david.holmes at oracle.com wrote: >> >> Anyway, none of the proposed changes have any impact on hotspot >> AFAICT. It is only when the actual version is updated to 11 that >> hotspot, and other entities will have to be updated. I'm still >> unclear if someone is actually driving the entire "update to version >> 11" process? Is there an umbrella issue for it? > > No yet, i was hoping we could consolidate as much as possible under > one issue thereby minimising coordination/process i.e. combine the > release and class file versions under one patch. Then stand back and > see what is missing e.g. ctsym stuff etc. How much of this can we parameterize and/or automate? We are going to have to do it every six months, after all. Could we define a CLASSFILE_VERSION in make/autoconf/version-numbers and then propagate that value everywhere else? (In any actual release it'll be VERSION_FEATURE + 44, but make it a separate variable to allow for experimentation as with, e.g., MVT.) Looking at Joe's webrev, many of the changes from 10 to 11 could instead be changed to Runtime.getRuntime().version().major() (in Java code) or VERSION_FEATURE (in Makefiles). In javax.lang.model.SourceVersion we could define a new constant, say RELEASE_CURRENT, whose value is that of the latest release. Then annotations such as @SupportedSourceVersion(SourceVersion.RELEASE_11) could be replaced by @SupportedSourceVersion(SourceVersion.RELEASE_CURRENT) Similarly, JDK_CURRENT could be defined in com.sun.tools.javac.Target and then many references to JDK10 could instead refer to that. In cases where additional code is needed, can we generate it during the build via another Gensrc*.gmk Makefile? That'd be more work now, but it could save us a lot of time in the long run. - Mark From jonathan.gibbons at oracle.com Wed Dec 13 21:43:47 2017 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Wed, 13 Dec 2017 13:43:47 -0800 Subject: RFR: 8182758: Remove the Native-Header Generation Tool (javah) In-Reply-To: <5A04E7F3.5000700@oracle.com> References: <5A04E7F3.5000700@oracle.com> Message-ID: <5A319F13.8010505@oracle.com> Minor tweak to the previous round: a dangling reference to javah was removed from the doc comment in the jdk.compiler module-info (line 30). http://cr.openjdk.java.net/~jjg/8182758/webrev.01/src/jdk.compiler/share/classes/module-info.java.sdiff.html Updated webrev: http://cr.openjdk.java.net/~jjg/8182758/webrev.01/ -- Jon On 11/09/2017 03:42 PM, Jonathan Gibbons wrote: > Please review a fix to remove the javah tool, as previously advertised > in JDK-8152360. (The replacement is to use the javac -h option.) > > Not surprisingly, most of this is removing code, with just a couple of > src/ > files being modified, as well as some tests. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8182758 > Webrev: http://cr.openjdk.java.net/~jjg/8182758/webrev.00/ > > -- Jon From stuart.marks at oracle.com Wed Dec 13 21:38:57 2017 From: stuart.marks at oracle.com (Stuart Marks) Date: Wed, 13 Dec 2017 13:38:57 -0800 Subject: JDK 10 RFR(xs): JDK-8193476 (jdeprscan) additional version updates for JDK 10 Message-ID: <4329d95b-f5f5-7b09-810b-0572274d0f8f@oracle.com> Hi all, Please review a couple version updates for jdeprscan that need to squeak in before JDK 10 closes. Diffs below. Thanks. s'marks diff -r 31bad3096948 -r 7ebe4e27f1d0 src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java Wed Dec 13 10:09:36 2017 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/TraverseProc.java Wed Dec 13 13:30:07 2017 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,14 +45,14 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; -import static javax.lang.model.SourceVersion.RELEASE_9; +import static javax.lang.model.SourceVersion.RELEASE_10; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.Modifier; import javax.lang.model.element.PackageElement; import javax.tools.Diagnostic; - at SupportedSourceVersion(RELEASE_9) + at SupportedSourceVersion(RELEASE_10) @SupportedAnnotationTypes("*") public class TraverseProc extends AbstractProcessor { Elements elements; diff -r 31bad3096948 -r 7ebe4e27f1d0 src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md Wed Dec 13 10:09:36 2017 -0800 +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md Wed Dec 13 13:30:07 2017 -0800 @@ -1,6 +1,6 @@