-
Suggestion
-
Resolution: Won't Fix
-
None
-
None
The problem described here http://confluence.atlassian.com/pages/viewpage.action?pageId=79986962 may no longer be as prevalent in jdk 1.4+ .
Consider instrumenting bool expressions that contain assignments again.
The following simple, yet very common case of reading from an InputStream compiles with and without clover enabled under jdk 1.4+ :
String currentLine; if ((currentLine = in.readLine()) != null) { System.out.println("currentLine = " + currentLine); }
Below is a list of known cases where Clover Instrumentation will cause a compiler error:
An && expression followed by an assignment
This generally used to check for null using the short-circuit operator before accessing the variable in the assignment expression.
Common, real world cases are:
if (r != null && (n = r.node) != bound && (k = n.key) != null) {
(backport-concurrent-util)
or
while((m_inStream != null) && (message = m_inStream.readLine()) != null)
(TestNG)
if (lower > 0.0 && (lowerMargin = getLowerMargin()) > 0.0) {
(JFreeChart)
A constant boolean expression (except true|false)
final String l; if (2 > 0 ) { l = "foo"; } System.out.println("l = " + l);
is instrumented as:
cov[711]++;if ((((2 > 0 )&&(++cov[712]!=0|true))||(++cov[713]==0&false))) {{
and causes this compiler error:
[javac] /Users/niick/work/tutorial/build/clover-gen/clover29136.tmp/com/cenqua/samples/money/MoneyTest.java:42: variable l might not have been initialized [javac] }__CLR2_4_2j7j7fpw1ox9g.R.E[715]++;System.out.println("l = " + l);
- is related to
-
CLOV-990 Inline assignments within while loop clause get no coverage
-
- Closed
-