albertogoffi / toradocu

Toradocu - automated generation of test oracles from Javadoc documentation
Other
42 stars 21 forks source link

Duplicate identifier can occur in Randoop specification #125

Closed bjkeller closed 6 years ago

bjkeller commented 7 years ago

The condition method for a Randoop specification can have a conflict if the receiver or return value names are the same as a parameter. The Randoop Operation class should support checking for this, but Randoop is not able to rewrite the condition text if a conflict occurs.

The particular case is a Guava method in com.google.common.util.concurrent.FakeTimeLimiter. Details from Randoop:

Warning: discarding uncompilable throws-condition: guard condition interfaceType.isEnum(): Condition method did not compile: variable target is already defined in method test(com.google.common.util.concurrent.FakeTimeLimiter,java.lang.Object,java.lang.Class,long,java.util.concurrent.TimeUnit)
Class Declaration:
package com.google.common.util.concurrent;

public class RandoopConditionClass352 {
  public static boolean test(com.google.common.util.concurrent.FakeTimeLimiter target, java.lang.Object target, java.lang.Class interfaceType, long timeoutDuration, java.util.concurrent.TimeUnit timeoutUnit) throws Throwable {
    return interfaceType.isEnum();
  }
}
bjkeller commented 7 years ago

I added a couple of methods to randoop.condition.specification.Identifier that can be used to help identify this problem, but any potential name conflict would be better taken care of before the condition string is created.

ariannab commented 6 years ago

Closing this because solved via #222.