mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
improve "Method always returns the same value" inspection messages
GitOrigin-RevId: 20ef273a00b17991f4ff94bbbbf94be334af4e60
This commit is contained in:
committed by
intellij-monorepo-bot
parent
91437afcba
commit
1eeef6da62
@@ -321,10 +321,10 @@ inspection.requires.auto.module.message='requires' directive for an automatic mo
|
||||
inspection.requires.auto.module.option=Highlight only transitive dependencies
|
||||
inspection.requires.auto.module.transitive='requires transitive' directive for an automatic module
|
||||
inspection.requires.auto.module=Dependencies on automatic modules
|
||||
inspection.same.return.value.display.name=Method returns the same value
|
||||
inspection.same.return.value.problem.descriptor1=Method and all its derivables always return {0}
|
||||
inspection.same.return.value.problem.descriptor2=All implementations of this method always return {0}
|
||||
inspection.same.return.value.problem.descriptor=Method always returns {0}
|
||||
inspection.same.return.value.display.name=Method always returns the same value
|
||||
inspection.same.return.value.problem.descriptor1=Method <code>#ref()</code> and all its overriding methods always return <code>{0}</code>
|
||||
inspection.same.return.value.problem.descriptor2=All implementations of method <code>#ref()</code> always return <code>{0}</code>
|
||||
inspection.same.return.value.problem.descriptor=Method <code>#ref()</code> always returns <code>{0}</code>
|
||||
inspection.surround.requirenonnull.quickfix=Replace with ''Objects.requireNonNull({0})''
|
||||
inspection.suspicious.array.method.call.display.name=Suspicious 'Arrays' method call
|
||||
inspection.suspicious.array.method.call.problem.arrays=Array types are incompatible: arrays are always different
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.sameReturnValue;
|
||||
|
||||
import com.intellij.analysis.AnalysisScope;
|
||||
@@ -26,11 +26,11 @@ public class SameReturnValueInspection extends GlobalJavaBatchInspectionTool {
|
||||
if (returnValue != null) {
|
||||
final String message;
|
||||
if (refMethod.getDerivedReferences().isEmpty()) {
|
||||
message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor", "<code>" + returnValue + "</code>");
|
||||
message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor", returnValue);
|
||||
} else if (refMethod.hasBody()) {
|
||||
message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor1", "<code>" + returnValue + "</code>");
|
||||
message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor1", returnValue);
|
||||
} else {
|
||||
message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor2", "<code>" + returnValue + "</code>");
|
||||
message = JavaAnalysisBundle.message("inspection.same.return.value.problem.descriptor2", returnValue);
|
||||
}
|
||||
|
||||
final UDeclaration decl = refMethod.getUastElement();
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports methods and method hierarchies in which the return value always appears to
|
||||
be the same constant.
|
||||
Reports methods and method hierarchies that always return the same constant.
|
||||
<p><b>Example:</b></p>
|
||||
<pre><code>
|
||||
class X {
|
||||
int xxx() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,19 +4,19 @@
|
||||
<file>Test.java</file>
|
||||
<line>3</line>
|
||||
<problem_class>Method returns the same value</problem_class>
|
||||
<description>Method always returns <code>0</code></description>
|
||||
<description>Method <code>xxx()</code> always returns <code>0</code></description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>10</line>
|
||||
<problem_class>Method returns the same value</problem_class>
|
||||
<description>Method always returns <code>0</code></description>
|
||||
<description>Method <code>compare()</code> always returns <code>0</code></description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>LambdaWithSameValue.java</file>
|
||||
<line>2</line>
|
||||
<problem_class>Method returns the same value</problem_class>
|
||||
<description>All implementations of this method always return <code>42</code></description>
|
||||
<description>All implementations of method <code>getResult()</code> always return <code>42</code></description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<file>Test.kt</file>
|
||||
<line>2</line>
|
||||
<problem_class>Method returns the same value</problem_class>
|
||||
<description>Method always returns <code>0</code></description>
|
||||
<description>Method <code>xxx()</code> always returns <code>0</code></description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>Test.kt</file>
|
||||
<line>8</line>
|
||||
<problem_class>Method returns the same value</problem_class>
|
||||
<description>Method and all its derivables always return <code>foo</code></description>
|
||||
<description>Method <code>xxx()</code> and all its overriding methods always return <code>foo</code></description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<file>Bar.kt</file>
|
||||
<line>2</line>
|
||||
<problem_class>Method returns the same value</problem_class>
|
||||
<description>Method and all its derivables always return <code>0</code></description>
|
||||
<description>Method <code>xxx()</code> and all its overriding methods always return <code>0</code></description>
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
|
||||
Reference in New Issue
Block a user