[jira] [Created] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test

ASF GitHub Bot (Jira)
Bug in class#ListOrderedSet with reproducible JUnit test
--------------------------------------------------------

                 Key: COLLECTIONS-373
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-373
             Project: Commons Collections
          Issue Type: Bug
    Affects Versions: 3.2
         Environment: jdk 1.6.x
            Reporter: Sai Zhang



Hi all:

I am writing an automated bug finding tool, and using
Apache Commons Collections as an experimental subject
for evaluation.

The tool creates executable JUnit tests as well as
explanatory code comments. I attached one bug-revealing
test as follows. Could you please kindly check it, to
see if it is a real bug or not?

Also, it would be tremendous helpful if you could give
some feedback and suggestion on the generated code comments?
Is the automatically-inferred comment useful in understanding
the generated test? is the comment helpful in bug fixing?

Your suggestion will help us improve the tool.

public void test0() throws Throwable {
        org.apache.commons.collections.set.ListOrderedSet var0 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var1 = var0.asList();
        java.util.List var2 = var0.asList();
        var0.clear();
        java.lang.Integer var4 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var5 = new org.apache.commons.collections.set.ListOrderedSet();
        java.lang.Integer var6 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var7 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var8 = var7.asList();
        org.apache.commons.collections.set.ListOrderedSet var9 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var7);
        boolean var10 = var5.addAll((int)var6, (java.util.Collection)var7);
        boolean var11 = var0.addAll((int)var4, (java.util.Collection)var7);
        org.apache.commons.collections.set.ListOrderedSet var12 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var13 = var12.asList();
        java.util.List var14 = var12.asList();
        org.apache.commons.collections.set.ListOrderedSet var15 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var16 = var15.asList();
        org.apache.commons.collections.set.ListOrderedSet var17 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15);
        org.apache.commons.collections.set.ListOrderedSet var18 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var19 = var18.asList();
        org.apache.commons.collections.set.ListOrderedSet var20 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15, var19);
        boolean var21 = var12.containsAll((java.util.Collection)var19);
        org.apache.commons.collections.set.ListOrderedSet var22 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var0, var19);
        org.apache.commons.collections.set.ListOrderedSet var23 = new org.apache.commons.collections.set.ListOrderedSet();
        int var24 = var23.size();
        boolean var25 = var0.add((java.lang.Object)var24);
        java.lang.Short var26 = new java.lang.Short((short)1);
        //Test passes if var27 is: (java.lang.Boolean)false
        boolean var27 = var0.add((java.lang.Object)var26);
        org.apache.commons.collections.set.ListOrderedSet var28 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var29 = var28.asList();
        java.util.List var30 = var28.asList();
        var28.clear();
        java.lang.Integer var32 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var33 = new org.apache.commons.collections.set.ListOrderedSet();
        java.lang.Integer var34 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var35 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var36 = var35.asList();
        org.apache.commons.collections.set.ListOrderedSet var37 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var35);
        boolean var38 = var33.addAll((int)var34, (java.util.Collection)var35);
        boolean var39 = var28.addAll((int)var32, (java.util.Collection)var35);
        org.apache.commons.collections.set.ListOrderedSet var40 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var41 = var40.asList();
        java.util.List var42 = var40.asList();
        org.apache.commons.collections.set.ListOrderedSet var43 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var44 = var43.asList();
        org.apache.commons.collections.set.ListOrderedSet var45 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43);
        org.apache.commons.collections.set.ListOrderedSet var46 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var47 = var46.asList();
        org.apache.commons.collections.set.ListOrderedSet var48 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43, var47);
        boolean var49 = var40.containsAll((java.util.Collection)var47);
        org.apache.commons.collections.set.ListOrderedSet var50 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var28, var47);
        org.apache.commons.collections.set.ListOrderedSet var51 = new org.apache.commons.collections.set.ListOrderedSet();
        int var52 = var51.size();
        //Test passes if var53 is: (java.lang.Boolean)false
        boolean var53 = var28.add((java.lang.Object)var52);
        boolean var54 = var0.removeAll((java.util.Collection)var28);
       
        // Checks the contract:  equals-hashcode on var0 and var50
        assertTrue("Contract failed: equals-hashcode on var0 and var50", var0.equals(var50) ? var0.hashCode() == var50.hashCode() : true);
       
        // Checks the contract:  equals-hashcode on var22 and var50
        assertTrue("Contract failed: equals-hashcode on var22 and var50", var22.equals(var50) ? var22.hashCode() == var50.hashCode() : true);
       
        // Checks the contract:  equals-hashcode on var28 and var22
        assertTrue("Contract failed: equals-hashcode on var28 and var22", var28.equals(var22) ? var28.hashCode() == var22.hashCode() : true);
       
        // Checks the contract:  equals-hashcode on var50 and var22
        assertTrue("Contract failed: equals-hashcode on var50 and var22", var50.equals(var22) ? var50.hashCode() == var22.hashCode() : true);
       
        // Checks the contract:  equals-symmetric on var0 and var50.
        assertTrue("Contract failed: equals-symmetric on var0 and var50.", var0.equals(var50) ? var50.equals(var0) : true);
       
        // Checks the contract:  equals-symmetric on var28 and var22.
        assertTrue("Contract failed: equals-symmetric on var28 and var22.", var28.equals(var22) ? var22.equals(var28) : true);
  }




//explaination:
//Test passes if var53 is: (java.lang.Boolean)false  ===> means:
//     test passes if var52 is not added to var28 (only in that case, var53 is false)
boolean var53 = var28.add((java.lang.Object)var52);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/COLLECTIONS-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sai Zhang updated COLLECTIONS-373:
----------------------------------

    Description:
Hi all:

