generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix imprecise inspection for MethodHandles.constant (#31)
- Loading branch information
Showing
4 changed files
with
29 additions
and
6 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
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
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
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,13 @@ | ||
import java.lang.invoke.MethodHandle; | ||
import java.lang.invoke.MethodHandles; | ||
|
||
class WrongArgumentTypeInConstant { | ||
private static final MethodHandle a = <warning descr="Expected parameter of type byte but got int.">MethodHandles.constant</warning>(byte.class, 0); | ||
private static final MethodHandle b = <warning descr="Expected parameter of type int but got String.">MethodHandles.constant</warning>(int.class, "Hello World"); // CCE | ||
private static final MethodHandle c = <warning descr="Expected parameter of type byte but got int.">MethodHandles.constant</warning>(byte.class, 0); // CCE | ||
private static final MethodHandle d = MethodHandles.constant(byte.class, (byte) 0); // fine | ||
private static final MethodHandle e = MethodHandles.constant(int.class, (byte) 0); // fine | ||
private static final MethodHandle f = MethodHandles.constant(CharSequence.class, "Hello"); // fine | ||
private static final MethodHandle g = MethodHandles.constant(String.class, (CharSequence) "a"); // fine | ||
private static final MethodHandle h = <warning descr="Expected parameter of type String but got Integer.">MethodHandles.constant</warning>(String.class, Integer.valueOf(1)); // CCE | ||
} |