-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[annot] Add test for Kotlin annotations in Java
Summary: Add some tests where annotations are defined in Kotlin, but are used on Java methods. Reviewed By: rgrig Differential Revision: D64181976 fbshipit-source-id: 472bfa9aa8b4f69766d6ee742d1727cfe07a8af6
- Loading branch information
1 parent
63dd699
commit cb7ff1e
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
infer/tests/codetoanalyze/kotlin/annotreach/CustomAnnotationsJava.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
package codetoanalyze.kotlin.annotreach; | ||
|
||
// Testing when Kotlin annotations are used in Java code | ||
class CustomAnnotationsJava { | ||
@UserDefinedSink | ||
void sink() {} | ||
|
||
@UserDefinedSanitizer | ||
void canCallSink() { | ||
} | ||
|
||
@UserDefinedSource | ||
void source1Bad() { | ||
sink(); | ||
} | ||
|
||
@UserDefinedSource | ||
void source2Ok() { | ||
canCallSink(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
codetoanalyze/kotlin/annotreach/CustomAnnotations.kt, codetoanalyze.kotlin.annotreach.CustomAnnotations.sourceBad():void, 1, CHECKERS_ANNOTATION_REACHABILITY_ERROR, no_bucket, ERROR, [Method sourceBad(), marked as source @UserDefinedSource,calls sink(),sink() defined here, marked as sink @UserDefinedSink] | ||
codetoanalyze/kotlin/annotreach/CustomAnnotations.kt, codetoanalyze.kotlin.annotreach.CustomAnnotations.sourceAndSinkAtTheSameTimeBad():void, 0, CHECKERS_ANNOTATION_REACHABILITY_ERROR, no_bucket, ERROR, [] | ||
codetoanalyze/kotlin/annotreach/CustomAnnotations.kt, codetoanalyze.kotlin.annotreach.CustomAnnotations.sourceWithJavaAnnoBad():void, 1, CHECKERS_ANNOTATION_REACHABILITY_ERROR, no_bucket, ERROR, [Method sourceWithJavaAnnoBad(), marked as source @JavaSource,calls sink(),sink() defined here, marked as sink @UserDefinedSink] | ||
codetoanalyze/kotlin/annotreach/CustomAnnotationsJava.java, codetoanalyze.kotlin.annotreach.CustomAnnotationsJava.source1Bad():void, 1, CHECKERS_ANNOTATION_REACHABILITY_ERROR, no_bucket, ERROR, [Method source1Bad(), marked as source @UserDefinedSource,calls sink(),sink() defined here, marked as sink @UserDefinedSink] |