I am writing an automated bug finding tool, and using
Apache Commons Collections as an experimental subject
for evaluation.

The tool creates executable JUnit tests as well as
explanatory code comments. I attached one bug-revealing
test as follows. Could you please kindly check it, to
see if it is a real bug or not?

Also, it would be tremendous helpful if you could give
some feedback and suggestion on the generated code comments?
Is the automatically-inferred comment useful in understanding
the generated test? is the comment helpful in bug fixing?

Your suggestion will help us improve the tool.


==================the failed test

public void test0() throws Throwable {
  org.apache.commons.collections.set.ListOrderedSet var0
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var1 = var0.asList();
  java.util.List var2 = var0.asList();
  var0.clear();
  java.lang.Integer var4 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var5
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.lang.Integer var6 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var7
     = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var8 = var7.asList();
  org.apache.commons.collections.set.ListOrderedSet var9
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var7);
  boolean var10 = var5.addAll((int)var6, (java.util.Collection)var7);
  boolean var11 = var0.addAll((int)var4, (java.util.Collection)var7);
  org.apache.commons.collections.set.ListOrderedSet var12
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var13 = var12.asList();
  java.util.List var14 = var12.asList();
  org.apache.commons.collections.set.ListOrderedSet var15
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var16 = var15.asList();
  org.apache.commons.collections.set.ListOrderedSet var17 =  
    org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15);
  org.apache.commons.collections.set.ListOrderedSet var18
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var19 = var18.asList();
  org.apache.commons.collections.set.ListOrderedSet var20
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15, var19);
  boolean var21 = var12.containsAll((java.util.Collection)var19);
  org.apache.commons.collections.set.ListOrderedSet var22
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var0, var19);
  org.apache.commons.collections.set.ListOrderedSet var23
    = new org.apache.commons.collections.set.ListOrderedSet();
  int var24 = var23.size();
  boolean var25 = var0.add((java.lang.Object)var24);
  java.lang.Short var26 = new java.lang.Short((short)1);
  //Test passes if var27 is: (java.lang.Boolean)false
  boolean var27 = var0.add((java.lang.Object)var26);
  org.apache.commons.collections.set.ListOrderedSet var28
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var29 = var28.asList();
  java.util.List var30 = var28.asList();
  var28.clear();
  java.lang.Integer var32 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var33
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.lang.Integer var34 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var35
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var36 = var35.asList();
  org.apache.commons.collections.set.ListOrderedSet var37
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var35);
  boolean var38 = var33.addAll((int)var34, (java.util.Collection)var35);
  boolean var39 = var28.addAll((int)var32, (java.util.Collection)var35);
  org.apache.commons.collections.set.ListOrderedSet var40
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var41 = var40.asList();
  java.util.List var42 = var40.asList();
  org.apache.commons.collections.set.ListOrderedSet var43
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var44 = var43.asList();
  org.apache.commons.collections.set.ListOrderedSet var45
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43);
  org.apache.commons.collections.set.ListOrderedSet var46
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var47 = var46.asList();
  org.apache.commons.collections.set.ListOrderedSet var48
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43, var47);
  boolean var49 = var40.containsAll((java.util.Collection)var47);
  org.apache.commons.collections.set.ListOrderedSet var50
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var28, var47);
  org.apache.commons.collections.set.ListOrderedSet var51
    = new org.apache.commons.collections.set.ListOrderedSet();
  int var52 = var51.size();
  //Test passes if var53 is: (java.lang.Boolean)false
  boolean var53 = var28.add((java.lang.Object)var52);
  boolean var54 = var0.removeAll((java.util.Collection)var28);
       
  // Checks the contract:  equals-hashcode on var0 and var50
  assertTrue("Contract failed: equals-hashcode on var0 and var50", var0.equals(var50) ? var0.hashCode() == var50.hashCode() : true);
       
  // Checks the contract:  equals-hashcode on var22 and var50
  assertTrue("Contract failed: equals-hashcode on var22 and var50", var22.equals(var50) ? var22.hashCode() == var50.hashCode() : true);
       
  // Checks the contract:  equals-hashcode on var28 and var22
  assertTrue("Contract failed: equals-hashcode on var28 and var22", var28.equals(var22) ? var28.hashCode() == var22.hashCode() : true);
       
  // Checks the contract:  equals-hashcode on var50 and var22
  assertTrue("Contract failed: equals-hashcode on var50 and var22", var50.equals(var22) ? var50.hashCode() == var22.hashCode() : true);
       
  // Checks the contract:  equals-symmetric on var0 and var50.
  assertTrue("Contract failed: equals-symmetric on var0 and var50.", var0.equals(var50) ? var50.equals(var0) : true);
       
  // Checks the contract:  equals-symmetric on var28 and var22.
  assertTrue("Contract failed: equals-symmetric on var28 and var22.", var28.equals(var22) ? var22.equals(var28) : true);
  }

=== test ends===


//explaination:
//Test passes if var53 is: (java.lang.Boolean)false  ===> means:
//     test passes if var52 is not added to var28 (only in that case, var53 is false)
boolean var53 = var28.add((java.lang.Object)var52);

  was:

Hi all:

I am writing an automated bug finding tool, and using
Apache Commons Collections as an experimental subject
for evaluation.

The tool creates executable JUnit tests as well as
explanatory code comments. I attached one bug-revealing
test as follows. Could you please kindly check it, to
see if it is a real bug or not?

Also, it would be tremendous helpful if you could give
some feedback and suggestion on the generated code comments?
Is the automatically-inferred comment useful in understanding
the generated test? is the comment helpful in bug fixing?

Your suggestion will help us improve the tool.

