java - Ant Javac Task Deletes Method -


i have run trully bizarre behavior in java project. situation javac seems removing method class during compilation.

the class looks this:

public class messedup extends x {     //a bunch of variables here     //a bunch of methods here      public void thisdisappears(string arg){      }      //a bunch more methods here  } 

there class instantiates , calls method:

public class wontcompile {      public void dosomething(){         messedup mu = new messedup();         mu.thisdisappears("something");     } } 

the first class compiles fine, second doesn't. javac outputs following:

[javac] c:\mypath\wontcompile.java:251: error: cannot find symbol [javac]                     mu.thisdisappears("something"); [javac]                       ^ [javac]   symbol:   method thisdisappears(string) [javac]   location: variable mu of type messedup 

i know code fine because have been using in eclipse couple of years (i'm tracking down problem try use ant file eclipse produced). however, once in while eclipse highlight call thisdisappears, saying doesn't exist, , offering create it. if accept offer, eclipse complains there 2 methods same name. after little bit of finagling apparently causes rebuild or something, error goes away.

after being driven while while, decided check actual class file messedup.java. using java decompiler gui, found thisdisappears isn't present in class file!

below ant file:

<project basedir="." default="build" name="myproject">     <property name="lib_home" value="c:\dev\libsuite-9.3.1"/>     <property environment="env"/>     <property name="debuglevel" value="source,lines,vars"/>     <property name="target" value="1.7"/>     <property name="source" value="1.7"/>     <path id="myproject.classpath">         <pathelement location="bin"/>         <pathelement location="lib/edu.mit.jwi_2.1.4.jar"/>         <pathelement location="lib/edu.sussex.nlp.jws.beta.11.jar"/>         <pathelement location="lib/jaws-bin.jar"/>         <pathelement location="lib/junit-4.11.jar"/>         <!--external jars-->         <pathelement location="${lib_home}/share/java/abc.jar"/>         <pathelement location="${lib_home}/share/java/def-9.3.1.jar"/>     </path>     <target name="init">         <mkdir dir="bin"/>         <copy includeemptydirs="false" todir="bin">             <fileset dir="main/src">                 <exclude name="**/*.launch"/>                 <exclude name="**/*.java"/>             </fileset>         </copy>         <copy includeemptydirs="false" todir="bin">             <fileset dir="main/test">                 <exclude name="**/*.launch"/>                 <exclude name="**/*.java"/>             </fileset>         </copy>     </target>     <target name="clean">         <delete dir="bin"/>     </target>      <target depends="init" name="build">         <echo message="${ant.project.name}: ${ant.file}"/>         <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">             <classpath refid="myproject.classpath"/>             <src path="main/src"/>             <src path="main/test"/>             <compilerarg value="-xlint"/>         </javac>     </target>      <!--test app-->     <target depends="build" name="regression">         <junit>             <classpath refid="myproject.classpath"/>             <test name="uni.my.app.testsuite"/>         </junit>     </target>      <!--run app-->     <target depends="build" name="run">         <java classname="uni.my.app.application">             <classpath refid="myproject.classpath"/>             <arg value="sentences.txt"/>         </java>     </target> </project> 

unfortunately, unable put minimum breaking example. code working on not yet released public, can't share yet. references several jars (with no conflicting namespaces), native methods. have no idea exact combination of classes , jars causes error. had same problem using jdk 1.6.0_25 , 1.7.21.

does have experience or ideas on how solve problem?

this guess.

ant operates outside of eclipse, , therefore changes makes not reflected in eclipse's massively cached view of world. know, eclipse's changes not reflected in files ant uses, either.

i project clean, project build, project refresh. see if have problem within eclipse. run ant (if must), refresh, , see if problem exists then.

any time in either eclipse or ant, before use other program, refresh eclipse project.

let know how goes.

p.s. trust java compiler not removing methods. agree have strange going on, isn't it.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -