Comments (7)
@MichaelHai firstly, let me thank you in name of the SpotBugs team for helping us test our release candidate for 3.1.0.
@h3xstream this seems like something you should handle, being the maintainer of that plugin. At first sight, I'm not sure what synthetic you are looking for on that report that we may be missing in SpotBugs.
from spotbugs.
I've investigated about this, it seems that we can handle it as expected behaviour change.
According to git bisect
, 6c91c0c is the commit which broke this test case.
FindBugs 3.0.1 reported name of anonymous class (e.g. Hello$1
) which is invisible for Java coders. SpotBugs 3.1.0-RC1 reports not only this information but also name of field or local variable, to make it more intuitive. For detail, please refer related bug report.
In sonar-findbugs
's case, it has no field nor local variable, so it reported methodWithViolations
and which line the bug exists. So report becomes more detailed and intuitive, but now it has no <SourceLine>
which tells that Hello$1
is synthetic class.
3.0.1
<BugInstance type="SIC_INNER_SHOULD_BE_STATIC_ANON" priority="3" rank="20" abbrev="SIC" category="PERFORMANCE" instanceHash="48c8b5875e5641892e6dfa53c4ed3003" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
<ShortMessage>Could be refactored into a named static inner class</ShortMessage>
<LongMessage>The class Hello$1 could be refactored into a named _static_ inner class</LongMessage>
<Class classname="Hello$1" primary="true">
<SourceLine classname="Hello$1" start="11" end="13" sourcefile="Hello.java" sourcepath="Hello.java" relSourcepath="Hello.java">
<Message>At Hello.java:[lines 11-13]</Message>
</SourceLine>
<Message>In class Hello$1</Message>
</Class>
<SourceLine classname="Hello$1" start="11" end="13" sourcefile="Hello.java" sourcepath="Hello.java" relSourcepath="Hello.java" synthetic="true">
<Message>At Hello.java:[lines 11-13]</Message>
</SourceLine>
</BugInstance>
3.1.0-RC1
<BugInstance type="SIC_INNER_SHOULD_BE_STATIC_ANON" priority="3" rank="20" abbrev="SIC" category="PERFORMANCE" instanceHash="b3e965ceb7ff56eeaa07f1e7244d5a20" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
<ShortMessage>Could be refactored into a named static inner class</ShortMessage>
<LongMessage>The class Hello$1 could be refactored into a named _static_ inner class</LongMessage>
<Class classname="Hello$1" role="CLASS_ANONYMOUS">
<SourceLine classname="Hello$1" start="11" end="13" sourcefile="Hello.java" sourcepath="Hello.java" relSourcepath="Hello.java">
<Message>At Hello.java:[lines 11-13]</Message>
</SourceLine>
<Message>Anonymous class Hello$1</Message>
</Class>
<Class classname="Hello" primary="true">
<SourceLine classname="Hello" start="5" end="20" sourcefile="Hello.java" sourcepath="Hello.java" relSourcepath="Hello.java">
<Message>At Hello.java:[lines 5-20]</Message>
</SourceLine>
<Message>In class Hello</Message>
</Class>
<Method classname="Hello" name="methodWithViolations" signature="(Ljava/lang/String;)V" isStatic="false" primary="true">
<SourceLine classname="Hello" start="10" end="16" startBytecode="0" endBytecode="75" sourcefile="Hello.java" sourcepath="Hello.java" relSourcepath="Hello.java"/>
<Message>In method Hello.methodWithViolations(String)</Message>
</Method>
<SourceLine classname="Hello" primary="true" start="11" end="11" startBytecode="37" endBytecode="37" sourcefile="Hello.java" sourcepath="Hello.java" relSourcepath="Hello.java">
<Message>At Hello.java:[line 11]</Message>
</SourceLine>
</BugInstance>
from spotbugs.
I've proposed a PR for SonarQubeCommunity, to share how to replace FindBugs with SpotBugs.
from spotbugs.
This is an old test case.. I am not sure what synthetic bug instances are.
from spotbugs.
@KengoTODA amazing work. Good to see it wasn't a change we introduced, I couldn't recall anything that could have produced such a change. I agree the new way to report it is much more intuitive, I'm ok with just changing the test on Sonar's side.
from spotbugs.
Did any new rules were added between FindBugs 3.0.1 and SpotBugs 3.1.0-RC1 ?
I ran a diff and their is only description changes.
from spotbugs.
Did any new rules were added between FindBugs 3.0.1 and SpotBugs 3.1.0-RC1 ?
No rules were added. Please refer https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md#added
from spotbugs.
Related Issues (20)
- Crash in Sonarqube analysis HOT 5
- `DLS_DEAD_LOCAL_STORE` false positives for Hibernate enhanced entities HOT 1
- Treat `@PostConstruct` methods as constructors for `UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR` HOT 1
- DLS_DEAD_LOCAL_STORE issue in Java 21 with pattern matching HOT 2
- Eclipse plug-in: false warning about not built project? HOT 1
- Nullness check FPs and FNs
- False positive: UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS HOT 1
- add an alternate version of EI_EXPOSE_REP HOT 4
- Rank value mismatch with the actual reported value HOT 2
- is it possible to make variable for checksyle version to let me run somthing like HOT 1
- update xsd namespace versions
- GHA for 4.8.4 on release failed to produce changelog. HOT 22
- Getting com.intellij.diagnostic.PluginException Randomly in the IntelliJ Plugin HOT 1
- False positive SING_SINGLETON_GETTER_NOT_SYNCHRONIZED with eager instances HOT 2
- False positive SING_SINGLETON_IMPLEMENTS_SERIALIZABLE with readResolve() present HOT 3
- False positive SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR with reused instances HOT 7
- SE_BAD_FIELD with records and spotbugs-4.8.4 HOT 4
- False Positive: IL_INFINITE_LOOP HOT 6
- Prefix matching behavior of SuppressFBWarnings makes it impossible to suppress just one warning HOT 2
- DataflowAnalysisException in 4.7.3 and 4.8.3 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spotbugs.