public void test0() throws Throwable {
        org.apache.commons.collections.set.ListOrderedSet var0 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var1 = var0.asList();
        java.util.List var2 = var0.asList();
        var0.clear();
        java.lang.Integer var4 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var5 = new org.apache.commons.collections.set.ListOrderedSet();
        java.lang.Integer var6 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var7 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var8 = var7.asList();
        org.apache.commons.collections.set.ListOrderedSet var9 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var7);
        boolean var10 = var5.addAll((int)var6, (java.util.Collection)var7);
        boolean var11 = var0.addAll((int)var4, (java.util.Collection)var7);
        org.apache.commons.collections.set.ListOrderedSet var12 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var13 = var12.asList();
        java.util.List var14 = var12.asList();
        org.apache.commons.collections.set.ListOrderedSet var15 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var16 = var15.asList();
        org.apache.commons.collections.set.ListOrderedSet var17 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15);
        org.apache.commons.collections.set.ListOrderedSet var18 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var19 = var18.asList();
        org.apache.commons.collections.set.ListOrderedSet var20 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15, var19);
        boolean var21 = var12.containsAll((java.util.Collection)var19);
        org.apache.commons.collections.set.ListOrderedSet var22 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var0, var19);
        org.apache.commons.collections.set.ListOrderedSet var23 = new org.apache.commons.collections.set.ListOrderedSet();
        int var24 = var23.size();
        boolean var25 = var0.add((java.lang.Object)var24);
        java.lang.Short var26 = new java.lang.Short((short)1);
        //Test passes if var27 is: (java.lang.Boolean)false
        boolean var27 = var0.add((java.lang.Object)var26);
        org.apache.commons.collections.set.ListOrderedSet var28 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var29 = var28.asList();
        java.util.List var30 = var28.asList();
        var28.clear();
        java.lang.Integer var32 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var33 = new org.apache.commons.collections.set.ListOrderedSet();
        java.lang.Integer var34 = new java.lang.Integer((-1));
        org.apache.commons.collections.set.ListOrderedSet var35 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var36 = var35.asList();
        org.apache.commons.collections.set.ListOrderedSet var37 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var35);
        boolean var38 = var33.addAll((int)var34, (java.util.Collection)var35);
        boolean var39 = var28.addAll((int)var32, (java.util.Collection)var35);
        org.apache.commons.collections.set.ListOrderedSet var40 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var41 = var40.asList();
        java.util.List var42 = var40.asList();
        org.apache.commons.collections.set.ListOrderedSet var43 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var44 = var43.asList();
        org.apache.commons.collections.set.ListOrderedSet var45 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43);
        org.apache.commons.collections.set.ListOrderedSet var46 = new org.apache.commons.collections.set.ListOrderedSet();
        java.util.List var47 = var46.asList();
        org.apache.commons.collections.set.ListOrderedSet var48 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43, var47);
        boolean var49 = var40.containsAll((java.util.Collection)var47);
        org.apache.commons.collections.set.ListOrderedSet var50 = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var28, var47);
        org.apache.commons.collections.set.ListOrderedSet var51 = new org.apache.commons.collections.set.ListOrderedSet();
        int var52 = var51.size();
        //Test passes if var53 is: (java.lang.Boolean)false
        boolean var53 = var28.add((java.lang.Object)var52);
        boolean var54 = var0.removeAll((java.util.Collection)var28);
       
        // Checks the contract:  equals-hashcode on var0 and var50
        assertTrue("Contract failed: equals-hashcode on var0 and var50", var0.equals(var50) ? var0.hashCode() == var50.hashCode() : true);
       
        // Checks the contract:  equals-hashcode on var22 and var50
        assertTrue("Contract failed: equals-hashcode on var22 and var50", var22.equals(var50) ? var22.hashCode() == var50.hashCode() : true);
       
        // Checks the contract:  equals-hashcode on var28 and var22
        assertTrue("Contract failed: equals-hashcode on var28 and var22", var28.equals(var22) ? var28.hashCode() == var22.hashCode() : true);
       
        // Checks the contract:  equals-hashcode on var50 and var22
        assertTrue("Contract failed: equals-hashcode on var50 and var22", var50.equals(var22) ? var50.hashCode() == var22.hashCode() : true);
       
        // Checks the contract:  equals-symmetric on var0 and var50.
        assertTrue("Contract failed: equals-symmetric on var0 and var50.", var0.equals(var50) ? var50.equals(var0) : true);
       
        // Checks the contract:  equals-symmetric on var28 and var22.
        assertTrue("Contract failed: equals-symmetric on var28 and var22.", var28.equals(var22) ? var22.equals(var28) : true);
  }




//explaination:
//Test passes if var53 is: (java.lang.Boolean)false  ===> means:
//     test passes if var52 is not added to var28 (only in that case, var53 is false)
boolean var53 = var28.add((java.lang.Object)var52);


