Title: Sonar S4973 "==" and "!=" should not be used when "equals" is overridden · Issue #1051 · biojava/biojava · GitHub
Open Graph Title: Sonar S4973 "==" and "!=" should not be used when "equals" is overridden · Issue #1051 · biojava/biojava
X Title: Sonar S4973 "==" and "!=" should not be used when "equals" is overridden · Issue #1051 · biojava/biojava
Description: My company develops software that performs automatic remediation of java code. This software detects defects identified for example by Sonar and automatically applies corrective measures. Maybe you would be interested that we experiment ...
Open Graph Description: My company develops software that performs automatic remediation of java code. This software detects defects identified for example by Sonar and automatically applies corrective measures. Maybe you...
X Description: My company develops software that performs automatic remediation of java code. This software detects defects identified for example by Sonar and automatically applies corrective measures. Maybe you...
Opengraph URL: https://github.com/biojava/biojava/issues/1051
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sonar S4973 \"==\" and \"!=\" should not be used when \"equals\" is overridden","articleBody":"My company develops software that performs automatic remediation of java code. This software detects defects identified for example by Sonar and automatically applies corrective measures. Maybe you would be interested that we experiment our product on your code? For example, we could submit PRs?\r\n\r\nWhen we try the rule S4973 \"==\" and \"!=\" should not be used when \"equals\" is overridden\r\nhttps://rules.sonarsource.com/java/RSPEC-1698\r\n\r\nBelow are the changes made by our software to correct this rule.\r\n\r\n biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java\r\n @@ -140,7 +140,7 @@ public class GFF3FromUniprotBlastHits {\r\n }\r\n proteinIndex = proteinIndex + seq.length();\r\n - if (startIndex != null \u0026\u0026 endIndex != null \u0026\u0026 startIndex != endIndex) {\r\n + if (startIndex != null \u0026\u0026 endIndex != null \u0026\u0026 !startIndex.equals(endIndex)) {\r\n CDSSequence cdsSequence = cdsSequenceList.get(i);\r\n String hitLabel = \"\";\r\n if (transcriptSequence.getStrand() == Strand.POSITIVE) {\r\n\r\n biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java\r\n @@ -140,7 +140,7 @@ public class GFF3FromUniprotBlastHits {\r\n }\r\n proteinIndex = proteinIndex + seq.length();\r\n - if (startIndex != null \u0026\u0026 endIndex != null \u0026\u0026 startIndex != endIndex) {\r\n + if (startIndex != null \u0026\u0026 endIndex != null \u0026\u0026 !startIndex.equals(endIndex)) {\r\n CDSSequence cdsSequence = cdsSequenceList.get(i);\r\n String hitLabel = \"\";\r\n if (transcriptSequence.getStrand() == Strand.POSITIVE) {\r\n\r\n biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java\r\n @@ -373,7 +373,7 @@ public class EcodInstallation implements EcodDatabase {\r\n return false;\r\n // Re-download old copies of \"latest\"\r\n - if(updateFrequency != null \u0026\u0026 requestedVersion == DEFAULT_VERSION ) {\r\n + if(updateFrequency != null \u0026\u0026 requestedVersion.equals(DEFAULT_VERSION) ) {\r\n long mod = f.lastModified();\r\n // Time of last update\r\n Date lastUpdate = new Date();\r\n\r\n biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java\r\n @@ -215,7 +215,7 @@ public class BondMaker {\r\n for (Atom a2:a2s) {\r\n if (a1.getAltLoc() != null \u0026\u0026 a2.getAltLoc()!=null \u0026\u0026\r\n a1.getAltLoc()!=' ' \u0026\u0026 a2.getAltLoc()!=' ' \u0026\u0026\r\n - a1.getAltLoc() != a2.getAltLoc()) {\r\n + !a1.getAltLoc().equals(a2.getAltLoc())) {\r\n logger.debug(\"Skipping bond between atoms with differently named alt locs {} (altLoc '{}') -- {} (altLoc '{}')\",\r\n a1.toString(), a1.getAltLoc(), a2.toString(), a2.getAltLoc());\r\n continue;\r\n\r\n biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java\r\n @@ -366,7 +366,7 @@ public class HelixSolver {\r\n int permutation = -1;\r\n double minDistSq = Double.MAX_VALUE;\r\n for (int j = 0; j \u003c centers.size(); j++) {\r\n - if (seqClusterId.get(i) == seqClusterId.get(j)) {\r\n + if (seqClusterId.get(i) != null \u0026\u0026 seqClusterId.get(i).equals(seqClusterId.get(j))) {\r\n if (!used[j]) {\r\n double dSq = tCenter.distanceSquared(centers.get(j));\r\n if (dSq \u003c minDistSq \u0026\u0026 dSq \u003c= rmsdThresholdSq) {\r\n\r\n biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationSolver.java\r\n @@ -334,7 +334,7 @@ public class RotationSolver implements QuatSymmetrySolver {\r\n int selfaligned = 0;\r\n for (int i = 0; i \u003c permutation.size(); i++) {\r\n int j = permutation.get(i);\r\n - if ( seqClusterId.get(i) != seqClusterId.get(j)) {\r\n + if ( seqClusterId.get(i) != null \u0026\u0026 !seqClusterId.get(i).equals(seqClusterId.get(j))) {\r\n return false;\r\n }\r\n if(i == j ) {\r\n\r\n biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java\r\n @@ -176,7 +176,7 @@ public class SystematicSolver implements QuatSymmetrySolver {\r\n List\u003cInteger\u003e seqClusterId = subunits.getClusterIds();\r\n for (int i = 0; i \u003c permutation.size(); i++) {\r\n int j = permutation.get(i);\r\n - if (seqClusterId.get(i) != seqClusterId.get(j)) {\r\n + if (seqClusterId.get(i) != null \u0026\u0026 !seqClusterId.get(i).equals(seqClusterId.get(j))) {\r\n return false;\r\n }\r\n }\r\n\r\n\r\n","author":{"url":"https://github.com/jlerbsc","@type":"Person","name":"jlerbsc"},"datePublished":"2023-01-10T16:51:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1051/biojava/issues/1051"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8e0272fa-9ef4-15ee-3f30-b0c329f43b8b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A698:28D0:11B5D4B:16B0DBE:69748E02 |
| html-safe-nonce | 735896b9cc1ee93b9c9c8e32460612aa28ce0a39a3e09cffcbc8d85e02d0b25e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjk4OjI4RDA6MTFCNUQ0QjoxNkIwREJFOjY5NzQ4RTAyIiwidmlzaXRvcl9pZCI6IjQxMTM4ODE1ODUyNjAyMDM1MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 93f982c04f4d11eef514acf01f0b470b58014794b9d7cdd18501421ccf000b32 |
| hovercard-subject-tag | issue:1527712585 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/biojava/biojava/1051/issue_layout |
| twitter:image | https://opengraph.githubassets.com/433beae898dac20ec5e762b095a387c184dc6c50d24e52ddabd7e141c608592a/biojava/biojava/issues/1051 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/433beae898dac20ec5e762b095a387c184dc6c50d24e52ddabd7e141c608592a/biojava/biojava/issues/1051 |
| og:image:alt | My company develops software that performs automatic remediation of java code. This software detects defects identified for example by Sonar and automatically applies corrective measures. Maybe you... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jlerbsc |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| turbo-cache-control | no-preview |
| go-import | github.com/biojava/biojava git https://github.com/biojava/biojava.git |
| octolytics-dimension-user_id | 237402 |
| octolytics-dimension-user_login | biojava |
| octolytics-dimension-repository_id | 9199359 |
| octolytics-dimension-repository_nwo | biojava/biojava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9199359 |
| octolytics-dimension-repository_network_root_nwo | biojava/biojava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width