File tree Expand file tree Collapse file tree 3 files changed +5
-24
lines changed
common/src/main/java/com/google/auto/common
src/main/java/com/google/auto/value/processor Expand file tree Collapse file tree 3 files changed +5
-24
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public static Visibility effectiveVisibilityOfElement(Element element) {
77
77
Visibility effectiveVisibility = PUBLIC ;
78
78
Element currentElement = element ;
79
79
while (currentElement != null ) {
80
- // NOTE - because that requires Guava 30, which would
80
+ // NOTE: We don't use Guava's Comparators.min() because that requires Guava 30, which would
81
81
// make this library unusable in annotation processors using Bazel < 5.0.
82
82
effectiveVisibility = Ordering .natural ().min (effectiveVisibility , ofElement (currentElement ));
83
83
currentElement = currentElement .getEnclosingElement ();
Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ public TypeMirror visitArray(ArrayType t, Void p) {
236
236
// ImmutableSet<? extends T> target = ImmutableSet.copyOf(actualParameter);
237
237
// We will infer E=<? extends T> and rewrite the formal parameter type to
238
238
// <? extends T>[], which we must simplify to T[].
239
- // TODO - returns null?
239
+ // TODO: what if getExtendsBound() returns null?
240
240
comp = MoreTypes .asWildcard (comp ).getExtendsBound ();
241
241
}
242
242
return typeUtils .getArrayType (comp );
Original file line number Diff line number Diff line change @@ -292,6 +292,9 @@ good to go.
292
292
293
293
## <a name="annotation"></a>... use AutoValue to implement an annotation type?
294
294
295
+ Note : If you are writing your annotation in Kotlin , you don't need to use
296
+ `@AutoAnnotation `, since Kotlin allows you to instantiate annotations directly.
297
+
295
298
Most users should never have the need to programmatically create "fake"
296
299
annotation instances. But if you do, using `@AutoValue ` in the usual way will
297
300
fail because the `Annotation .hashCode` specification is incompatible with
@@ -315,28 +318,6 @@ public class Names {
315
318
}
316
319
```
317
320
318
- In Java the method will usually be static . In Kotlin , which doesn' t have static
319
- methods as such, a normal function can be used:
320
-
321
- ```kotlin
322
- public class Names {
323
- @AutoAnnotation public fun named(value: String): Named {
324
- return AutoAnnotation_Names_named(value);
325
- }
326
- }
327
- ```
328
-
329
- Kotlin also allows you to instantiate annotations directly, so you may not need
330
- AutoAnnotation:
331
-
332
- ```kotlin
333
- public class Names {
334
- public fun named(value: String): Named {
335
- return Named(value = value)
336
- }
337
- }
338
- ```
339
-
340
321
If your annotation has several elements, you may prefer to use `@AutoBuilder `:
341
322
342
323
```java
You can’t perform that action at this time.
0 commit comments