> Bug in class#ListOrderedSet with reproducible JUnit test
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-373
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-373
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: jdk 1.6.x
>            Reporter: Sai Zhang
>              Labels: patch
>         Attachments: ApacheListOrderSet_Documented_Test.java
>
>
> Hi all:
> I am writing an automated bug finding tool, and using
> Apache Commons Collections as an experimental subject
> for evaluation.
> The tool creates executable JUnit tests as well as
> explanatory code comments. I attached one bug-revealing
> test as follows. Could you please kindly check it, to
> see if it is a real bug or not?
> Also, it would be tremendous helpful if you could give
> some feedback and suggestion on the generated code comments?
> Is the automatically-inferred comment useful in understanding
> the generated test? is the comment helpful in bug fixing?
> Your suggestion will help us improve the tool.
> ==================the failed test
> public void test0() throws Throwable {
>   org.apache.commons.collections.set.ListOrderedSet var0
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var1 = var0.asList();
>   java.util.List var2 = var0.asList();
>   var0.clear();
>   java.lang.Integer var4 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var5
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.lang.Integer var6 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var7
>      = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var8 = var7.asList();
>   org.apache.commons.collections.set.ListOrderedSet var9
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var7);
>   boolean var10 = var5.addAll((int)var6, (java.util.Collection)var7);
>   boolean var11 = var0.addAll((int)var4, (java.util.Collection)var7);
>   org.apache.commons.collections.set.ListOrderedSet var12
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var13 = var12.asList();
>   java.util.List var14 = var12.asList();
>   org.apache.commons.collections.set.ListOrderedSet var15
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var16 = var15.asList();
>   org.apache.commons.collections.set.ListOrderedSet var17 =  
>     org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15);
>   org.apache.commons.collections.set.ListOrderedSet var18
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var19 = var18.asList();
>   org.apache.commons.collections.set.ListOrderedSet var20
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15, var19);
>   boolean var21 = var12.containsAll((java.util.Collection)var19);
>   org.apache.commons.collections.set.ListOrderedSet var22
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var0, var19);
>   org.apache.commons.collections.set.ListOrderedSet var23
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   int var24 = var23.size();
>   boolean var25 = var0.add((java.lang.Object)var24);
>   java.lang.Short var26 = new java.lang.Short((short)1);
>   //Test passes if var27 is: (java.lang.Boolean)false
>   boolean var27 = var0.add((java.lang.Object)var26);
>   org.apache.commons.collections.set.ListOrderedSet var28
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var29 = var28.asList();
>   java.util.List var30 = var28.asList();
>   var28.clear();
>   java.lang.Integer var32 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var33
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.lang.Integer var34 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var35
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var36 = var35.asList();
>   org.apache.commons.collections.set.ListOrderedSet var37
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var35);
>   boolean var38 = var33.addAll((int)var34, (java.util.Collection)var35);
>   boolean var39 = var28.addAll((int)var32, (java.util.Collection)var35);
>   org.apache.commons.collections.set.ListOrderedSet var40
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var41 = var40.asList();
>   java.util.List var42 = var40.asList();
>   org.apache.commons.collections.set.ListOrderedSet var43
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var44 = var43.asList();
>   org.apache.commons.collections.set.ListOrderedSet var45
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43);
>   org.apache.commons.collections.set.ListOrderedSet var46
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var47 = var46.asList();
>   org.apache.commons.collections.set.ListOrderedSet var48
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43, var47);
>   boolean var49 = var40.containsAll((java.util.Collection)var47);
>   org.apache.commons.collections.set.ListOrderedSet var50
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var28, var47);
>   org.apache.commons.collections.set.ListOrderedSet var51
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   int var52 = var51.size();
>   //Test passes if var53 is: (java.lang.Boolean)false
>   boolean var53 = var28.add((java.lang.Object)var52);
>   boolean var54 = var0.removeAll((java.util.Collection)var28);
>        
>   // Checks the contract:  equals-hashcode on var0 and var50
>   assertTrue("Contract failed: equals-hashcode on var0 and var50", var0.equals(var50) ? var0.hashCode() == var50.hashCode() : true);
>        
>   // Checks the contract:  equals-hashcode on var22 and var50
>   assertTrue("Contract failed: equals-hashcode on var22 and var50", var22.equals(var50) ? var22.hashCode() == var50.hashCode() : true);
>        
>   // Checks the contract:  equals-hashcode on var28 and var22
>   assertTrue("Contract failed: equals-hashcode on var28 and var22", var28.equals(var22) ? var28.hashCode() == var22.hashCode() : true);
>        
>   // Checks the contract:  equals-hashcode on var50 and var22
>   assertTrue("Contract failed: equals-hashcode on var50 and var22", var50.equals(var22) ? var50.hashCode() == var22.hashCode() : true);
>        
>   // Checks the contract:  equals-symmetric on var0 and var50.
>   assertTrue("Contract failed: equals-symmetric on var0 and var50.", var0.equals(var50) ? var50.equals(var0) : true);
>        
>   // Checks the contract:  equals-symmetric on var28 and var22.
>   assertTrue("Contract failed: equals-symmetric on var28 and var22.", var28.equals(var22) ? var22.equals(var28) : true);
>   }
> === test ends===
> //explaination:
> //Test passes if var53 is: (java.lang.Boolean)false  ===> means:
> //     test passes if var52 is not added to var28 (only in that case, var53 is false)
> boolean var53 = var28.add((java.lang.Object)var52);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/COLLECTIONS-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sai Zhang updated COLLECTIONS-373:
----------------------------------

    Attachment: ApacheListOrderSet_Documented_Test.java

