<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<font size="+1"><tt>I think we're reaching diminishing returns
here. Here's how I would think about this:<br>
<br>
- We do an applicability check to see if the annotation _could
apply_ to any of the things we are going to generate. If the
target isn't one of param/method/field/component, we issue an
error.<br>
- If there is an annotation on a component that only applies to
method / param, but the corresponding method/param is explicitly
declare, oh well. We promise to propagate well-formed
annotations to all the places that it would apply, and "zero" is
a valid value of all. <br>
</tt></font><br>
<div class="moz-cite-prefix">On 9/28/2020 6:21 AM, Gavin Bierman
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:D7654199-20C8-4401-B4BC-FFAC0AD4A681@oracle.com">
<pre class="moz-quote-pre" wrap="">There’s one minor corner-case that I bring to your attention. Consider the
following:
@Target(ElementType.METHOD)
@interface A { }
record R(@A int x) {
int x() { return this.x; }
}
The new rules ensure that this is an error as the annotation on the record
component is not propagated anywhere because of the explicit accessor
declaration. However, what if the accessor was annotated with the same
annotation?
@Target(ElementType.METHOD)
@interface A { }
record R(@A int x) {
@A int x() { return this.x; }
}
As it stands, the spec rules this out as an error. For simple annotations,
equality is simple to define, but do we want to attempt to define it for all
kinds of annotations? This feels like it’s not worth the complexity, but I’d be
happy to hear opinions. </pre>
</blockquote>
<br>
</body>
</html>