mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
IDEA-146770 Suggest Math.toIntExact to convert long to int
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap using 'Math.toIntExact()'" "true"
|
||||
public class Test {
|
||||
|
||||
void m(long l) {
|
||||
|
||||
int i = 10;
|
||||
i = Math.toIntExact(l);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Wrap 2nd parameter using 'Math.toIntExact()'" "true"
|
||||
public class Test {
|
||||
|
||||
void longMethod(int k, int thisIsInt) {
|
||||
|
||||
}
|
||||
|
||||
void m(long ll) {
|
||||
longMethod(13, Math.toIntExact(ll));
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Wrap parameter using 'Math.toIntExact()'" "true"
|
||||
|
||||
public class Test {
|
||||
void m(int i) {
|
||||
|
||||
}
|
||||
|
||||
void method() {
|
||||
m(Math.toIntExact(10L));
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap using 'Math.toIntExact()'" "true"
|
||||
public class Test {
|
||||
|
||||
void m() {
|
||||
|
||||
int i = Math.toIntExact(Long.valueOf(123));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Wrap using 'Math.toIntExact()'" "true"
|
||||
public class Test {
|
||||
|
||||
void m(long l) {
|
||||
|
||||
int i = 10;
|
||||
i = l<caret>;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Wrap 2nd parameter using 'Math.toIntExact()'" "true"
|
||||
public class Test {
|
||||
|
||||
void longMethod(int k, int thisIsInt) {
|
||||
|
||||
}
|
||||
|
||||
void m(long ll) {
|
||||
longMethod(13, l<caret>l);
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Wrap parameter using 'Math.toIntExact()'" "true"
|
||||
|
||||
public class Test {
|
||||
void m(int i) {
|
||||
|
||||
}
|
||||
|
||||
void method() {
|
||||
m(10<caret>L);
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Wrap using 'Math.toIntExact()'" "true"
|
||||
public class Test {
|
||||
|
||||
void m() {
|
||||
|
||||
int i = Long.valu<caret>eOf(123);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user