> Bug in class#ListOrderedSet with reproducible JUnit test
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-373
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-373
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: jdk 1.6.x
>            Reporter: Sai Zhang
>              Labels: patch
>         Attachments: ApacheListOrderSet_Documented_Test.java
>
>
> Hi all:
> I am writing an automated bug finding tool, and using
> Apache Commons Collections as an experimental subject
> for evaluation.
> The tool creates executable JUnit tests as well as
> explanatory code comments. I attached one bug-revealing
> test as follows. Could you please kindly check it, to
> see if it is a real bug or not?
> Also, it would be tremendous helpful if you could give
> some feedback and suggestion on the generated code comments?
> Is the automatically-inferred comment useful in understanding
> the generated test? is the comment helpful in bug fixing?
> Your suggestion will help us improve the tool.
> ==================the failed test
> public void test0() throws Throwable {
>   org.apache.commons.collections.set.ListOrderedSet var0
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var1 = var0.asList();
>   java.util.List var2 = var0.asList();
>   var0.clear();
>   java.lang.Integer var4 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var5
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.lang.Integer var6 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var7
>      = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var8 = var7.asList();
>   org.apache.commons.collections.set.ListOrderedSet var9
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var7);
>   boolean var10 = var5.addAll((int)var6, (java.util.Collection)var7);
>   boolean var11 = var0.addAll((int)var4, (java.util.Collection)var7);
>   org.apache.commons.collections.set.ListOrderedSet var12
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var13 = var12.asList();
>   java.util.List var14 = var12.asList();
>   org.apache.commons.collections.set.ListOrderedSet var15
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var16 = var15.asList();
>   org.apache.commons.collections.set.ListOrderedSet var17 =  
>     org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15);
>   org.apache.commons.collections.set.ListOrderedSet var18
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var19 = var18.asList();
>   org.apache.commons.collections.set.ListOrderedSet var20
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15, var19);
>   boolean var21 = var12.containsAll((java.util.Collection)var19);
>   org.apache.commons.collections.set.ListOrderedSet var22
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var0, var19);
>   org.apache.commons.collections.set.ListOrderedSet var23
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   int var24 = var23.size();
>   boolean var25 = var0.add((java.lang.Object)var24);
>   java.lang.Short var26 = new java.lang.Short((short)1);
>   //Test passes if var27 is: (java.lang.Boolean)false
>   boolean var27 = var0.add((java.lang.Object)var26);
>   org.apache.commons.collections.set.ListOrderedSet var28
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var29 = var28.asList();
>   java.util.List var30 = var28.asList();
>   var28.clear();
>   java.lang.Integer var32 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var33
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.lang.Integer var34 = new java.lang.Integer((-1));
>   org.apache.commons.collections.set.ListOrderedSet var35
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var36 = var35.asList();
>   org.apache.commons.collections.set.ListOrderedSet var37
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var35);
>   boolean var38 = var33.addAll((int)var34, (java.util.Collection)var35);
>   boolean var39 = var28.addAll((int)var32, (java.util.Collection)var35);
>   org.apache.commons.collections.set.ListOrderedSet var40
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var41 = var40.asList();
>   java.util.List var42 = var40.asList();
>   org.apache.commons.collections.set.ListOrderedSet var43
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var44 = var43.asList();
>   org.apache.commons.collections.set.ListOrderedSet var45
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43);
>   org.apache.commons.collections.set.ListOrderedSet var46
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   java.util.List var47 = var46.asList();
>   org.apache.commons.collections.set.ListOrderedSet var48
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43, var47);
>   boolean var49 = var40.containsAll((java.util.Collection)var47);
>   org.apache.commons.collections.set.ListOrderedSet var50
>     = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var28, var47);
>   org.apache.commons.collections.set.ListOrderedSet var51
>     = new org.apache.commons.collections.set.ListOrderedSet();
>   int var52 = var51.size();
>   //Test passes if var53 is: (java.lang.Boolean)false
>   boolean var53 = var28.add((java.lang.Object)var52);
>   boolean var54 = var0.removeAll((java.util.Collection)var28);
>        
>   // Checks the contract:  equals-hashcode on var0 and var50
>   assertTrue("Contract failed: equals-hashcode on var0 and var50", var0.equals(var50) ? var0.hashCode() == var50.hashCode() : true);
>        
>   // Checks the contract:  equals-hashcode on var22 and var50
>   assertTrue("Contract failed: equals-hashcode on var22 and var50", var22.equals(var50) ? var22.hashCode() == var50.hashCode() : true);
>        
>   // Checks the contract:  equals-hashcode on var28 and var22
>   assertTrue("Contract failed: equals-hashcode on var28 and var22", var28.equals(var22) ? var28.hashCode() == var22.hashCode() : true);
>        
>   // Checks the contract:  equals-hashcode on var50 and var22
>   assertTrue("Contract failed: equals-hashcode on var50 and var22", var50.equals(var22) ? var50.hashCode() == var22.hashCode() : true);
>        
>   // Checks the contract:  equals-symmetric on var0 and var50.
>   assertTrue("Contract failed: equals-symmetric on var0 and var50.", var0.equals(var50) ? var50.equals(var0) : true);
>        
>   // Checks the contract:  equals-symmetric on var28 and var22.
>   assertTrue("Contract failed: equals-symmetric on var28 and var22.", var28.equals(var22) ? var22.equals(var28) : true);
>   }
> === test ends===
> //explaination:
> //Test passes if var53 is: (java.lang.Boolean)false  ===> means:
> //     test passes if var52 is not added to var28 (only in that case, var53 is false)
> boolean var53 = var28.add((java.lang.Object)var52);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/COLLECTIONS-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sai Zhang updated COLLECTIONS-373:
----------------------------------

    Description:
Hi all:

I am writing an automated bug finding tool, and using
Apache Commons Collections as an experimental subject
for evaluation.

The tool creates executable JUnit tests as well as
explanatory code comments. I attached one bug-revealing
test as follows. Could you please kindly check it, to
see if it is a real bug or not?

Also, it would be tremendous helpful if you could give
some feedback and suggestion on the generated code comments?
Is the automatically-inferred comment useful in understanding
the generated test? is the comment helpful in bug fixing?

Your suggestion will help us improve the tool.

Please see attachment for the failed test. A little explaination
on the generated code comments in the failed test

//explaination:
//Test passes if var53 is: (java.lang.Boolean)false  ===> means:
//     test passes if var52 is not added to var28 (only in that case, var53 is false)
boolean var53 = var28.add((java.lang.Object)var52);

  was:
Hi all:

I am writing an automated bug finding tool, and using
Apache Commons Collections as an experimental subject
for evaluation.

The tool creates executable JUnit tests as well as
explanatory code comments. I attached one bug-revealing
test as follows. Could you please kindly check it, to
see if it is a real bug or not?

