RFR(s): JDK-8205455: jdeprscan issues annotation processor warning regarding RELEASE_10
joe darcy
joe.darcy at oracle.com
Fri Jul 6 03:05:46 UTC 2018
Belatedly catching up on review email, although the fix has already been
reviewed and pushed, I wanted to make a counterpoint for future
consideration.
While it is more future proof to have an annotation processor return
SourceVersion.latest(), doing that can mask actual updates that need to
be made to support the a newer source level. If a new kind of element
were added, it is likely a processor would need to be updated to
maintain its semantics over the expanded set of elements now possible.
Cheers,
-Joe
On 6/25/2018 5:04 PM, Stuart Marks wrote:
>
> Hi Jon,
>
> Good point. It seems fairly unlikely for jdeprscan to be outright
> broken by a model change, given that jdeprscan uses annotation
> processing for class scanning, not source code analysis.
>
> I've posted an updated webrev here:
>
> http://cr.openjdk.java.net/~smarks/reviews/8205455/webrev.1/
>
> (previous patch posted as webrev.0 for completeness)
>
> s'marks
>
>
> On 6/25/18 3:35 PM, Jonathan Gibbons wrote:
>>
>> Stuart,
>>
>> This would be more future-proof if you did not use these lines:
>>
>>
>> - at SupportedSourceVersion(RELEASE_10)
>> + at SupportedSourceVersion(RELEASE_11)
>>
>> but instead provided an override definition like this, taken from
>> test/langtools/tools/javac/lib/JavacTestingAbstractProcessor:
>>
>> /**
>> * Return the latest source version. Unless this method is
>> * overridden, an {@code IllegalStateException} will be thrown if a
>> * subclass has a {@code SupportedSourceVersion} annotation.
>> */
>> @Override
>> public SourceVersion getSupportedSourceVersion() {
>> SupportedSourceVersion ssv =
>> this.getClass().getAnnotation(SupportedSourceVersion.class);
>> if (ssv != null)
>> throw new IllegalStateException("SupportedSourceVersion annotation
>> not supported here.");
>>
>> return SourceVersion.latest();
>> }
>>
>> or, more simply
>>
>> @Override
>> public SourceVersion getSupportedSourceVersion() {
>> return SourceVersion.latest();
>> }
>> On 6/25/18 3:28 PM, Stuart Marks wrote:
>>> Hi all,
>>>
>>> Please review this small changeset that updates one of jdeprscan's
>>> annotation processors to RELEASE_11 in order to prevent warning
>>> messages from being issued. This changeset also includes some
>>> additional output lines so that the output of jdeprscan's
>>> TestRelease.java test is more readable.
>>>
>>> Patch appended below.
>>>
>>> Bug:
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180705/354d6e28/attachment-0001.html>
More information about the compiler-dev
mailing list