Skip to content

Commit aac0f8d

Browse files
committed
Update issue documentation to latest versions
Also fixed various issues in test example extraction (so many lint checks now include new examples), as well as updating to handle formatting in the latest Markdeep versions (thanks to Simon Marquis for the fixes!)
1 parent ee6c2fa commit aac0f8d

File tree

892 files changed

+13798
-4193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

892 files changed

+13798
-4193
lines changed

docs/api-guide/annotations.md.html

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
val location = context.getLocation(element)
5959
context.report(TEST_ISSUE, element, location, message)
6060
}
61-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6262

6363
All this simple detector does is flag any usage associated with the
6464
given annotation, including some information about the usage.
@@ -73,7 +73,7 @@
7373
@MyAnnotation fun close() = TODO()
7474
}
7575
operator fun Book.get(@MyAnnotation index: Int): Int = TODO()
76-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7777

7878
...and we then run the above detector on the following test case:
7979

@@ -83,7 +83,7 @@
8383
val firstWord = book[0]
8484
book.close()
8585
}
86-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8787

8888
we get the following output:
8989

@@ -97,7 +97,7 @@
9797
src/book.kt:16: Error: METHOD_CALL usage associated with @MyAnnotation on METHOD
9898
book.close()
9999
-------
100-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101101

102102
In the first case, the infix operator “in” will call `contains` under
103103
the hood, and here we've annotated the parameter, so lint visits the
@@ -150,7 +150,7 @@
150150
open class Paperback : Book() {
151151
override fun close() { }
152152
}
153-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154154

155155
then the detector will emit the following incident since the new method
156156
overrides another method that was annotated:
@@ -160,7 +160,7 @@
160160
override fun close() { }
161161
-----
162162
1 errors, 0 warnings
163-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164164

165165
Overriding an annotated element is how the `@CallSuper` detector is
166166
implemented, which makes sure that any method which overrides a method
@@ -184,7 +184,7 @@
184184
}
185185
}
186186
}
187-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188188

189189
Here, lint will flag the various exit points from the method
190190
associated with the annotation:
@@ -197,7 +197,7 @@
197197
return getDefaultCaption()
198198
-------------------
199199
2 errors, 0 warnings
200-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201201

202202
Note also that this would have worked if the annotation had been
203203
inherited from a super method instead of being explicitly set here.
@@ -231,7 +231,7 @@
231231
return type != AnnotationUsageType.METHOD_OVERRIDE &&
232232
super.isApplicableAnnotationUsage(type)
233233
}
234-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
235235

236236
!!! Tip
237237
Notice how we are also calling `super` here and combining the result
@@ -249,7 +249,7 @@
249249
return type != AnnotationUsageType.BINARY &&
250250
type != AnnotationUsageType.EQUALITY
251251
}
252-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
253253

254254
These usage types apply to cases where annotated elements are
255255
compared for equality or using other binary operators. Initially
@@ -277,7 +277,7 @@
277277
src/test/pkg/HalfFloatTest.java:50: Error: Half-float type in expression widened to int [HalfFloat]
278278
Math.round(float1); // Error: should use Half.round
279279
------
280-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281281

282282
### Scopes
283283

@@ -303,7 +303,7 @@
303303
abstract override fun pop(): String
304304
}
305305
}
306-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
306+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
307307

308308
And the following test case:
309309

@@ -314,7 +314,7 @@
314314
fileStack.push("Hello")
315315
fileStack.pop()
316316
}
317-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
318318

319319
Here, `stack.push` call on line 2 resolves to the API method on line 7.
320320
That method is not annotated, but it's inside a class that is annotated
@@ -367,7 +367,7 @@
367367
// outer @CheckReturnValue annotation we're analyzing here
368368
return
369369
}
370-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
370+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
371371

372372
!!! Tip
373373
You only have to worry about this when there are different
@@ -418,7 +418,7 @@
418418
// Require restriction annotations to be annotated everywhere
419419
return false
420420
}
421-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
422422

423423
(Note that the API passes in the fully qualified name of the annotation
424424
in question so you can control this behavior individually for each

0 commit comments

Comments
 (0)