Also, it would be tremendous helpful if you could give
some feedback and suggestion on the generated code comments?
Is the automatically-inferred comment useful in understanding
the generated test? is the comment helpful in bug fixing?

Your suggestion will help us improve the tool.


==================the failed test

public void test0() throws Throwable {
  org.apache.commons.collections.set.ListOrderedSet var0
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var1 = var0.asList();
  java.util.List var2 = var0.asList();
  var0.clear();
  java.lang.Integer var4 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var5
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.lang.Integer var6 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var7
     = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var8 = var7.asList();
  org.apache.commons.collections.set.ListOrderedSet var9
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var7);
  boolean var10 = var5.addAll((int)var6, (java.util.Collection)var7);
  boolean var11 = var0.addAll((int)var4, (java.util.Collection)var7);
  org.apache.commons.collections.set.ListOrderedSet var12
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var13 = var12.asList();
  java.util.List var14 = var12.asList();
  org.apache.commons.collections.set.ListOrderedSet var15
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var16 = var15.asList();
  org.apache.commons.collections.set.ListOrderedSet var17 =  
    org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15);
  org.apache.commons.collections.set.ListOrderedSet var18
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var19 = var18.asList();
  org.apache.commons.collections.set.ListOrderedSet var20
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var15, var19);
  boolean var21 = var12.containsAll((java.util.Collection)var19);
  org.apache.commons.collections.set.ListOrderedSet var22
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var0, var19);
  org.apache.commons.collections.set.ListOrderedSet var23
    = new org.apache.commons.collections.set.ListOrderedSet();
  int var24 = var23.size();
  boolean var25 = var0.add((java.lang.Object)var24);
  java.lang.Short var26 = new java.lang.Short((short)1);
  //Test passes if var27 is: (java.lang.Boolean)false
  boolean var27 = var0.add((java.lang.Object)var26);
  org.apache.commons.collections.set.ListOrderedSet var28
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var29 = var28.asList();
  java.util.List var30 = var28.asList();
  var28.clear();
  java.lang.Integer var32 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var33
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.lang.Integer var34 = new java.lang.Integer((-1));
  org.apache.commons.collections.set.ListOrderedSet var35
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var36 = var35.asList();
  org.apache.commons.collections.set.ListOrderedSet var37
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var35);
  boolean var38 = var33.addAll((int)var34, (java.util.Collection)var35);
  boolean var39 = var28.addAll((int)var32, (java.util.Collection)var35);
  org.apache.commons.collections.set.ListOrderedSet var40
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var41 = var40.asList();
  java.util.List var42 = var40.asList();
  org.apache.commons.collections.set.ListOrderedSet var43
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var44 = var43.asList();
  org.apache.commons.collections.set.ListOrderedSet var45
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43);
  org.apache.commons.collections.set.ListOrderedSet var46
    = new org.apache.commons.collections.set.ListOrderedSet();
  java.util.List var47 = var46.asList();
  org.apache.commons.collections.set.ListOrderedSet var48
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var43, var47);
  boolean var49 = var40.containsAll((java.util.Collection)var47);
  org.apache.commons.collections.set.ListOrderedSet var50
    = org.apache.commons.collections.set.ListOrderedSet.decorate((java.util.Set)var28, var47);
  org.apache.commons.collections.set.ListOrderedSet var51
    = new org.apache.commons.collections.set.ListOrderedSet();
  int var52 = var51.size();
  //Test passes if var53 is: (java.lang.Boolean)false
  boolean var53 = var28.add((java.lang.Object)var52);
  boolean var54 = var0.removeAll((java.util.Collection)var28);
       
  // Checks the contract:  equals-hashcode on var0 and var50
  assertTrue("Contract failed: equals-hashcode on var0 and var50", var0.equals(var50) ? var0.hashCode() == var50.hashCode() : true);
       
  // Checks the contract:  equals-hashcode on var22 and var50
  assertTrue("Contract failed: equals-hashcode on var22 and var50", var22.equals(var50) ? var22.hashCode() == var50.hashCode() : true);
       
  // Checks the contract:  equals-hashcode on var28 and var22
  assertTrue("Contract failed: equals-hashcode on var28 and var22", var28.equals(var22) ? var28.hashCode() == var22.hashCode() : true);
       
  // Checks the contract:  equals-hashcode on var50 and var22
  assertTrue("Contract failed: equals-hashcode on var50 and var22", var50.equals(var22) ? var50.hashCode() == var22.hashCode() : true);
       
  // Checks the contract:  equals-symmetric on var0 and var50.
  assertTrue("Contract failed: equals-symmetric on var0 and var50.", var0.equals(var50) ? var50.equals(var0) : true);
       
  // Checks the contract:  equals-symmetric on var28 and var22.
  assertTrue("Contract failed: equals-symmetric on var28 and var22.", var28.equals(var22) ? var22.equals(var28) : true);
  }

=== test ends===


//explaination:
//Test passes if var53 is: (java.lang.Boolean)false  ===> means:
//     test passes if var52 is not added to var28 (only in that case, var53 is false)
boolean var53 = var28.add((java.lang.Object)var52);


