SpotBugs Report
Produced using SpotBugs 3.1.0-RC5.
Project:
Javolution
Metrics
14226 lines of code analysed,
in 426 classes,
in 21 packages.
High Priority Warnings |
7 |
0.49 |
Medium Priority Warnings |
75 |
5.27 |
Low Priority Warnings |
49 |
3.44 |
Total Warnings
|
131
|
9.21
|
(* Defects per thousand lines of non-commenting source statements)
|
Summary
|
Warnings
Click on each warning link to see a full description of the issue, and
details of how to resolve it.
High
|
Equals checks for incompatible operand
- javolution.text.CharArray.equals(Object) checks for operand being a String
-
In file
CharArray.java
,
line 257
In class javolution.text.CharArray In method javolution.text.CharArray.equals(Object) Actual type String At CharArray.java:[line 257] Another occurrence at CharArray.java:[line 258]
|
High
|
Equals checks for incompatible operand
- javolution.util.FastMap$Unmodifiable.equals(Object) checks for operand being a FastMap
-
In file
FastMap.java
,
line 1645
In class javolution.util.FastMap$Unmodifiable In method javolution.util.FastMap$Unmodifiable.equals(Object) Actual type javolution.util.FastMap At FastMap.java:[line 1645]
|
High
|
Comparison of String parameter using == or !=
- Comparison of String parameter using == or != in javolution.text.CharArray.equals(String)
-
In file
CharArray.java
,
line 315
In class javolution.text.CharArray In method javolution.text.CharArray.equals(String) Actual type String Value loaded from str At CharArray.java:[line 315]
|
Medium |
Superclass uses subclass during initialization
- Initialization of javolution.xml.stream.XMLInputFactory accesses class javolution.xml.stream.XMLInputFactory$Default, which isn't initialized yet
-
In file
XMLInputFactory.java
,
line 57
In class javolution.xml.stream.XMLInputFactory In method javolution.xml.stream.XMLInputFactory.<static initializer for XMLInputFactory>() In class javolution.xml.stream.XMLInputFactory$Default At XMLInputFactory.java:[line 57] Another occurrence at XMLInputFactory.java:[line 252]
|
Medium |
Superclass uses subclass during initialization
- Initialization of javolution.xml.stream.XMLOutputFactory accesses class javolution.xml.stream.XMLOutputFactory$Default, which isn't initialized yet
-
In file
XMLOutputFactory.java
,
line 57
In class javolution.xml.stream.XMLOutputFactory In method javolution.xml.stream.XMLOutputFactory.<static initializer for XMLOutputFactory>() In class javolution.xml.stream.XMLOutputFactory$Default At XMLOutputFactory.java:[line 57] Another occurrence at XMLOutputFactory.java:[line 290]
|
Medium |
Method may fail to close stream
- javolution.text.Text.<static initializer for Text>() may fail to close stream
-
In file
Text.java
,
line 906
In class javolution.text.Text In method javolution.text.Text.<static initializer for Text>() Need to close java.io.Writer At Text.java:[line 906]
|
Medium |
Method may fail to close stream
- javolution.text.TextBuilder.<static initializer for TextBuilder>() may fail to close stream
-
In file
TextBuilder.java
,
line 911
In class javolution.text.TextBuilder In method javolution.text.TextBuilder.<static initializer for TextBuilder>() Need to close java.io.Writer At TextBuilder.java:[line 911]
|
Medium |
Negating the result of compareTo()/compare()
- javolution.util.FastComparator$Lexical.compare(Object, Object) negates the return value of javolution.util.FastComparator$Lexical.compare(Object, Object)
-
In file
FastComparator.java
,
line 293
In class javolution.util.FastComparator$Lexical In method javolution.util.FastComparator$Lexical.compare(Object, Object) Called method javolution.util.FastComparator$Lexical.compare(Object, Object) Return value of javolution.util.FastComparator$Lexical.compare(Object, Object) of type int At FastComparator.java:[line 293]
|
Low |
Comparison of String parameter using == or !=
- Comparison of String parameter using == or != in javolution.text.CharArray.equals(String)
-
In file
CharArray.java
,
line 314
In class javolution.text.CharArray In method javolution.text.CharArray.equals(String) Actual type String Value loaded from str Value loaded from field javolution.text.CharArray._asString At CharArray.java:[line 314]
|
Low |
Class defines hashCode() but not equals()
- javolution.util.FastList defines hashCode but not equals
-
In file
FastList.java
,
lines 197
to 202
In class javolution.util.FastList In method javolution.util.FastList.hashCode() At FastList.java:[lines 197-202]
|
Low |
Superclass uses subclass during initialization
- Initialization of javolution.context.ConcurrentContext accesses class javolution.context.ConcurrentContext$Default, which isn't initialized yet
-
In file
ConcurrentContext.java
,
line 170
In class javolution.context.ConcurrentContext In method javolution.context.ConcurrentContext.<static initializer for ConcurrentContext>() In class javolution.context.ConcurrentContext$Default At ConcurrentContext.java:[line 170] Another occurrence at ConcurrentContext.java:[line 401]
|
Low |
Superclass uses subclass during initialization
- Initialization of javolution.context.StackContext accesses class javolution.context.StackContext$Default, which isn't initialized yet
-
In file
StackContext.java
,
line 62
In class javolution.context.StackContext In method javolution.context.StackContext.<static initializer for StackContext>() In class javolution.context.StackContext$Default At StackContext.java:[line 62] Another occurrence at StackContext.java:[line 294]
|
Low |
Superclass uses subclass during initialization
- Initialization of javolution.testing.TestContext accesses class javolution.testing.TestContext$Regression, which isn't initialized yet
-
In file
TestContext.java
,
line 55
In class javolution.testing.TestContext In method javolution.testing.TestContext.<static initializer for TestContext>() In class javolution.testing.TestContext$Regression At TestContext.java:[line 55] Another occurrence at TestContext.java:[line 228]
|
Low |
Superclass uses subclass during initialization
- Initialization of javolution.testing.TimeContext accesses class javolution.testing.TimeContext$Default, which isn't initialized yet
-
In file
TimeContext.java
,
line 59
In class javolution.testing.TimeContext In method javolution.testing.TimeContext.<static initializer for TimeContext>() In class javolution.testing.TimeContext$Default At TimeContext.java:[line 59] Another occurrence at TimeContext.java:[line 373]
|
Low |
Superclass uses subclass during initialization
- Initialization of javolution.testing.TimeContext accesses class javolution.testing.TimeContext$Regression, which isn't initialized yet
-
In file
TimeContext.java
,
line 44
In class javolution.testing.TimeContext In method javolution.testing.TimeContext.<static initializer for TimeContext>() In class javolution.testing.TimeContext$Regression At TimeContext.java:[line 44] Another occurrence at TimeContext.java:[line 378]
|
Low |
Field names should start with a lower case letter
- The field name javolution.util.Index.NegativeIndices doesn't start with a lower case letter
-
In file
Index.java
,
lines
to
In class javolution.util.Index Field javolution.util.Index.NegativeIndices In Index.java
|
Low |
Field names should start with a lower case letter
- The field name javolution.util.Index.NegativeIndicesLength doesn't start with a lower case letter
-
In file
Index.java
,
lines
to
In class javolution.util.Index Field javolution.util.Index.NegativeIndicesLength In Index.java
|
Low |
Field names should start with a lower case letter
- The field name javolution.util.Index.NoReordering doesn't start with a lower case letter
-
In file
Index.java
,
lines
to
In class javolution.util.Index Field javolution.util.Index.NoReordering In Index.java
|
Low |
Field names should start with a lower case letter
- The field name javolution.util.Index.PositiveIndices doesn't start with a lower case letter
-
In file
Index.java
,
lines
to
In class javolution.util.Index Field javolution.util.Index.PositiveIndices In Index.java
|
Low |
Field names should start with a lower case letter
- The field name javolution.util.Index.PositiveIndicesLength doesn't start with a lower case letter
-
In file
Index.java
,
lines
to
In class javolution.util.Index Field javolution.util.Index.PositiveIndicesLength In Index.java
|
High
|
An apparent infinite recursive loop
- There is an apparent infinite recursive loop in javolution.text.TextFormat$Cursor.getErrorIndex()
-
In file
TextFormat.java
,
line 312
In class javolution.text.TextFormat$Cursor In method javolution.text.TextFormat$Cursor.getErrorIndex() At TextFormat.java:[line 312]
|
Medium |
instanceof will always return false
- instanceof will always return false in javolution.io.AppendableWriter.write(String, int, int), since a String can't be a j2me.lang.CharSequence
-
In file
AppendableWriter.java
,
line 131
In class javolution.io.AppendableWriter In method javolution.io.AppendableWriter.write(String, int, int) Actual type String Expected j2me.lang.CharSequence Value loaded from str At AppendableWriter.java:[line 131]
|
Medium |
instanceof will always return false
- instanceof will always return false in javolution.io.CharSequenceReader.read(char[], int, int), since a j2me.lang.CharSequence can't be a String
-
In file
CharSequenceReader.java
,
line 121
In class javolution.io.CharSequenceReader In method javolution.io.CharSequenceReader.read(char[], int, int) Actual type j2me.lang.CharSequence Expected String Value loaded from csq At CharSequenceReader.java:[line 121]
|
Medium |
instanceof will always return false
- instanceof will always return false in javolution.text.TypeFormat.parseInt(CharSequence, int, TextFormat$Cursor), since a j2me.lang.CharSequence can't be a String
-
In file
TypeFormat.java
,
line 296
In class javolution.text.TypeFormat In method javolution.text.TypeFormat.parseInt(CharSequence, int, TextFormat$Cursor) Actual type j2me.lang.CharSequence Expected String Value loaded from csq At TypeFormat.java:[line 296]
|
Medium |
instanceof will always return false
- instanceof will always return false in javolution.text.TypeFormat.parseLong(CharSequence, int, TextFormat$Cursor), since a j2me.lang.CharSequence can't be a String
-
In file
TypeFormat.java
,
line 551
In class javolution.text.TypeFormat In method javolution.text.TypeFormat.parseLong(CharSequence, int, TextFormat$Cursor) Actual type j2me.lang.CharSequence Expected String Value loaded from csq At TypeFormat.java:[line 551]
|
Medium |
May expose internal representation by returning reference to mutable object
- j2me.nio.ByteBuffer.array() may expose internal representation by returning ByteBuffer._bytes
-
In file
ByteBuffer.java
,
line 77
In class j2me.nio.ByteBuffer In method j2me.nio.ByteBuffer.array() Field j2me.nio.ByteBuffer._bytes At ByteBuffer.java:[line 77]
|
Medium |
May expose internal representation by returning reference to mutable object
- javolution.lang.Reflection$Constructor.getParameterTypes() may expose internal representation by returning Reflection$Constructor._parameterTypes
-
In file
Reflection.java
,
line 426
In class javolution.lang.Reflection$Constructor In method javolution.lang.Reflection$Constructor.getParameterTypes() Field javolution.lang.Reflection$Constructor._parameterTypes At Reflection.java:[line 426]
|
Medium |
May expose internal representation by returning reference to mutable object
- javolution.lang.Reflection$Method.getParameterTypes() may expose internal representation by returning Reflection$Method._parameterTypes
-
In file
Reflection.java
,
line 576
In class javolution.lang.Reflection$Method In method javolution.lang.Reflection$Method.getParameterTypes() Field javolution.lang.Reflection$Method._parameterTypes At Reflection.java:[line 576]
|
Medium |
May expose internal representation by returning reference to mutable object
- javolution.text.CharArray.array() may expose internal representation by returning CharArray._array
-
In file
CharArray.java
,
line 98
In class javolution.text.CharArray In method javolution.text.CharArray.array() Field javolution.text.CharArray._array At CharArray.java:[line 98]
|
Medium |
May expose internal representation by incorporating reference to mutable object
- javolution.io.AppendableWriter.write(char[], int, int) may expose internal representation by storing an externally mutable object into AppendableWriter._tmpBuffer
-
In file
AppendableWriter.java
,
line 98
In class javolution.io.AppendableWriter In method javolution.io.AppendableWriter.write(char[], int, int) Field javolution.io.AppendableWriter._tmpBuffer Local variable named cbuf At AppendableWriter.java:[line 98]
|
Medium |
May expose internal representation by incorporating reference to mutable object
- javolution.text.CharArray.setArray(char[], int, int) may expose internal representation by storing an externally mutable object into CharArray._array
-
In file
CharArray.java
,
line 129
In class javolution.text.CharArray In method javolution.text.CharArray.setArray(char[], int, int) Field javolution.text.CharArray._array Local variable named array At CharArray.java:[line 129]
|
Medium |
Inconsistent synchronization
- Inconsistent synchronization of javolution.context.ConcurrentContext$Default._completed; locked 75% of time
-
In file
ConcurrentContext.java
,
line 331
In class javolution.context.ConcurrentContext$Default Field javolution.context.ConcurrentContext$Default._completed Synchronized 75% of the time Unsynchronized access at ConcurrentContext.java:[line 331] Synchronized access at ConcurrentContext.java:[line 353] Synchronized access at ConcurrentContext.java:[line 380] Synchronized access at ConcurrentContext.java:[line 380]
|
Medium |
Inconsistent synchronization
- Inconsistent synchronization of javolution.context.ConcurrentThread._memoryArea; locked 50% of time
-
In file
ConcurrentThread.java
,
line 86
In class javolution.context.ConcurrentThread Field javolution.context.ConcurrentThread._memoryArea Synchronized 50% of the time Unsynchronized access at ConcurrentThread.java:[line 86] Synchronized access at ConcurrentThread.java:[line 108]
|
Medium |
Inconsistent synchronization
- Inconsistent synchronization of javolution.io.Struct._byteBuffer; locked 42% of time
-
In file
Struct.java
,
line 263
In class javolution.io.Struct Field javolution.io.Struct._byteBuffer Synchronized 42% of the time Unsynchronized access at Struct.java:[line 263] Unsynchronized access at Struct.java:[line 225] Unsynchronized access at Struct.java:[line 225] Synchronized access at Struct.java:[line 229] Synchronized access at Struct.java:[line 230] Synchronized access at Struct.java:[line 238]
|
Low |
Using notify() rather than notifyAll()
- Using notify rather than notifyAll in javolution.context.ConcurrentContext$Default.completed()
-
In file
ConcurrentContext.java
,
line 381
In class javolution.context.ConcurrentContext$Default In method javolution.context.ConcurrentContext$Default.completed() At ConcurrentContext.java:[line 381]
|
Low |
Using notify() rather than notifyAll()
- Using notify rather than notifyAll in javolution.context.ConcurrentThread.execute(Runnable, ConcurrentContext$Default)
-
In file
ConcurrentThread.java
,
line 112
In class javolution.context.ConcurrentThread In method javolution.context.ConcurrentThread.execute(Runnable, ConcurrentContext$Default) At ConcurrentThread.java:[line 112]
|
Low |
Using notify() rather than notifyAll()
- Using notify rather than notifyAll in javolution.context.ConcurrentThread.terminate()
-
In file
ConcurrentThread.java
,
line 121
In class javolution.context.ConcurrentThread In method javolution.context.ConcurrentThread.terminate() At ConcurrentThread.java:[line 121]
|
Low |
Using notify() rather than notifyAll()
- Using notify rather than notifyAll in javolution.util.ReentrantLock.unlock()
-
In file
ReentrantLock.java
,
line 91
In class javolution.util.ReentrantLock In method javolution.util.ReentrantLock.unlock() At ReentrantLock.java:[line 91]
|
Low |
A volatile reference to an array doesn't treat the array elements as volatile
- javolution.xml.XMLFormat._ClassInstances is a volatile reference to an array; the array elements are non-volatile
-
In file
XMLFormat.java
,
lines
to
In class javolution.xml.XMLFormat Field javolution.xml.XMLFormat._ClassInstances In XMLFormat.java
|
High
|
Explicit garbage collection; extremely dubious except in benchmarking code
- javolution.testing.TimeContext.doTest(TestCase) forces garbage collection; extremely dubious except in benchmarking code
-
In file
TimeContext.java
,
line 193
In class javolution.testing.TimeContext In method javolution.testing.TimeContext.doTest(TestCase) At TimeContext.java:[line 193]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.context.ConcurrentContext.<static initializer for ConcurrentContext>() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
ConcurrentContext.java
,
line 178
In class javolution.context.ConcurrentContext In method javolution.context.ConcurrentContext.<static initializer for ConcurrentContext>() Called method new Integer(int) Should call Integer.valueOf(int) instead At ConcurrentContext.java:[line 178]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.context.ConcurrentContext.setConcurrency(int) invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
ConcurrentContext.java
,
line 238
In class javolution.context.ConcurrentContext In method javolution.context.ConcurrentContext.setConcurrency(int) Called method new Integer(int) Should call Integer.valueOf(int) instead At ConcurrentContext.java:[line 238]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.ContextTestSuite$Concurrency.validate() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
ContextTestSuite.java
,
line 85
In class javolution.ContextTestSuite$Concurrency In method javolution.ContextTestSuite$Concurrency.validate() Called method new Integer(int) Should call Integer.valueOf(int) instead At ContextTestSuite.java:[line 85] Another occurrence at ContextTestSuite.java:[line 86]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.io.Struct.<static initializer for Struct>() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
Struct.java
,
line 145
In class javolution.io.Struct In method javolution.io.Struct.<static initializer for Struct>() Called method new Integer(int) Should call Integer.valueOf(int) instead At Struct.java:[line 145]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat.<static initializer for TextFormat>() invokes inefficient new Byte(byte) constructor; use Byte.valueOf(byte) instead
-
In file
TextFormat.java
,
line 553
In class javolution.text.TextFormat In method javolution.text.TextFormat.<static initializer for TextFormat>() Called method new Byte(byte) Should call Byte.valueOf(byte) instead At TextFormat.java:[line 553]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat.<static initializer for TextFormat>() invokes inefficient new Character(char) constructor; use Character.valueOf(char) instead
-
In file
TextFormat.java
,
line 541
In class javolution.text.TextFormat In method javolution.text.TextFormat.<static initializer for TextFormat>() Called method new Character(char) Should call Character.valueOf(char) instead At TextFormat.java:[line 541]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat.<static initializer for TextFormat>() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
TextFormat.java
,
line 577
In class javolution.text.TextFormat In method javolution.text.TextFormat.<static initializer for TextFormat>() Called method new Integer(int) Should call Integer.valueOf(int) instead At TextFormat.java:[line 577]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat.<static initializer for TextFormat>() invokes inefficient new Long(long) constructor; use Long.valueOf(long) instead
-
In file
TextFormat.java
,
line 589
In class javolution.text.TextFormat In method javolution.text.TextFormat.<static initializer for TextFormat>() Called method new Long(long) Should call Long.valueOf(long) instead At TextFormat.java:[line 589]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat.<static initializer for TextFormat>() invokes inefficient new Short(short) constructor; use Short.valueOf(short) instead
-
In file
TextFormat.java
,
line 565
In class javolution.text.TextFormat In method javolution.text.TextFormat.<static initializer for TextFormat>() Called method new Short(short) Should call Short.valueOf(short) instead At TextFormat.java:[line 565]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat$2.parse(CharSequence, TextFormat$Cursor) invokes inefficient new Character(char) constructor; use Character.valueOf(char) instead
-
In file
TextFormat.java
,
line 549
In class javolution.text.TextFormat$2 In method javolution.text.TextFormat$2.parse(CharSequence, TextFormat$Cursor) Called method new Character(char) Should call Character.valueOf(char) instead At TextFormat.java:[line 549]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat$3.parse(CharSequence, TextFormat$Cursor) invokes inefficient new Byte(byte) constructor; use Byte.valueOf(byte) instead
-
In file
TextFormat.java
,
line 561
In class javolution.text.TextFormat$3 In method javolution.text.TextFormat$3.parse(CharSequence, TextFormat$Cursor) Called method new Byte(byte) Should call Byte.valueOf(byte) instead At TextFormat.java:[line 561]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat$4.parse(CharSequence, TextFormat$Cursor) invokes inefficient new Short(short) constructor; use Short.valueOf(short) instead
-
In file
TextFormat.java
,
line 573
In class javolution.text.TextFormat$4 In method javolution.text.TextFormat$4.parse(CharSequence, TextFormat$Cursor) Called method new Short(short) Should call Short.valueOf(short) instead At TextFormat.java:[line 573]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat$5.parse(CharSequence, TextFormat$Cursor) invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
TextFormat.java
,
line 585
In class javolution.text.TextFormat$5 In method javolution.text.TextFormat$5.parse(CharSequence, TextFormat$Cursor) Called method new Integer(int) Should call Integer.valueOf(int) instead At TextFormat.java:[line 585]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.text.TextFormat$6.parse(CharSequence, TextFormat$Cursor) invokes inefficient new Long(long) constructor; use Long.valueOf(long) instead
-
In file
TextFormat.java
,
line 597
In class javolution.text.TextFormat$6 In method javolution.text.TextFormat$6.parse(CharSequence, TextFormat$Cursor) Called method new Long(long) Should call Long.valueOf(long) instead At TextFormat.java:[line 597]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.util.Index.<static initializer for Index>() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
Index.java
,
line 52
In class javolution.util.Index In method javolution.util.Index.<static initializer for Index>() Called method new Integer(int) Should call Integer.valueOf(int) instead At Index.java:[line 52] Another occurrence at Index.java:[line 63]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding.<static initializer for XMLBinding>() invokes inefficient new Byte(byte) constructor; use Byte.valueOf(byte) instead
-
In file
XMLBinding.java
,
line 629
In class javolution.xml.XMLBinding In method javolution.xml.XMLBinding.<static initializer for XMLBinding>() Called method new Byte(byte) Should call Byte.valueOf(byte) instead At XMLBinding.java:[line 629]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding.<static initializer for XMLBinding>() invokes inefficient new Character(char) constructor; use Character.valueOf(char) instead
-
In file
XMLBinding.java
,
line 656
In class javolution.xml.XMLBinding In method javolution.xml.XMLBinding.<static initializer for XMLBinding>() Called method new Character(char) Should call Character.valueOf(char) instead At XMLBinding.java:[line 656]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding.<static initializer for XMLBinding>() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
XMLBinding.java
,
line 715
In class javolution.xml.XMLBinding In method javolution.xml.XMLBinding.<static initializer for XMLBinding>() Called method new Integer(int) Should call Integer.valueOf(int) instead At XMLBinding.java:[line 715]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding.<static initializer for XMLBinding>() invokes inefficient new Long(long) constructor; use Long.valueOf(long) instead
-
In file
XMLBinding.java
,
line 741
In class javolution.xml.XMLBinding In method javolution.xml.XMLBinding.<static initializer for XMLBinding>() Called method new Long(long) Should call Long.valueOf(long) instead At XMLBinding.java:[line 741]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding.<static initializer for XMLBinding>() invokes inefficient new Short(short) constructor; use Short.valueOf(short) instead
-
In file
XMLBinding.java
,
line 688
In class javolution.xml.XMLBinding In method javolution.xml.XMLBinding.<static initializer for XMLBinding>() Called method new Short(short) Should call Short.valueOf(short) instead At XMLBinding.java:[line 688]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding$10.newInstance(Class, XMLFormat$InputElement) invokes inefficient new Character(char) constructor; use Character.valueOf(char) instead
-
In file
XMLBinding.java
,
line 669
In class javolution.xml.XMLBinding$10 In method javolution.xml.XMLBinding$10.newInstance(Class, XMLFormat$InputElement) Called method new Character(char) Should call Character.valueOf(char) instead At XMLBinding.java:[line 669]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding$11.newInstance(Class, XMLFormat$InputElement) invokes inefficient new Short(short) constructor; use Short.valueOf(short) instead
-
In file
XMLBinding.java
,
line 697
In class javolution.xml.XMLBinding$11 In method javolution.xml.XMLBinding$11.newInstance(Class, XMLFormat$InputElement) Called method new Short(short) Should call Short.valueOf(short) instead At XMLBinding.java:[line 697]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding$12.newInstance(Class, XMLFormat$InputElement) invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
XMLBinding.java
,
line 724
In class javolution.xml.XMLBinding$12 In method javolution.xml.XMLBinding$12.newInstance(Class, XMLFormat$InputElement) Called method new Integer(int) Should call Integer.valueOf(int) instead At XMLBinding.java:[line 724]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding$13.newInstance(Class, XMLFormat$InputElement) invokes inefficient new Long(long) constructor; use Long.valueOf(long) instead
-
In file
XMLBinding.java
,
line 751
In class javolution.xml.XMLBinding$13 In method javolution.xml.XMLBinding$13.newInstance(Class, XMLFormat$InputElement) Called method new Long(long) Should call Long.valueOf(long) instead At XMLBinding.java:[line 751]
|
Medium |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.xml.XMLBinding$9.newInstance(Class, XMLFormat$InputElement) invokes inefficient new Byte(byte) constructor; use Byte.valueOf(byte) instead
-
In file
XMLBinding.java
,
line 638
In class javolution.xml.XMLBinding$9 In method javolution.xml.XMLBinding$9.newInstance(Class, XMLFormat$InputElement) Called method new Byte(byte) Should call Byte.valueOf(byte) instead At XMLBinding.java:[line 638]
|
Medium |
Method allocates an object, only to get the class object
- javolution.context.ConcurrentContext$Default.<static initializer for Default>() allocates an object, only to get the class object
-
In file
ConcurrentContext.java
,
line 278
In class javolution.context.ConcurrentContext$Default In method javolution.context.ConcurrentContext$Default.<static initializer for Default>() At ConcurrentContext.java:[line 278]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- new javolution.context.ConcurrentThread() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
ConcurrentThread.java
,
line 49
In class javolution.context.ConcurrentThread In method new javolution.context.ConcurrentThread() At ConcurrentThread.java:[line 49]
|
Medium |
Method allocates an object, only to get the class object
- javolution.context.HeapContext.<static initializer for HeapContext>() allocates an object, only to get the class object
-
In file
HeapContext.java
,
line 55
In class javolution.context.HeapContext In method javolution.context.HeapContext.<static initializer for HeapContext>() At HeapContext.java:[line 55]
|
Medium |
Method allocates an object, only to get the class object
- javolution.context.ImmortalContext.<static initializer for ImmortalContext>() allocates an object, only to get the class object
-
In file
ImmortalContext.java
,
line 60
In class javolution.context.ImmortalContext In method javolution.context.ImmortalContext.<static initializer for ImmortalContext>() At ImmortalContext.java:[line 60]
|
Medium |
Method allocates an object, only to get the class object
- javolution.context.LocalContext.<static initializer for LocalContext>() allocates an object, only to get the class object
-
In file
LocalContext.java
,
line 42
In class javolution.context.LocalContext In method javolution.context.LocalContext.<static initializer for LocalContext>() At LocalContext.java:[line 42]
|
Medium |
Method allocates an object, only to get the class object
- javolution.context.LogContext.<static initializer for LogContext>() allocates an object, only to get the class object
-
In file
LogContext.java
,
line 96
In class javolution.context.LogContext In method javolution.context.LogContext.<static initializer for LogContext>() At LogContext.java:[line 96] Another occurrence at LogContext.java:[line 102] Another occurrence at LogContext.java:[line 109]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.context.StackContext.<static initializer for StackContext>() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
StackContext.java
,
line 68
In class javolution.context.StackContext In method javolution.context.StackContext.<static initializer for StackContext>() At StackContext.java:[line 68]
|
Medium |
Method allocates an object, only to get the class object
- javolution.context.StackContext$Default.<static initializer for Default>() allocates an object, only to get the class object
-
In file
StackContext.java
,
line 156
In class javolution.context.StackContext$Default In method javolution.context.StackContext$Default.<static initializer for Default>() At StackContext.java:[line 156]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.testing.TestContext.<static initializer for TestContext>() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
TestContext.java
,
line 142
In class javolution.testing.TestContext In method javolution.testing.TestContext.<static initializer for TestContext>() At TestContext.java:[line 142] Another occurrence at TestContext.java:[line 143]
|
Medium |
Method allocates an object, only to get the class object
- javolution.testing.TestContext$Regression.<static initializer for Regression>() allocates an object, only to get the class object
-
In file
TestContext.java
,
line 179
In class javolution.testing.TestContext$Regression In method javolution.testing.TestContext$Regression.<static initializer for Regression>() At TestContext.java:[line 179]
|
Medium |
Method allocates an object, only to get the class object
- javolution.testing.TimeContext$Default.<static initializer for Default>() allocates an object, only to get the class object
-
In file
TimeContext.java
,
line 247
In class javolution.testing.TimeContext$Default In method javolution.testing.TimeContext$Default.<static initializer for Default>() At TimeContext.java:[line 247]
|
Medium |
Method allocates an object, only to get the class object
- javolution.testing.TimeContext$Regression.<static initializer for Regression>() allocates an object, only to get the class object
-
In file
TimeContext.java
,
line 343
In class javolution.testing.TimeContext$Regression In method javolution.testing.TimeContext$Regression.<static initializer for Regression>() At TimeContext.java:[line 343]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.text.TextFormat.<static initializer for TextFormat>() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
TextFormat.java
,
line 529
In class javolution.text.TextFormat In method javolution.text.TextFormat.<static initializer for TextFormat>() At TextFormat.java:[line 529]
|
Medium |
Method allocates an object, only to get the class object
- javolution.text.TextFormat.<static initializer for TextFormat>() allocates an object, only to get the class object
-
In file
TextFormat.java
,
line 529
In class javolution.text.TextFormat In method javolution.text.TextFormat.<static initializer for TextFormat>() At TextFormat.java:[line 529] Another occurrence at TextFormat.java:[line 541] Another occurrence at TextFormat.java:[line 553] Another occurrence at TextFormat.java:[line 565] Another occurrence at TextFormat.java:[line 577] Another occurrence at TextFormat.java:[line 589]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.text.TextFormat$1.parse(CharSequence, TextFormat$Cursor) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
TextFormat.java
,
line 537
In class javolution.text.TextFormat$1 In method javolution.text.TextFormat$1.parse(CharSequence, TextFormat$Cursor) At TextFormat.java:[line 537]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.util.FastComparator.<static initializer for FastComparator>() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
FastComparator.java
,
line 34
In class javolution.util.FastComparator In method javolution.util.FastComparator.<static initializer for FastComparator>() At FastComparator.java:[line 34]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.xml.stream.XMLInputFactory$Default.getProperty(String) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
XMLInputFactory.java
,
line 211
In class javolution.xml.stream.XMLInputFactory$Default In method javolution.xml.stream.XMLInputFactory$Default.getProperty(String) At XMLInputFactory.java:[line 211]
|
Medium |
Method allocates an object, only to get the class object
- javolution.xml.stream.XMLInputFactory$Default.<static initializer for Default>() allocates an object, only to get the class object
-
In file
XMLInputFactory.java
,
line 167
In class javolution.xml.stream.XMLInputFactory$Default In method javolution.xml.stream.XMLInputFactory$Default.<static initializer for Default>() At XMLInputFactory.java:[line 167]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- new javolution.xml.stream.XMLOutputFactory$Default() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
XMLOutputFactory.java
,
line 176
In class javolution.xml.stream.XMLOutputFactory$Default In method new javolution.xml.stream.XMLOutputFactory$Default() At XMLOutputFactory.java:[line 176] Another occurrence at XMLOutputFactory.java:[line 182]
|
Medium |
Method allocates an object, only to get the class object
- javolution.xml.stream.XMLOutputFactory$Default.<static initializer for Default>() allocates an object, only to get the class object
-
In file
XMLOutputFactory.java
,
line 173
In class javolution.xml.stream.XMLOutputFactory$Default In method javolution.xml.stream.XMLOutputFactory$Default.<static initializer for Default>() At XMLOutputFactory.java:[line 173]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.xml.stream.XMLStreamReaderImpl.getProperty(String) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
XMLStreamReaderImpl.java
,
line 1190
In class javolution.xml.stream.XMLStreamReaderImpl In method javolution.xml.stream.XMLStreamReaderImpl.getProperty(String) At XMLStreamReaderImpl.java:[line 1190]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.xml.stream.XMLStreamWriterImpl.getProperty(String) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
XMLStreamWriterImpl.java
,
line 564
In class javolution.xml.stream.XMLStreamWriterImpl In method javolution.xml.stream.XMLStreamWriterImpl.getProperty(String) At XMLStreamWriterImpl.java:[line 564] Another occurrence at XMLStreamWriterImpl.java:[line 568]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.xml.XMLBinding.<static initializer for XMLBinding>() invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
XMLBinding.java
,
line 602
In class javolution.xml.XMLBinding In method javolution.xml.XMLBinding.<static initializer for XMLBinding>() At XMLBinding.java:[line 602]
|
Medium |
Method allocates an object, only to get the class object
- javolution.xml.XMLBinding.<static initializer for XMLBinding>() allocates an object, only to get the class object
-
In file
XMLBinding.java
,
line 395
In class javolution.xml.XMLBinding In method javolution.xml.XMLBinding.<static initializer for XMLBinding>() At XMLBinding.java:[line 395] Another occurrence at XMLBinding.java:[line 602] Another occurrence at XMLBinding.java:[line 629] Another occurrence at XMLBinding.java:[line 656] Another occurrence at XMLBinding.java:[line 688] Another occurrence at XMLBinding.java:[line 715] Another occurrence at XMLBinding.java:[line 742] Another occurrence at XMLBinding.java:[line 854] Another occurrence at XMLBinding.java:[line 983]
|
Medium |
Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
- javolution.xml.XMLBinding$8.newInstance(Class, XMLFormat$InputElement) invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead
-
In file
XMLBinding.java
,
line 611
In class javolution.xml.XMLBinding$8 In method javolution.xml.XMLBinding$8.newInstance(Class, XMLFormat$InputElement) At XMLBinding.java:[line 611]
|
Low |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.testing.TimeContext.<static initializer for TimeContext>() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
TimeContext.java
,
line 52
In class javolution.testing.TimeContext In method javolution.testing.TimeContext.<static initializer for TimeContext>() Called method new Integer(int) Should call Integer.valueOf(int) instead At TimeContext.java:[line 52]
|
Low |
Method invokes inefficient Number constructor; use static valueOf instead
- javolution.UtilTestSuite.<static initializer for UtilTestSuite>() invokes inefficient new Integer(int) constructor; use Integer.valueOf(int) instead
-
In file
UtilTestSuite.java
,
line 38
In class javolution.UtilTestSuite In method javolution.UtilTestSuite.<static initializer for UtilTestSuite>() Called method new Integer(int) Should call Integer.valueOf(int) instead At UtilTestSuite.java:[line 38]
|
Low |
Could be refactored into a named static inner class
- The class javolution.context.ObjectFactory$2 could be refactored into a named _static_ inner class
-
In file
ObjectFactory.java
,
line 158
Anonymous class javolution.context.ObjectFactory$2 In class javolution.context.ObjectFactory In method new javolution.context.ObjectFactory() At ObjectFactory.java:[line 158] Field javolution.context.ObjectFactory._localAllocator
|
Low |
Could be refactored into a named static inner class
- The class javolution.context.StackContext$Default$1 could be refactored into a named _static_ inner class
-
In file
StackContext.java
,
line 158
Anonymous class javolution.context.StackContext$Default$1 In class javolution.context.StackContext$Default In method new javolution.context.StackContext$Default() At StackContext.java:[line 158] Field javolution.context.StackContext$Default._factoryToAllocator
|
Low |
Could be refactored into a named static inner class
- The class javolution.context.StackContext$Default$2 could be refactored into a named _static_ inner class
-
In file
StackContext.java
,
line 164
Anonymous class javolution.context.StackContext$Default$2 In class javolution.context.StackContext$Default In method new javolution.context.StackContext$Default() At StackContext.java:[line 164] Field javolution.context.StackContext$Default._activeAllocators
|
Low |
Unread field
- Unread field: javolution.util.Index.NoReordering
-
In file
Index.java
,
line 208
In class javolution.util.Index Field javolution.util.Index.NoReordering At Index.java:[line 208]
|
High
|
Dead store to local variable
- Dead store to l in javolution.lang.MathLib.bitLength(long)
-
In file
MathLib.java
,
line 160
In class javolution.lang.MathLib In method javolution.lang.MathLib.bitLength(long) Local variable named l At MathLib.java:[line 160]
|
High
|
Condition has no effect
- Useless condition: it's known that byte0 != 60 ('<') at this point
-
In file
XMLStreamReaderImpl.java
,
line 1484
In class javolution.xml.stream.XMLStreamReaderImpl In method javolution.xml.stream.XMLStreamReaderImpl.detectEncoding(InputStream) Value byte0 != 60 ('<') Unreachable code at XMLStreamReaderImpl.java:[line 1484] At XMLStreamReaderImpl.java:[line 1484]
|
Medium |
Unsigned right shift cast to short/byte
- Unsigned right shift cast to short/byte in javolution.io.Struct$Unsigned8.get()
-
In file
Struct.java
,
line 1032
In class javolution.io.Struct$Unsigned8 In method javolution.io.Struct$Unsigned8.get() At Struct.java:[line 1032]
|
Medium |
Dead store to local variable
- Dead store to l in javolution.lang.MathLib.digitLength(long)
-
In file
MathLib.java
,
line 201
In class javolution.lang.MathLib In method javolution.lang.MathLib.digitLength(long) Local variable named l At MathLib.java:[line 201]
|
Medium |
Dead store to local variable
- Dead store to c in javolution.xml.stream.XMLStreamReaderImpl.replaceEntity()
-
In file
XMLStreamReaderImpl.java
,
line 944
In class javolution.xml.stream.XMLStreamReaderImpl In method javolution.xml.stream.XMLStreamReaderImpl.replaceEntity() Local variable named c At XMLStreamReaderImpl.java:[line 944]
|
Medium |
Load of known null value
- Load of known null value in javolution.io.Struct$Reference64.set(Struct)
-
In file
Struct.java
,
line 1366
In class javolution.io.Struct$Reference64 In method javolution.io.Struct$Reference64.set(Struct) Value loaded from struct At Struct.java:[line 1366]
|
Medium |
Redundant nullcheck of value known to be non-null
- Redundant nullcheck of structClass, which is known to be non-null in javolution.io.Struct.array(Struct[])
-
In file
Struct.java
,
line 519
In class javolution.io.Struct In method javolution.io.Struct.array(Struct[]) Value loaded from structClass Return value of javolution.lang.Reflection.getClass(String) of type Class Redundant null check at Struct.java:[line 519]
|
Medium |
Switch statement found where default case is missing
- Switch statement found in javolution.xml.sax.XMLReaderImpl.parseAll() where default case is missing
-
In file
XMLReaderImpl.java
,
lines 308
to 369
In class javolution.xml.sax.XMLReaderImpl In method javolution.xml.sax.XMLReaderImpl.parseAll() At XMLReaderImpl.java:[lines 308-369]
|
Medium |
Write to static field from instance method
- Write to static field javolution.util.FastComparator._Rehash from instance method javolution.util.FastComparator$1.notifyChange()
-
In file
FastComparator.java
,
line 36
In class javolution.util.FastComparator$1 In method javolution.util.FastComparator$1.notifyChange() Field javolution.util.FastComparator._Rehash At FastComparator.java:[line 36]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastList$Node in javolution.util.FastList.delete(FastCollection$Record)
-
In file
FastList.java
,
line 567
In class javolution.util.FastList In method javolution.util.FastList.delete(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastList$Node Value loaded from record At FastList.java:[line 567]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastList$Node in javolution.util.FastList.valueOf(FastCollection$Record)
-
In file
FastList.java
,
line 562
In class javolution.util.FastList In method javolution.util.FastList.valueOf(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastList$Node Value loaded from record At FastList.java:[line 562]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastMap$Entry in javolution.util.FastMap$EntrySet.delete(FastCollection$Record)
-
In file
FastMap.java
,
line 1219
In class javolution.util.FastMap$EntrySet In method javolution.util.FastMap$EntrySet.delete(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastMap$Entry Value loaded from record At FastMap.java:[line 1219]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to j2me.util.Map$Entry in javolution.util.FastMap$EntrySet.valueOf(FastCollection$Record)
-
In file
FastMap.java
,
line 1215
In class javolution.util.FastMap$EntrySet In method javolution.util.FastMap$EntrySet.valueOf(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected j2me.util.Map$Entry Value loaded from record At FastMap.java:[line 1215]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastMap$Entry in javolution.util.FastMap$KeySet.delete(FastCollection$Record)
-
In file
FastMap.java
,
line 1370
In class javolution.util.FastMap$KeySet In method javolution.util.FastMap$KeySet.delete(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastMap$Entry Value loaded from record At FastMap.java:[line 1370]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastMap$Entry in javolution.util.FastMap$KeySet.valueOf(FastCollection$Record)
-
In file
FastMap.java
,
line 1366
In class javolution.util.FastMap$KeySet In method javolution.util.FastMap$KeySet.valueOf(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastMap$Entry Value loaded from record At FastMap.java:[line 1366]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastMap$Entry in javolution.util.FastMap$Values.delete(FastCollection$Record)
-
In file
FastMap.java
,
line 1072
In class javolution.util.FastMap$Values In method javolution.util.FastMap$Values.delete(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastMap$Entry Value loaded from record At FastMap.java:[line 1072]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastMap$Entry in javolution.util.FastMap$Values.valueOf(FastCollection$Record)
-
In file
FastMap.java
,
line 1068
In class javolution.util.FastMap$Values In method javolution.util.FastMap$Values.valueOf(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastMap$Entry Value loaded from record At FastMap.java:[line 1068]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastMap$Entry in javolution.util.FastSet.delete(FastCollection$Record)
-
In file
FastSet.java
,
line 238
In class javolution.util.FastSet In method javolution.util.FastSet.delete(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastMap$Entry Value loaded from record At FastSet.java:[line 238]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.FastMap$Entry in javolution.util.FastSet.valueOf(FastCollection$Record)
-
In file
FastSet.java
,
line 233
In class javolution.util.FastSet In method javolution.util.FastSet.valueOf(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.FastMap$Entry Value loaded from record At FastSet.java:[line 233]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.Index in javolution.util.FastTable.delete(FastCollection$Record)
-
In file
FastTable.java
,
line 639
In class javolution.util.FastTable In method javolution.util.FastTable.delete(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.Index Value loaded from record At FastTable.java:[line 639]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.Index in javolution.util.FastTable.valueOf(FastCollection$Record)
-
In file
FastTable.java
,
line 634
In class javolution.util.FastTable In method javolution.util.FastTable.valueOf(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.Index Value loaded from record At FastTable.java:[line 634]
|
Low |
Unchecked/unconfirmed cast
- Unchecked/unconfirmed cast from javolution.util.FastCollection$Record to javolution.util.Index in javolution.util.FastTable$SubTable.valueOf(FastCollection$Record)
-
In file
FastTable.java
,
line 758
In class javolution.util.FastTable$SubTable In method javolution.util.FastTable$SubTable.valueOf(FastCollection$Record) Actual type javolution.util.FastCollection$Record Expected javolution.util.Index Value loaded from record At FastTable.java:[line 758]
|
Low |
Unchecked/unconfirmed cast of return value from method
- Unchecked/unconfirmed cast from Throwable to java.io.IOException of return value in javolution.xml.sax.XMLReaderImpl.parse(InputStream)
-
In file
XMLReaderImpl.java
,
line 101
In class javolution.xml.sax.XMLReaderImpl In method javolution.xml.sax.XMLReaderImpl.parse(InputStream) Actual type Throwable Expected java.io.IOException At XMLReaderImpl.java:[line 101]
|
Low |
Unchecked/unconfirmed cast of return value from method
- Unchecked/unconfirmed cast from Throwable to java.io.IOException of return value in javolution.xml.sax.XMLReaderImpl.parse(InputStream, String)
-
In file
XMLReaderImpl.java
,
line 125
In class javolution.xml.sax.XMLReaderImpl In method javolution.xml.sax.XMLReaderImpl.parse(InputStream, String) Actual type Throwable Expected java.io.IOException At XMLReaderImpl.java:[line 125]
|
Low |
Unchecked/unconfirmed cast of return value from method
- Unchecked/unconfirmed cast from Throwable to java.io.IOException of return value in javolution.xml.sax.XMLReaderImpl.parse(Reader)
-
In file
XMLReaderImpl.java
,
line 150
In class javolution.xml.sax.XMLReaderImpl In method javolution.xml.sax.XMLReaderImpl.parse(Reader) Actual type Throwable Expected java.io.IOException At XMLReaderImpl.java:[line 150]
|
Low |
Test for floating point equality
- Test for floating point equality in javolution.ContextTestSuite$SmallObjectAllocation.validate()
-
In file
ContextTestSuite.java
,
line 193
In class javolution.ContextTestSuite$SmallObjectAllocation In method javolution.ContextTestSuite$SmallObjectAllocation.validate() At ContextTestSuite.java:[line 193]
|
Low |
Load of known null value
- Load of known null value in javolution.lang.Reflection.searchClass(String)
-
In file
Reflection.java
,
line 89
In class javolution.lang.Reflection In method javolution.lang.Reflection.searchClass(String) Value loaded from cls At Reflection.java:[line 89]
|
Low |
Redundant nullcheck of value known to be null
- Redundant nullcheck of struct which is known to be null in javolution.io.Struct$Reference64.set(Struct)
-
In file
Struct.java
,
line 1366
In class javolution.io.Struct$Reference64 In method javolution.io.Struct$Reference64.set(Struct) Value loaded from struct Redundant null check at Struct.java:[line 1366]
|
Low |
Redundant nullcheck of value known to be null
- Redundant nullcheck of cls which is known to be null in javolution.lang.Reflection.searchClass(String)
-
In file
Reflection.java
,
line 89
In class javolution.lang.Reflection In method javolution.lang.Reflection.searchClass(String) Value loaded from cls Return value of Class.forName(String) of type Class Redundant null check at Reflection.java:[line 89]
|
Low |
Exception is caught when Exception is not thrown
- Exception is caught when Exception is not thrown in javolution.io.Struct.array(Struct[])
-
In file
Struct.java
,
line 524
In class javolution.io.Struct In method javolution.io.Struct.array(Struct[]) At Struct.java:[line 524]
|
Low |
Class implements same interface as superclass
- Class javolution.util.FastList$SubList implements same interface as superclass
-
In file
FastList.java
,
lines 756
to 909
In class javolution.util.FastList$SubList Interface j2me.io.Serializable At FastList.java:[lines 756-909]
|
Low |
Write to static field from instance method
- Write to static field javolution.util.Index.NoReordering from instance method javolution.util.Index$3.run()
-
In file
Index.java
,
line 188
In class javolution.util.Index$3 In method javolution.util.Index$3.run() Field javolution.util.Index.NoReordering At Index.java:[line 188]
|
Low |
Write to static field from instance method
- Write to static field javolution.util.Index.NoReordering from instance method javolution.util.Index$4.run()
-
In file
Index.java
,
line 208
In class javolution.util.Index$4 In method javolution.util.Index$4.run() Field javolution.util.Index.NoReordering At Index.java:[line 208]
|
Low |
Field not initialized in constructor but dereferenced without null check
- ContextTestSuite$SmallObjectAllocation.c0 not initialized in constructor and dereferenced in javolution.ContextTestSuite$SmallObjectAllocation.validate()
-
In file
ContextTestSuite.java
,
line 193
In class javolution.ContextTestSuite$SmallObjectAllocation Field javolution.ContextTestSuite$SmallObjectAllocation.c0 In method javolution.ContextTestSuite$SmallObjectAllocation.validate() At ContextTestSuite.java:[line 193]
|
Low |
Field not initialized in constructor but dereferenced without null check
- ContextTestSuite$SmallObjectAllocation.c1 not initialized in constructor and dereferenced in javolution.ContextTestSuite$SmallObjectAllocation.execute()
-
In file
ContextTestSuite.java
,
line 171
In class javolution.ContextTestSuite$SmallObjectAllocation Field javolution.ContextTestSuite$SmallObjectAllocation.c1 In method javolution.ContextTestSuite$SmallObjectAllocation.execute() At ContextTestSuite.java:[line 171]
|
This instanceof test will always return false. Although this is safe, make sure it isn't
an indication of some misunderstanding or some other logic error.
This cast is unchecked, and not all instances of the type casted from can be cast to
the type it is being cast to. Check that your program logic ensures that this
cast will not fail.
This code performs an unchecked cast of the return value of a method.
The code might be calling the method in such a way that the cast is guaranteed to be
safe, but SpotBugs is unable to verify that the cast is safe. Check that your program logic ensures that this
cast will not fail.
The code performs an unsigned right shift, whose result is then
cast to a short or byte, which discards the upper bits of the result.
Since the upper bits are discarded, there may be no difference between
a signed and unsigned right shift (depending upon the size of the shift).
Using new Integer(int)
is guaranteed to always result in a new object whereas
Integer.valueOf(int)
allows caching of values to be done by the compiler, class library, or JVM.
Using of cached values avoids object allocation and the code will be faster.
Values between -128 and 127 are guaranteed to have corresponding cached instances
and using valueOf
is approximately 3.5 times faster than using constructor.
For values outside the constant range the performance of both styles is the same.
Unless the class must be compatible with JVMs predating Java 1.5,
use either autoboxing or the valueOf()
method when creating instances of
Long
, Integer
, Short
, Character
, and Byte
.
This instruction assigns a value to a local variable,
but the value is not read or used in any subsequent instruction.
Often, this indicates an error, because the value computed is never
used.
Note that Sun's javac compiler often generates dead stores for
final local variables. Because SpotBugs is a bytecode-based tool,
there is no easy way to eliminate these false positives.
Code explicitly invokes garbage collection.
Except for specific use in benchmarking, this is very dubious.
In the past, situations where people have explicitly invoked
the garbage collector in routines such as close or finalize methods
has led to huge performance black holes. Garbage collection
can be expensive. Any situation that forces hundreds or thousands
of garbage collections will bring the machine to a crawl.
This method allocates an object just to call getClass() on it, in order to
retrieve the Class object for it. It is simpler to just access the .class property of the class.
Creating new instances of java.lang.Boolean
wastes
memory, since Boolean
objects are immutable and there are
only two useful values of this type. Use the Boolean.valueOf()
method (or Java 1.5 autoboxing) to create Boolean
objects instead.
Returning a reference to a mutable object value stored in one of the object's fields
exposes the internal representation of the object.
If instances
are accessed by untrusted code, and unchecked changes to
the mutable object would compromise security or other
important properties, you will need to do something different.
Returning a new copy of the object is better approach in many situations.
This code stores a reference to an externally mutable object into the
internal representation of the object.
If instances
are accessed by untrusted code, and unchecked changes to
the mutable object would compromise security or other
important properties, you will need to do something different.
Storing a copy of the object is better approach in many situations.
This equals method is checking to see if the argument is some incompatible type
(i.e., a class that is neither a supertype nor subtype of the class that defines
the equals method). For example, the Foo class might have an equals method
that looks like:
public boolean equals(Object o) {
if (o instanceof Foo)
return name.equals(((Foo)o).name);
else if (o instanceof String)
return name.equals(o);
else return false;
}
This is considered bad practice, as it makes it very hard to implement an equals method that
is symmetric and transitive. Without those properties, very unexpected behaviors are possible.
This code compares a java.lang.String
parameter for reference
equality using the == or != operators. Requiring callers to
pass only String constants or interned strings to a method is unnecessarily
fragile, and rarely leads to measurable performance gains. Consider
using the equals(Object)
method instead.
This operation compares two floating point values for equality.
Because floating point calculations may involve rounding,
calculated float and double values may not be accurate.
For values that must be precise, such as monetary values,
consider using a fixed-precision type such as BigDecimal.
For values that need not be precise, consider comparing for equality
within some range, for example:
if ( Math.abs(x - y) < .0000001 )
.
See the Java Language Specification, section 4.2.4.
This class defines a hashCode()
method but not an
equals()
method. Therefore, the class may
violate the invariant that equal objects must have equal hashcodes.
During the initialization of a class, the class makes an active use of a subclass.
That subclass will not yet be initialized at the time of this use.
For example, in the following code, foo
will be null.
public class CircularClassInitialization {
static class InnerClassSingleton extends CircularClassInitialization {
static InnerClassSingleton singleton = new InnerClassSingleton();
}
static CircularClassInitialization foo = InnerClassSingleton.singleton;
}
This method unconditionally invokes itself. This would seem to indicate
an infinite recursive loop that will result in a stack overflow.
The fields of this class appear to be accessed inconsistently with respect
to synchronization. This bug report indicates that the bug pattern detector
judged that
- The class contains a mix of locked and unlocked accesses,
- The class is not annotated as javax.annotation.concurrent.NotThreadSafe,
- At least one locked access was performed by one of the class's own methods, and
- The number of unsynchronized field accesses (reads and writes) was no more than
one third of all accesses, with writes being weighed twice as high as reads
A typical bug matching this bug pattern is forgetting to synchronize
one of the methods in a class that is intended to be thread-safe.
You can select the nodes labeled "Unsynchronized access" to show the
code locations where the detector believed that a field was accessed
without synchronization.
Note that there are various sources of inaccuracy in this detector;
for example, the detector cannot statically detect all situations in which
a lock is held. Also, even when the detector is accurate in
distinguishing locked vs. unlocked accesses, the code in question may still
be correct.
Names of fields that are not final should be in mixed case with a lowercase first letter and the first letters of subsequent words capitalized.
This method calls notify()
rather than notifyAll()
.
Java monitors are often used for multiple conditions. Calling notify()
only wakes up one thread, meaning that the thread woken up might not be the
one waiting for the condition that the caller just satisfied.
The variable referenced at this point is known to be null due to an earlier
check against null. Although this is valid, it might be a mistake (perhaps you
intended to refer to a different variable, or perhaps the earlier check to see if the
variable is null should have been a check to see if it was non-null).
The method creates an IO stream object, does not assign it to any
fields, pass it to other methods that might close it,
or return it, and does not appear to close
the stream on all paths out of the method. This may result in
a file descriptor leak. It is generally a good
idea to use a finally
block to ensure that streams are
closed.
This method contains a redundant check of a known non-null value against
the constant null.
This method contains a redundant check of a known null value against
the constant null.
This method uses a try-catch block that catches Exception objects, but Exception is not
thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to
say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception
each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well,
masking potential bugs.
A better approach is to either explicitly catch the specific exceptions that are thrown,
or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below:
try {
...
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
... deal with all non-runtime exceptions ...
}
This class declares that it implements an interface that is also implemented by a superclass.
This is redundant because once a superclass implements an interface, all subclasses by default also
implement this interface. It may point out that the inheritance hierarchy has changed since
this class was created, and consideration should be given to the ownership of
the interface's implementation.
This code negatives the return value of a compareTo or compare method.
This is a questionable or bad programming practice, since if the return
value is Integer.MIN_VALUE, negating the return value won't
negate the sign of the result. You can achieve the same intended result
by reversing the order of the operands rather than by negating the results.
This method contains a switch statement where default case is missing.
Usually you need to provide a default case.
Because the analysis only looks at the generated bytecode, this warning can be incorrect triggered if
the default case is at the end of the switch statement and the switch statement doesn't contain break statements for other
cases.
This class is an inner class, but does not use its embedded reference
to the object which created it. This reference makes the instances
of the class larger, and may keep the reference to the creator object
alive longer than necessary. If possible, the class should be
made into a static inner class. Since anonymous inner
classes cannot be marked as static, doing this will require refactoring
the inner class so that it is a named inner class.
This instance method writes to a static field. This is tricky to get
correct if multiple instances are being manipulated,
and generally bad practice.
This condition always produces the same result as the value of the involved variable that was narrowed before.
Probably something else was meant or the condition can be removed.
This field is never read. Consider removing it from the class.
This field is never initialized within any constructor, and is therefore could be null after
the object is constructed. Elsewhere, it is loaded and dereferenced without a null check.
This could be a either an error or a questionable design, since
it means a null pointer exception will be generated if that field is dereferenced
before being initialized.
This declares a volatile reference to an array, which might not be what
you want. With a volatile reference to an array, reads and writes of
the reference to the array are treated as volatile, but the array elements
are non-volatile. To get volatile array elements, you will need to use
one of the atomic array classes in java.util.concurrent (provided
in Java 5.0).