From 6bf741235d3527c2b0a44937c996a15431450d57 Mon Sep 17 00:00:00 2001 From: Alban Auzeill Date: Mon, 19 Jun 2023 13:34:50 +0200 Subject: [PATCH] SONARJAVA-4524 Update rules metadata (#4408) --- .../java/org/sonar/java/it/AutoScanTest.java | 2 +- .../autoscan/autoscan-diff-by-rules.json | 12 -- .../org/sonar/l10n/java/rules/java/S100.html | 12 +- .../org/sonar/l10n/java/rules/java/S101.html | 11 +- .../org/sonar/l10n/java/rules/java/S103.html | 2 +- .../org/sonar/l10n/java/rules/java/S104.html | 7 +- .../org/sonar/l10n/java/rules/java/S105.html | 5 +- .../org/sonar/l10n/java/rules/java/S108.html | 10 +- .../org/sonar/l10n/java/rules/java/S110.html | 24 ++- .../org/sonar/l10n/java/rules/java/S1111.html | 12 +- .../org/sonar/l10n/java/rules/java/S1111.json | 2 +- .../org/sonar/l10n/java/rules/java/S1113.html | 23 ++- .../org/sonar/l10n/java/rules/java/S1113.json | 2 +- .../org/sonar/l10n/java/rules/java/S1114.html | 1 + .../org/sonar/l10n/java/rules/java/S1114.json | 7 +- .../org/sonar/l10n/java/rules/java/S1117.html | 4 +- .../org/sonar/l10n/java/rules/java/S1118.html | 4 +- .../org/sonar/l10n/java/rules/java/S1130.html | 49 +++-- .../org/sonar/l10n/java/rules/java/S1130.json | 2 +- .../org/sonar/l10n/java/rules/java/S1134.html | 4 +- .../org/sonar/l10n/java/rules/java/S1134.json | 2 +- .../org/sonar/l10n/java/rules/java/S1149.html | 20 +- .../org/sonar/l10n/java/rules/java/S1149.json | 2 +- .../org/sonar/l10n/java/rules/java/S1150.html | 17 +- .../org/sonar/l10n/java/rules/java/S1150.json | 2 +- .../org/sonar/l10n/java/rules/java/S1153.html | 12 +- .../org/sonar/l10n/java/rules/java/S1153.json | 4 +- .../org/sonar/l10n/java/rules/java/S1157.html | 24 ++- .../org/sonar/l10n/java/rules/java/S1157.json | 3 +- .../org/sonar/l10n/java/rules/java/S1158.html | 24 ++- .../org/sonar/l10n/java/rules/java/S1161.html | 23 ++- .../org/sonar/l10n/java/rules/java/S1163.html | 11 +- .../org/sonar/l10n/java/rules/java/S1163.json | 2 +- .../org/sonar/l10n/java/rules/java/S1165.html | 23 +-- .../org/sonar/l10n/java/rules/java/S1165.json | 2 +- .../org/sonar/l10n/java/rules/java/S1171.html | 53 +++-- .../org/sonar/l10n/java/rules/java/S1182.html | 20 +- .../org/sonar/l10n/java/rules/java/S1190.html | 36 ++-- .../org/sonar/l10n/java/rules/java/S1191.html | 17 +- .../org/sonar/l10n/java/rules/java/S1193.html | 19 +- .../org/sonar/l10n/java/rules/java/S1195.html | 34 ++-- .../org/sonar/l10n/java/rules/java/S1201.html | 52 +++-- .../org/sonar/l10n/java/rules/java/S121.html | 16 +- .../org/sonar/l10n/java/rules/java/S121.json | 1 - .../org/sonar/l10n/java/rules/java/S1214.html | 99 +++++++--- .../org/sonar/l10n/java/rules/java/S1214.json | 2 +- .../org/sonar/l10n/java/rules/java/S1217.html | 92 ++++++++- .../org/sonar/l10n/java/rules/java/S122.html | 9 +- .../org/sonar/l10n/java/rules/java/S1220.html | 40 ++-- .../org/sonar/l10n/java/rules/java/S1221.html | 32 +-- .../org/sonar/l10n/java/rules/java/S1317.html | 47 ++++- .../org/sonar/l10n/java/rules/java/S1319.html | 42 ++-- .../org/sonar/l10n/java/rules/java/S1452.html | 62 ++++-- .../org/sonar/l10n/java/rules/java/S1596.html | 54 +++-- .../org/sonar/l10n/java/rules/java/S1598.html | 58 +++++- .../org/sonar/l10n/java/rules/java/S1602.html | 44 +++-- .../org/sonar/l10n/java/rules/java/S1604.html | 54 +++-- .../org/sonar/l10n/java/rules/java/S1610.html | 1 + .../org/sonar/l10n/java/rules/java/S1610.json | 6 +- .../org/sonar/l10n/java/rules/java/S1611.html | 11 +- .../org/sonar/l10n/java/rules/java/S1611.json | 2 +- .../org/sonar/l10n/java/rules/java/S1612.html | 50 +++-- .../org/sonar/l10n/java/rules/java/S1640.html | 39 ++-- .../org/sonar/l10n/java/rules/java/S1640.json | 2 +- .../org/sonar/l10n/java/rules/java/S1710.html | 22 ++- .../org/sonar/l10n/java/rules/java/S1844.html | 42 ++-- .../org/sonar/l10n/java/rules/java/S1844.json | 2 +- .../org/sonar/l10n/java/rules/java/S1849.html | 62 ++++-- .../org/sonar/l10n/java/rules/java/S1860.html | 69 ++++--- .../org/sonar/l10n/java/rules/java/S1948.html | 94 ++++++--- .../org/sonar/l10n/java/rules/java/S1989.html | 48 +++-- .../org/sonar/l10n/java/rules/java/S2055.html | 187 ++++++++++++++---- .../org/sonar/l10n/java/rules/java/S2060.html | 77 ++++++-- .../org/sonar/l10n/java/rules/java/S2068.html | 4 +- .../org/sonar/l10n/java/rules/java/S2111.html | 42 ++-- .../org/sonar/l10n/java/rules/java/S2112.html | 35 ++-- .../org/sonar/l10n/java/rules/java/S2114.json | 2 +- .../org/sonar/l10n/java/rules/java/S2116.html | 48 +++-- .../org/sonar/l10n/java/rules/java/S2118.html | 48 +++-- .../org/sonar/l10n/java/rules/java/S2118.json | 2 +- .../org/sonar/l10n/java/rules/java/S2119.html | 52 +++-- .../org/sonar/l10n/java/rules/java/S2121.html | 44 +++-- .../org/sonar/l10n/java/rules/java/S2121.json | 2 +- .../org/sonar/l10n/java/rules/java/S2122.html | 35 +++- .../org/sonar/l10n/java/rules/java/S2127.html | 29 ++- .../org/sonar/l10n/java/rules/java/S2127.json | 2 +- .../org/sonar/l10n/java/rules/java/S2129.html | 27 ++- .../org/sonar/l10n/java/rules/java/S2130.html | 18 +- .../org/sonar/l10n/java/rules/java/S2133.html | 6 +- .../org/sonar/l10n/java/rules/java/S2133.json | 4 +- .../org/sonar/l10n/java/rules/java/S2134.html | 62 ++++-- .../org/sonar/l10n/java/rules/java/S2134.json | 2 +- .../org/sonar/l10n/java/rules/java/S2140.html | 15 +- .../org/sonar/l10n/java/rules/java/S2140.json | 3 +- .../org/sonar/l10n/java/rules/java/S2142.html | 39 ++-- .../org/sonar/l10n/java/rules/java/S2142.json | 2 +- .../org/sonar/l10n/java/rules/java/S2151.html | 28 +-- .../org/sonar/l10n/java/rules/java/S2153.html | 48 ++--- .../org/sonar/l10n/java/rules/java/S2153.json | 2 +- .../org/sonar/l10n/java/rules/java/S2157.html | 99 +++++++--- .../org/sonar/l10n/java/rules/java/S2160.html | 98 +++++---- .../org/sonar/l10n/java/rules/java/S2160.json | 2 +- .../org/sonar/l10n/java/rules/java/S2165.html | 40 +++- .../org/sonar/l10n/java/rules/java/S2235.html | 36 ++-- .../org/sonar/l10n/java/rules/java/S2235.json | 2 +- .../org/sonar/l10n/java/rules/java/S2236.html | 23 ++- .../org/sonar/l10n/java/rules/java/S2390.html | 13 +- .../org/sonar/l10n/java/rules/java/S2390.json | 4 +- .../org/sonar/l10n/java/rules/java/S2437.json | 2 +- .../org/sonar/l10n/java/rules/java/S2438.html | 47 ++--- .../org/sonar/l10n/java/rules/java/S2438.json | 2 +- .../org/sonar/l10n/java/rules/java/S2441.html | 22 ++- .../org/sonar/l10n/java/rules/java/S2441.json | 2 +- .../org/sonar/l10n/java/rules/java/S2442.html | 20 +- .../org/sonar/l10n/java/rules/java/S2442.json | 2 +- .../org/sonar/l10n/java/rules/java/S2445.html | 4 +- .../org/sonar/l10n/java/rules/java/S2446.html | 27 +-- .../org/sonar/l10n/java/rules/java/S2446.json | 2 +- .../org/sonar/l10n/java/rules/java/S2447.html | 32 ++- .../org/sonar/l10n/java/rules/java/S2447.json | 2 +- .../org/sonar/l10n/java/rules/java/S2583.html | 4 +- .../org/sonar/l10n/java/rules/java/S2629.html | 9 +- .../org/sonar/l10n/java/rules/java/S2681.html | 49 ++--- .../org/sonar/l10n/java/rules/java/S2692.html | 41 ++-- .../org/sonar/l10n/java/rules/java/S2757.html | 25 ++- .../org/sonar/l10n/java/rules/java/S2757.json | 2 +- .../org/sonar/l10n/java/rules/java/S2761.html | 35 ++-- .../org/sonar/l10n/java/rules/java/S2925.json | 2 +- .../org/sonar/l10n/java/rules/java/S2975.html | 116 ++++++++--- .../org/sonar/l10n/java/rules/java/S3011.html | 8 +- .../org/sonar/l10n/java/rules/java/S3358.html | 8 +- .../org/sonar/l10n/java/rules/java/S3776.html | 3 +- .../org/sonar/l10n/java/rules/java/S3923.html | 9 +- .../org/sonar/l10n/java/rules/java/S3972.html | 25 ++- .../org/sonar/l10n/java/rules/java/S3973.html | 31 +-- .../org/sonar/l10n/java/rules/java/S4143.html | 5 +- .../org/sonar/l10n/java/rules/java/S4144.html | 17 +- .../org/sonar/l10n/java/rules/java/S4275.html | 2 +- .../org/sonar/l10n/java/rules/java/S4275.json | 2 +- .../org/sonar/l10n/java/rules/java/S4524.html | 25 +-- .../org/sonar/l10n/java/rules/java/S5547.html | 86 ++++---- .../org/sonar/l10n/java/rules/java/S6418.html | 31 ++- .../java/rules/java/Sonar_way_profile.json | 2 - sonarpedia.json | 2 +- 144 files changed, 2278 insertions(+), 1306 deletions(-) diff --git a/its/ruling/src/test/java/org/sonar/java/it/AutoScanTest.java b/its/ruling/src/test/java/org/sonar/java/it/AutoScanTest.java index cd2499f9ab2..57286f8ac2d 100644 --- a/its/ruling/src/test/java/org/sonar/java/it/AutoScanTest.java +++ b/its/ruling/src/test/java/org/sonar/java/it/AutoScanTest.java @@ -188,7 +188,7 @@ public void javaCheckTestSources() throws Exception { * No differences would mean that we find the same issues with and without the bytecode and libraries */ String differences = Files.readString(pathFor(TARGET_ACTUAL + PROJECT_KEY + "-no-binaries_differences")); - assertThat(differences).isEqualTo("Issues differences: 3269"); + assertThat(differences).isEqualTo("Issues differences: 3265"); } private static Path pathFor(String path) { diff --git a/its/ruling/src/test/resources/autoscan/autoscan-diff-by-rules.json b/its/ruling/src/test/resources/autoscan/autoscan-diff-by-rules.json index ac480fc6c20..7d7541f66d4 100644 --- a/its/ruling/src/test/resources/autoscan/autoscan-diff-by-rules.json +++ b/its/ruling/src/test/resources/autoscan/autoscan-diff-by-rules.json @@ -161,12 +161,6 @@ "falseNegatives": 0, "falsePositives": 0 }, - { - "ruleKey": "S1114", - "hasTruePositives": true, - "falseNegatives": 0, - "falsePositives": 0 - }, { "ruleKey": "S1116", "hasTruePositives": true, @@ -587,12 +581,6 @@ "falseNegatives": 11, "falsePositives": 0 }, - { - "ruleKey": "S1610", - "hasTruePositives": true, - "falseNegatives": 4, - "falsePositives": 0 - }, { "ruleKey": "S1611", "hasTruePositives": true, diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100.html index 1232317c668..78c6a5e2456 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S100.html @@ -1,11 +1,11 @@

Why is this an issue?

-

Shared naming conventions allow teams to collaborate efficiently. This rule checks that all method names match a provided regular expression.

-

Noncompliant code example

-

With default provided regular expression ^[a-z][a-zA-Z0-9]*$:

+

Shared naming conventions allow teams to collaborate efficiently.

+

This rule raises an issue when a method name does not match a provided regular expression.

+

For example, with the default provided regular expression ^[a-z][a-zA-Z0-9]*$, the method:

-public int DoSomething(){...}
+public int DoSomething(){...} // Noncompliant
 
-

Compliant solution

+

should be renamed to

 public int doSomething(){...}
 
@@ -13,6 +13,6 @@

Exceptions

Overriding methods are excluded.

 @Override
-public int Do_Something(){...}
+public int Do_Something(){...} // Compliant by exception
 
diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101.html index f772827d774..09f1ed1e20c 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S101.html @@ -1,12 +1,11 @@

Why is this an issue?

-

Shared coding conventions allow teams to collaborate effectively. This rule allows to check that all class names match a provided regular -expression.

-

Noncompliant code example

-

With default provided regular expression ^[A-Z][a-zA-Z0-9]*$:

+

Shared naming conventions allow teams to collaborate efficiently.

+

This rule raises an issue when a class name does not match a provided regular expression.

+

For example, with the default provided regular expression ^[A-Z][a-zA-Z0-9]*$, the class:

-class my_class {...}
+class my_class {...} // Noncompliant
 
-

Compliant solution

+

should be renamed to

 class MyClass {...}
 
diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103.html index 10a9058c202..013131f8714 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S103.html @@ -1,3 +1,3 @@

Why is this an issue?

-

Having to scroll horizontally makes it harder to get a quick overview and understanding of any piece of code.

+

Scrolling horizontally to see a full line of code lowers the code readability.

diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104.html index f6c0dbaa448..cc8ee8fa38f 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S104.html @@ -1,5 +1,6 @@

Why is this an issue?

-

A source file that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to -maintain. Above a specific threshold, it is strongly advised to refactor it into smaller pieces of code which focus on well defined tasks. Those -smaller files will not only be easier to understand but also probably easier to test.

+

A source file that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and, therefore, to +maintain.

+

Above a specific threshold, refactor the file into smaller files whose code focuses on well-defined tasks. Those smaller files will be easier to +understand and easier to test.

diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105.html index 2aab84fc839..2a4251605e3 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S105.html @@ -1,4 +1,5 @@

Why is this an issue?

-

Developers should not need to configure the tab width of their text editors in order to be able to read source code.

-

So the use of the tabulation character must be banned.

+

The tab width can differ from one development environment to another. Using tabs may require other developers to configure their environment (text +editor, preferences, etc.) to read source code.

+

That is why using spaces is preferable.

diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S108.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S108.html index 9aa75a10fc0..6fe17c95c47 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S108.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S108.html @@ -1,10 +1,10 @@

Why is this an issue?

-

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

-

Noncompliant code example

+

An empty code block is confusing. It will require some effort from maintainers to determine if it is intentional or indicates the implementation is +incomplete.

-for (int i = 0; i < 42; i++){}  // Empty on purpose or missing piece of code ?
+for (int i = 0; i < 42; i++){}  // Noncompliant: is the block empty on purpose, or is code missing?
 
+

Removing or filling the empty code blocks takes away ambiguity and generally results in a more straightforward and less surprising code.

Exceptions

-

When a block contains a comment, this block is not considered to be empty unless it is a synchronized block. synchronized -blocks are still considered empty even with comments because they can still affect program flow.

+

The rule ignores code blocks that contain comments unless they are synchronized blocks because these can affect program flow.

diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S110.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S110.html index 63beb6ffe8c..fd0be443f34 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S110.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S110.html @@ -1,10 +1,10 @@

Why is this an issue?

-

Inheritance is certainly one of the most valuable concepts in object-oriented programming. It’s a way to compartmentalize and reuse code by -creating collections of attributes and behaviors called classes which can be based on previously created classes. But abusing this concept by creating -a deep inheritance tree can lead to very complex and unmaintainable source code. Most of the time too deep of an inheritance tree is due to bad object -oriented design which leads to a systematic use of 'inheritance' when 'composition' would be better suited.

-

This rule raises an issue when the inheritance tree, starting from Object has a greater depth than is allowed.

-

For the parameter of the rule, the following rules are applied:

+

Inheritance is one of the most valuable concepts in object-oriented programming. It’s a way to categorize and reuse code by creating collections of +attributes and behaviors called classes, which can be based on previously created classes.

+

But abusing this concept by creating a deep inheritance tree can lead to complex and unmaintainable source code. Often, an inheritance tree +becoming too deep is the symptom of systematic use of "inheritance" when other approaches like "composition" would be better suited.

+

This rule raises an issue when the inheritance tree, starting from Object, has a greater depth than is allowed.

+

The rule has one parameter to filter out classes of the count of inheritance. The following rules apply to define this parameter:

Examples:

-

Exceptions:

+

Exceptions:

The rule stops counting when it encounters a class from one of the following packages (or sub-packages):

+

Resources

+

Documentation

+

Composition over inheritance: difference between composition and inheritance +in object-oriented programming

diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.html index 69833610279..2b321a321aa 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.html @@ -1,6 +1,13 @@

Why is this an issue?

-

According to the official javadoc documentation, this Object.finalize() is called by the garbage collector on an object when garbage collection -determines that there are no more references to the object. Calling this method explicitly breaks this contract and so is misleading.

+

Before it reclaims storage from an object that is no longer referenced, the garbage collector calls finalize() on the object.

+

This is a good time to release resources held by the object.

+

Because the general contract is that the finalize method should only be called once per object, calling this method explicitly is +misleading and does not respect this contract.

+

What is the potential impact?

+

An explicit call to an object’s finalize method will perform operations that most likely were supposed to be performed only when the object was not +referenced anymore by any thread.

+

Since it is an acceptable practice to override the finalize method in any subclass of Object, by invoking it explicitly, we will run +code that was designed to only be ran at a different time.

Noncompliant code example

 public void dispose() throws Throwable {
@@ -9,6 +16,7 @@ 

Noncompliant code example

Resources

diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.json index 8d1dd3651b3..fa96fbc03ba 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1111.json @@ -1,5 +1,5 @@ { - "title": "The Object.finalize() method should not be called", + "title": "The \"Object.finalize()\" method should not be called", "type": "BUG", "status": "ready", "remediation": { diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.html index 81f76dbe18f..81347a39289 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.html @@ -1,20 +1,31 @@

Why is this an issue?

-

The Object.finalize() method is called on an object by the garbage collector when it determines that there are no more references to -the object. But there is absolutely no warranty that this method will be called AS SOON AS the last references to the object are removed. It can be -few microseconds to few minutes later. So when system resources need to be disposed by an object, it’s better to not rely on this asynchronous -mechanism to dispose them.

+

Before it reclaims storage from an object that is no longer referenced, the garbage collector calls finalize() on the object.

+

But there is no guarantee that this method will be called as soon as the last references to the object are removed.

+

It can be few microseconds to few minutes later.

+

For this reason relying on overriding the finalize() method to release resources or to update the state of the program is highly +discouraged.

+

What is the potential impact?

+

More unexpected issues can be caused by relying on the finalize() method to perform important operations on the application state:

+

Noncompliant code example

 public class MyClass {
-  ...
+
+  @Override
   protected void finalize() {
     releaseSomeResources();    // Noncompliant
   }
-  ...
+
 }
 

Resources

diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.json index 16cd7394ddd..9407e453a2b 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1113.json @@ -1,5 +1,5 @@ { - "title": "The Object.finalize() method should not be overridden", + "title": "The \"Object.finalize()\" method should not be overridden", "type": "CODE_SMELL", "status": "ready", "remediation": { diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.html index fb6513fbe7d..4ca94be8155 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.html @@ -1,3 +1,4 @@ +

This rule is deprecated, and will eventually be removed.

Why is this an issue?

Overriding the Object.finalize() method must be done with caution to dispose some system resources.

Calling the super.finalize() at the end of this method implementation is highly recommended in case parent implementations must also diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.json b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.json index a123ee68766..7ebbe7efd6f 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.json +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1114.json @@ -1,15 +1,12 @@ { "title": "\"super.finalize()\" should be called at the end of \"Object.finalize()\" implementations", "type": "BUG", - "status": "ready", + "status": "deprecated", "remediation": { "func": "Constant\/Issue", "constantCost": "5min" }, - "tags": [ - "cwe", - "cert" - ], + "tags": [], "defaultSeverity": "Critical", "ruleSpecification": "RSPEC-1114", "sqKey": "S1114", diff --git a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1117.html b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1117.html index fe4b6a30992..5942c2b9bc0 100644 --- a/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1117.html +++ b/java-checks/src/main/resources/org/sonar/l10n/java/rules/java/S1117.html @@ -1,18 +1,18 @@

Why is this an issue?

Overriding or shadowing a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it could lead maintainers to introduce bugs because they think they’re using one variable but are really using another.

-

Noncompliant code example

 class Foo {
   public int myField;
 
   public void doSomething() {
-    int myField = 0;
+    int myField = 0; // Noncompliant
     ...
   }
 }
 

Resources

+

Documentation