> Bug in class#ListOrderedSet with reproducible JUnit test
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-373
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-373
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: jdk 1.6.x
>            Reporter: Sai Zhang
>              Labels: patch
>         Attachments: ApacheListOrderSet_Documented_Test.java
>
>
> Hi all:
> I am writing an automated bug finding tool, and using
> Apache Commons Collections as an experimental subject
> for evaluation.
> The tool creates executable JUnit tests as well as
> explanatory code comments. I attached one bug-revealing
> test as follows. Could you please kindly check it, to
> see if it is a real bug or not?
> Also, it would be tremendous helpful if you could give
> some feedback and suggestion on the generated code comments?
> Is the automatically-inferred comment useful in understanding
> the generated test? is the comment helpful in bug fixing?
> Your suggestion will help us improve the tool.
> Please see attachment for the failed test. A little explaination
> on the generated code comments in the failed test
> //explaination:
> //Test passes if var53 is: (java.lang.Boolean)false  ===> means:
> //     test passes if var52 is not added to var28 (only in that case, var53 is false)
> boolean var53 = var28.add((java.lang.Object)var52);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/COLLECTIONS-373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sai Zhang updated COLLECTIONS-373:
----------------------------------

    Description:
Hi all:

I am writing an automated bug finding tool, and using
Apache Commons Collections as an experimental subject
for evaluation.

The tool creates executable JUnit tests as well as
explanatory code comments. I attached one bug-revealing
test as follows. Could you please kindly check it, to
see if it is a real bug or not?

Also, it would be tremendous helpful if you could give
some feedback and suggestion on the generated code comments?
From the perspective of developers who are relatively familiar
with the code,
is the automatically-inferred comment useful in understanding
the generated test? is the comment helpful in bug fixing?

Your suggestion will help us improve the tool.

Please see attachment for the failed test. A little explaination
on the generated code comments in the failed test

//explaination:
//Test passes if var53 is: (java.lang.Boolean)false  ===> means:
//     test passes if var52 is not added to var28 (only in that case, var53 is false)
boolean var53 = var28.add((java.lang.Object)var52);

  was:
Hi all:

I am writing an automated bug finding tool, and using
Apache Commons Collections as an experimental subject
for evaluation.

The tool creates executable JUnit tests as well as
explanatory code comments. I attached one bug-revealing
test as follows. Could you please kindly check it, to
see if it is a real bug or not?

Also, it would be tremendous helpful if you could give
some feedback and suggestion on the generated code comments?
Is the automatically-inferred comment useful in understanding
the generated test? is the comment helpful in bug fixing?

Your suggestion will help us improve the tool.

Please see attachment for the failed test. A little explaination
on the generated code comments in the failed test

//explaination:
//Test passes if var53 is: (java.lang.Boolean)false  ===> means:
//     test passes if var52 is not added to var28 (only in that case, var53 is false)
boolean var53 = var28.add((java.lang.Object)var52);


> Bug in class#ListOrderedSet with reproducible JUnit test
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-373
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-373
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: jdk 1.6.x
>            Reporter: Sai Zhang
>              Labels: patch
>         Attachments: ApacheListOrderSet_Documented_Test.java
>
>
> Hi all:
> I am writing an automated bug finding tool, and using
> Apache Commons Collections as an experimental subject
> for evaluation.
> The tool creates executable JUnit tests as well as
> explanatory code comments. I attached one bug-revealing
> test as follows. Could you please kindly check it, to
> see if it is a real bug or not?
> Also, it would be tremendous helpful if you could give
> some feedback and suggestion on the generated code comments?
> From the perspective of developers who are relatively familiar
> with the code,
> is the automatically-inferred comment useful in understanding
> the generated test? is the comment helpful in bug fixing?
> Your suggestion will help us improve the tool.
> Please see attachment for the failed test. A little explaination
> on the generated code comments in the failed test
> //explaination:
> //Test passes if var53 is: (java.lang.Boolean)false  ===> means:
> //     test passes if var52 is not added to var28 (only in that case, var53 is false)
> boolean var53 = var28.add((java.lang.Object)var52);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/COLLECTIONS-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13086724#comment-13086724 ]

Sai Zhang commented on COLLECTIONS-373:
---------------------------------------

Hi,

Here is the latest output of our documentation inference tool. It renames all
variable names and (hopefully) makes the test easier to read.

The comments generated by our research tool are shown in the form of:

{code}
//Test passes if:  xxxx (it indicates changes that will make a failed test pass)
{code}

Each piece of comments (not the combination of them) provides a way to correct the failed test.
We hope such additional information will help developers understand/fix the test faster/better.

So, it would be great if anyone can take a look at the reported bug to:
(1) confirm is it a real bug?
(2) is such comment information useful? If not, please give us feedback so we can do our best
     to improve our tool!

Thank you!

-Sai


