mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show method calls with () in "Manual min/max calculation" inspection messages
GitOrigin-RevId: 0be6faa7bd6ea391f53bc811fe8f3124424fd950
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ea834397dc
commit
312cbd98d6
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
|
||||
@@ -116,7 +116,7 @@ public class ManualMinMaxCalculationInspection extends AbstractBaseJavaLocalInsp
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return CommonQuickFixBundle.message("fix.replace.with.x", "Math." + (myUseMathMin ? "min" : "max"));
|
||||
return CommonQuickFixBundle.message("fix.replace.with.x.call", "Math." + (myUseMathMin ? "min()" : "max()"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports cases where the minimum or the maximum of two numbers can be calculated using
|
||||
a <code>Math.max()</code> or <code>Math.min()</code> call instead of doing it manually.
|
||||
<p>Example:</p>
|
||||
a <code>Math.max()</code> or <code>Math.min()</code> call, instead of doing it manually.
|
||||
<p><b>Example:</b></p>
|
||||
<pre><code>
|
||||
public int min(int a, int b) {
|
||||
return b < a ? b : a;
|
||||
@@ -16,10 +16,10 @@ a <code>Math.max()</code> or <code>Math.min()</code> call instead of doing it ma
|
||||
</code></pre>
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
Use the <b>Disable for float and double</b> option to disable this inspection for <code>double</code> and <code>float</code>.
|
||||
This is useful because the quick-fix may slightly break semantics for <code>float</code>/
|
||||
<code>double</code> when handling <code>NaN</code>. Nevertheless, in most cases it will actually fix
|
||||
the subtle bug when users do not care about <code>NaN</code>.
|
||||
Use the <b>Disable for float and double</b> option to disable this inspection for <code>double</code> and <code>float</code> types.
|
||||
This is useful because the quick-fix may slightly change the semantics for <code>float</code>/
|
||||
<code>double</code> types when handling <code>NaN</code>. Nevertheless, in most cases this will actually fix
|
||||
a subtle bug where <code>NaN</code> is not taken into account.
|
||||
</p>
|
||||
<p><small>New in 2019.2</small></p>
|
||||
</body>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.max'" "true"
|
||||
// "Replace with 'Math.max()' call" "true"
|
||||
class Test {
|
||||
void test(int a, int b) {
|
||||
/*1*/
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int maxDrain) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int a, int b) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
public int mymin(int a, int b) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class X {
|
||||
void test(int a, int b) {
|
||||
int c = Math.min(a, b);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.max'" "true"
|
||||
// "Replace with 'Math.max()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int a, int b, int c) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
void test(int a, int b) {
|
||||
int c = Math.min(a, b);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.max'" "true"
|
||||
// "Replace with 'Math.max()' call" "true"
|
||||
class Test {
|
||||
|
||||
class A {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int a, int b, String s) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.max'" "true"
|
||||
// "Replace with 'Math.max()' call" "true"
|
||||
class Test {
|
||||
void test(int a, int b) {
|
||||
int c/*0*/ = (((a) <caret> > /*1*/(b)) ? /*2*/(a) : /*3*/(b));
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int maxDrain) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int a, int b) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
public int mymin(int a, int b) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class X {
|
||||
void test(int a, int b) {
|
||||
int c;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.max'" "true"
|
||||
// "Replace with 'Math.max()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int a, int b, int c) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
void test(int a, int b) {
|
||||
int c = a<caret> <= b ? a : b;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.max'" "true"
|
||||
// "Replace with 'Math.max()' call" "true"
|
||||
class Test {
|
||||
|
||||
class A {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with 'Math.min'" "true"
|
||||
// "Replace with 'Math.min()' call" "true"
|
||||
class Test {
|
||||
|
||||
void test(int a, int b, String s) {
|
||||
|
||||
@@ -513,7 +513,7 @@ inspection.labeled.switch.rule.redundant.code.block.message=Labeled rule's code
|
||||
inspection.labeled.switch.rule.redundant.code.fix.name=Unwrap code block of labeled rule
|
||||
inspection.lambda.to.method.call.fix.family.name=Replace lambda expression with method call
|
||||
inspection.lambda.to.method.call.fix.name=Replace lambda expression with ''{0}''
|
||||
inspection.manual.min.max.calculation.description=Can be replaced with ''Math.{0}'' call
|
||||
inspection.manual.min.max.calculation.description=Can be replaced with ''Math.{0}()'' call
|
||||
inspection.manual.min.max.calculation.disable.for.non.integral=Disable for float and double
|
||||
inspection.map.foreach.display.name=Map.forEach() can be used
|
||||
inspection.map.foreach.option.no.loops=Do not report loops
|
||||
|
||||
@@ -14,6 +14,7 @@ fix.remove.redundant=Remove redundant ''{0}''
|
||||
fix.remove.statement=Remove ''{0}'' statement
|
||||
|
||||
fix.replace.with.x=Replace with ''{0}''
|
||||
fix.replace.with.x.call=Replace with ''{0}'' call
|
||||
fix.can.replace.with.x=Can be replaced with ''{0}''
|
||||
fix.replace.x.with.y=Replace ''{0}'' with ''{1}''
|
||||
fix.can.replace.x.with.y=''{0}'' can be replaced with ''{1}''
|
||||
|
||||
Reference in New Issue
Block a user