0

我有以下非常简单的、故意出错的 java 类:

import java.io.InputStream;
import java.util.*;
public class ArrayListError{

public ArrayListError(){
}
public static void makeArray(int i){
ArrayList list = new ArrayList(i);
}
public static void main(String[] args)
{
System.out.println("Enter a number to create arrayList:");
Scanner scanner =new Scanner(System.in);
int i= scanner.nextInt();
makeArray(i);
}

}

在 evosuite cygwin( java -jar evosuite-20120511.jar -setup c:/Users/Eliezer\ Shindler/Desktop/myclasses) 上运行时,我得到:

de.unisb.cs.st.evosuite.setup.ScanProject.main(ScanProject.java:578) 的线程“主”java.lang.ExceptionInInitializerError 中的异常原因:com.thoughtworks.xstream.converters.ConversionException:无法构造de.unisb.cs.st.evosuite.callgraph.DistanceTransformer$ClassEntry 因为它没有无参数构造函数:无法构造 de.unisb.cs.st.evosuite.callg raph.DistanceTransformer$ClassEntry 因为它没有无参数构造函数----调试信息----消息:无法构造de.unisb.cs.st.evosuite.callgraph.Distanc eTransformer$ClassEntry,因为它没有无参数构造函数原因异常:com。 thinkworks.xstream.converters.reflection.ObjectAcces sException 原因消息:无法构造 de.unisb.cs.st.evosuite。callgraph.Distanc eTransformer$ClassEntry 因为它没有无参数构造函数类:java.util.HashSet 所需类型:de.unisb.cs.st.evosuite.callgraph.DistanceTransformer$Clas sEntry 路径:/set/de. unisb.cs.st.evosuite.callgraph.DistanceTransformer $ClassEntry

行号:2

    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall           er.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(A           bstractReferenceUnmarshaller.java:63)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm           arshaller.java:76)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm           arshaller.java:60)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionCon           verter.readItem(AbstractCollectionConverter.java:71)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.p           opulateCollection(CollectionConverter.java:68)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.u           nmarshal(CollectionConverter.java:61)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall           er.java:82)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(A           bstractReferenceUnmarshaller.java:63)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm           arshaller.java:76)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm           arshaller.java:60)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller           .java:137)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarsh           al(AbstractTreeMarshallingStrategy.java:33)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:923)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:909)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
    at de.unisb.cs.st.evosuite.utils.Utils.readXML(Utils.java:301)
    at de.unisb.cs.st.evosuite.callgraph.Hierarchy.readFromDefaultLocation(H           ierarchy.java:113)
    at de.unisb.cs.st.evosuite.setup.TestTaskGenerator.<clinit>(TestTaskGene           rator.java:57)
    ... 1 more

原因:com.thoughtworks.xstream.converters.reflection.ObjectAccessException:无法构造 de.unisb.cs.st.evosuite.callgraph.DistanceTransformer$ClassEnt ry,因为它在 com.thoughtworks.xstream 中没有无参数构造函数。 converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:71) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter.instantiateNewInstance(AbstractReflectionConverter.java:308) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConv erter .unmarshal(AbstractReflectionConverter.java:161) 在 com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall er.java:82) ... 19 更多

我不明白这一点 - 任何人都可以帮忙 - 我多年来一直在努力解决这个问题。evosuite 文档可在 www.evosuite.org/documentation 获得

4

1 回答 1

0

我认为这是一个内部 evosuite 错误,由于某种原因,它是在 cygwin 中运行引起的。

于 2012-07-26T22:50:39.840 回答