Sorry i have to agree that i provided much too less information. My only excuse is that it was in the middle of the night and the onyl thing i wanted was to go to bed.
I have here some very simple sample code to show the problem. I will just past it in here. I hope i will not break your conventions in doing so.
There are 2 classes, one simple analyser and some piece of rubbish code to be analysed.
Using qdox-1.11 gives false line numbers. Using qdox-1.10-20090625.205651-6.jar the line numbers are ok. I did not test any other version.
----------------------------------------
the simple analyser
-----------------------------------------
package test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import com.thoughtworks.qdox.JavaDocBuilder;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaMethod;
public class JavaMethodLinePrinter{
public void printMethods(JavaClass aClass) {
JavaMethod methods[] = aClass.getMethods();
for (JavaMethod method : methods) {
System.out.println(method.getName() + " starts at line: "+method.getLineNumber());
}
}
public void checkJavaFile(String aFileName) throws FileNotFoundException {
JavaDocBuilder builder = new JavaDocBuilder();
builder.addSource(new FileReader(aFileName));
JavaClass classes[] = builder.getClasses();
for (JavaClass javaClass : classes) {
printMethods(javaClass);
}
}
public static void main(String[] args) throws FileNotFoundException {
String fileName = "./src/test/SomeVeryStupidExampleCodeToBeParsed.java";
JavaMethodLinePrinter p = new JavaMethodLinePrinter();
p.checkJavaFile(fileName);
}
}
---------------------------------------
the rubbish code to be analysed
--------------------------------------
package test;
import java.util.Collection;
import java.util.Set;
import org.apache.log4j.Logger;
/**
* Some stupid nonsense code only provided to be analysed
*/
public abstract class SomeVeryStupidExampleCodeToBeParsed {
/**
* Slave event queue name. Input queue for slave ExternalEventManager.
*/
public static final String EVENT_QUEUE_NAME = "EventQueue";
public static final String RUNNABLE_QUEUE_NAME = "RunnableQueue";
private static final Logger ourLogger = Logger.getLogger(SomeVeryStupidExampleCodeToBeParsed.class);
private static final String EVENTCONSUMER_PROVIDER_ID = "PLUGIN_IDxyz";
private static SomeVeryStupidExampleCodeToBeParsed ourInstance;
protected long mySequenceNbr;
/**
* some comment in here
*/
protected SomeVeryStupidExampleCodeToBeParsed() {
}
/**
* some comment in here
*/
public void reset() {
}
/**
* some comment in here
*/
public static synchronized SomeVeryStupidExampleCodeToBeParsed getInstance() {
return ourInstance;
}
public void destroy() {
}
/**
* {@inheritDoc}
* some comment
*/
public final boolean someBooleanFkt() {
return true;
}
/** {@inheritDoc}
* some comment
*/
public abstract void someAbstractMethod(String aParameter);
/**
* {@inheritDoc}
* @see com.alcatel.tas.hmi.externaleventmanager.IExternalEventManager#modifyEventQueuePriority(java.lang.String, int)
*/
public boolean stillAnotherFkt(String aXyz) throws IllegalArgumentException {
if (aXyz == null) {
throw new IllegalArgumentException("no null param allowed");
}
return true;
}
/* (non-Javadoc)
* some comment
*/
public String getSomething() {
return null;
}
/* (non-Javadoc)
* dkadjkdf
*/
public Collection<Object> getCollection() {
return null;
}
boolean isSomething() {
return false;
}
/** {@inheritDoc}
* @see com.alcatel.tas.hmi.externaleventmanager.IExternalEventManager#getQueueNames()
*/
public Set<String> getSomeSet() {
return null;
}
/** {@inheritDoc}
* @see com.alcatel.tas.hmi.externaleventmanager.IExternalEventManager#getNumberOfEventQueues()
*/
public int getNumberOfSomething() {
return 0;
}
/** {@inheritDoc}
*/
public long getActualSomething() {
return -1L;
}
/**
* {@inheritDoc}
*/
public abstract long getRemoteSomething();
/**
* {@inheritDoc}
*/
public Object getActualSomethingElse() {
return null;
}
}
I hope this helps
Kind regards
Alfred Pfeffer
We have some unittests which check the linenumbers, so this is just much too general. Does it affect qdox-1.10.1 as well?
The only issue where I had to touch the linenumbers was
QDOX-168, but this was part of the 1.10 release.So first of all provide the smallest test, asserting the rownumbers. Otherwise it's just that needle in the haystack.