手上有一个工程,使用ant编译的时候报错:无法将 adms.form.logic.Expression 中的 getValue() 应用于 (adms.form.excel.CReport)
value = (String)exp.getValue( this.runner );adms.form.logic.Expression的getValue方法声明如下:  public Object getValue(Object data)
  {
    //实现代码略
  }  public Object getValue()
  {
    //实现代码略
  }
adms.form.excel.CReport的runner变量的类型为CReport: protected CReport runner;ant脚本如下:<project name="TestPrj" default="dist" basedir=".">  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="lib" location="lib"/>
  <property name="bin" location="bin"/>
  <property name="dist"  location="dist"/>  <target name="init">
    <!-- Create the time stamp -->
    <delete dir="${bin}"/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${bin}"/>
  </target>  <path id="classpath">
    <fileset dir="${lib}" includes="*.jar"/>
  </path>  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${bin} -->
    <javac srcdir="${src}" destdir="${bin}" classpathref="classpath" source="1.5" target="1.5" />
  </target>
  
  <!-- 其它部分略 -->
</project>搞不懂为什么会报错。另外奇怪的是这个工程在Eclipse中可以正常编译!请各位大大指点一下。

解决方案 »

  1.   

    再找了一下资料,这个错误的基本意思应该是 adms.form.logic.Expression 中的 getValue() 方法不能接受类型为 adms.form.excel.CReport 的参数,可是其中一个 getValue() 是允许接受类型为 Object 的参数,而 CReport 肯定是 Object 的子类啊!奇怪……
      

  2.   

    找同事帮忙,找到了原因所在:adms.form.logic.Expression 这个类在项目使用的两个jar文件中都有,其中一个没有public Object getValue(Object data)方法,而这个jar文件在classpath中在另一个前面,导致编译出错。