{code}
public void test0() {
    ListOrderedSet listOrderedSet0 = new ListOrderedSet();
    List list0 = listOrderedSet0.asList();
    List list1 = listOrderedSet0.asList();
    listOrderedSet0.clear();
    Integer i0 = new Integer((-1));
    ListOrderedSet listOrderedSet1 = new ListOrderedSet();
    Integer i1 = new Integer((-1));
    ListOrderedSet listOrderedSet2 = new ListOrderedSet();
    List list2 = listOrderedSet2.asList();
    ListOrderedSet listOrderedSet3 = ListOrderedSet.decorate((Set)listOrderedSet2);
    boolean b0 = listOrderedSet1.addAll(i1, (Collection)listOrderedSet2);
    boolean b1 = listOrderedSet0.addAll(i0, (Collection)listOrderedSet2);
    ListOrderedSet listOrderedSet4 = new ListOrderedSet();
    List list3 = listOrderedSet4.asList();
    List list4 = listOrderedSet4.asList();
    ListOrderedSet listOrderedSet5 = new ListOrderedSet();
    List list5 = listOrderedSet5.asList();
    ListOrderedSet listOrderedSet6 = ListOrderedSet.decorate((Set)listOrderedSet5);
    ListOrderedSet listOrderedSet7 = new ListOrderedSet();
    List list6 = listOrderedSet7.asList();
    ListOrderedSet listOrderedSet8 = ListOrderedSet.decorate((Set)listOrderedSet5, list6);
    boolean b2 = listOrderedSet4.containsAll((Collection)list6);
    ListOrderedSet listOrderedSet9 = ListOrderedSet.decorate((Set)listOrderedSet0, list6);
    ListOrderedSet listOrderedSet10 = new ListOrderedSet();
    int i2 = listOrderedSet10.size();
    boolean b3 = listOrderedSet0.add((Object)i2);
    //Test passes if line is: Integer s0 = new Integer(0)
    Short s0 = new Short((short)1);
    //Test passes if s0 is not added to listOrderedSet0
    boolean b4 = listOrderedSet0.add((Object)s0);
    ListOrderedSet listOrderedSet11 = new ListOrderedSet();
    List list7 = listOrderedSet11.asList();
    List list8 = listOrderedSet11.asList();
    listOrderedSet11.clear();
    Integer i3 = new Integer((-1));
    ListOrderedSet listOrderedSet12 = new ListOrderedSet();
    Integer i4 = new Integer((-1));
    ListOrderedSet listOrderedSet13 = new ListOrderedSet();
    List list9 = listOrderedSet13.asList();
    ListOrderedSet listOrderedSet14 = ListOrderedSet.decorate((Set)listOrderedSet13);
    boolean b5 = listOrderedSet12.addAll(i4, (Collection)listOrderedSet13);
    boolean b6 = listOrderedSet11.addAll(i3, (Collection)listOrderedSet13);
    ListOrderedSet listOrderedSet15 = new ListOrderedSet();
    List list10 = listOrderedSet15.asList();
    List list11 = listOrderedSet15.asList();
    ListOrderedSet listOrderedSet16 = new ListOrderedSet();
    List list12 = listOrderedSet16.asList();
    ListOrderedSet listOrderedSet17 = ListOrderedSet.decorate((Set)listOrderedSet16);
    ListOrderedSet listOrderedSet18 = new ListOrderedSet();
    List list13 = listOrderedSet18.asList();
    ListOrderedSet listOrderedSet19 = ListOrderedSet.decorate((Set)listOrderedSet16, list13);
    boolean b7 = listOrderedSet15.containsAll((Collection)list13);
    ListOrderedSet listOrderedSet20 = ListOrderedSet.decorate((Set)listOrderedSet11, list13);
    ListOrderedSet listOrderedSet21 = new ListOrderedSet();
    int i5 = listOrderedSet21.size();
    //Test passes if i5 is not added to listOrderedSet11
    boolean b8 = listOrderedSet11.add((Object)i5);
    boolean b9 = listOrderedSet0.removeAll((Collection)listOrderedSet11);
   
    // Checks the contract:  equals-hashcode on listOrderedSet0 and listOrderedSet20
    assertTrue("Contract failed: equals-hashcode on listOrderedSet0 and listOrderedSet20", listOrderedSet0.equals(listOrderedSet20) ? listOrderedSet0.hashCode() == listOrderedSet20.hashCode() : true);
   
    // Checks the contract:  equals-hashcode on listOrderedSet9 and listOrderedSet20
    assertTrue("Contract failed: equals-hashcode on listOrderedSet9 and listOrderedSet20", listOrderedSet9.equals(listOrderedSet20) ? listOrderedSet9.hashCode() == listOrderedSet20.hashCode() : true);
   
    // Checks the contract:  equals-hashcode on listOrderedSet11 and listOrderedSet9
    assertTrue("Contract failed: equals-hashcode on listOrderedSet11 and listOrderedSet9", listOrderedSet11.equals(listOrderedSet9) ? listOrderedSet11.hashCode() == listOrderedSet9.hashCode() : true);
   
    // Checks the contract:  equals-hashcode on listOrderedSet20 and listOrderedSet9
    assertTrue("Contract failed: equals-hashcode on listOrderedSet20 and listOrderedSet9", listOrderedSet20.equals(listOrderedSet9) ? listOrderedSet20.hashCode() == listOrderedSet9.hashCode() : true);
   
    // Checks the contract:  equals-symmetric on listOrderedSet0 and listOrderedSet20.
    assertTrue("Contract failed: equals-symmetric on listOrderedSet0 and listOrderedSet20.", listOrderedSet0.equals(listOrderedSet20) == listOrderedSet20.equals(listOrderedSet0));
   
    // Checks the contract:  equals-symmetric on listOrderedSet11 and listOrderedSet9.
    assertTrue("Contract failed: equals-symmetric on listOrderedSet11 and listOrderedSet9.", listOrderedSet11.equals(listOrderedSet9) == listOrderedSet9.equals(listOrderedSet11));
  }

{code}


> Bug in class#ListOrderedSet with reproducible JUnit test
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-373
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-373
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: jdk 1.6.x
>            Reporter: Sai Zhang
>              Labels: patch
>         Attachments: ApacheListOrderSet_Documented_Test.java
>
>
> Hi all:
> I am writing an automated bug finding tool, and using
> Apache Commons Collections as an experimental subject
> for evaluation.
> The tool creates executable JUnit tests as well as
> explanatory code comments. I attached one bug-revealing
> test as follows. Could you please kindly check it, to
> see if it is a real bug or not?
> Also, it would be tremendous helpful if you could give
> some feedback and suggestion on the generated code comments?
> From the perspective of developers who are relatively familiar
> with the code,
> is the automatically-inferred comment useful in understanding
> the generated test? is the comment helpful in bug fixing?
> Your suggestion will help us improve the tool.
> Please see attachment for the failed test. A little explaination
> on the generated code comments in the failed test
> //explaination:
> //Test passes if var53 is: (java.lang.Boolean)false  ===> means:
> //     test passes if var52 is not added to var28 (only in that case, var53 is false)
> boolean var53 = var28.add((java.lang.Object)var52);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira