When we use spoon to analyze the source code of a big project like Hadoop, it occurs frequently the problem "The type xxx is already defined", because there may exist Java classes with the same class name and the same package directory in different sub projects.
I got the following error when I run "java -cp xx spoon.Launcher -i ~/hadoop-0.23.3-src/ -p myspoon.CatchProcessor".
Exception in thread "main" spoon.compiler.ModelBuildingException: The type JobInProgress is already defined
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblem(JDTBasedSpoonCompiler.java:550)
at spoon.support.compiler.jdt.TreeBuilderRequestor.acceptResult(TreeBuilderRequestor.java:37)
at spoon.support.compiler.jdt.TreeBuilderCompiler.buildUnits(TreeBuilderCompiler.java:73)
at spoon.support.compiler.jdt.JDTBatchCompiler.getUnits(JDTBatchCompiler.java:120)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnits(JDTBasedSpoonCompiler.java:410)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnitsAndModel(JDTBasedSpoonCompiler.java:372)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildSources(JDTBasedSpoonCompiler.java:348)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:119)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:102)
at spoon.Launcher.buildModel(Launcher.java:700)
at spoon.Launcher.run(Launcher.java:651)
at spoon.Launcher.run(Launcher.java:106)
at spoon.Launcher.main(Launcher.java:99)
And I find there are two JobInProgress.java in the same sub-project "hadoop-mapreduce-project"
./hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobInProgress.java
./hadoop-mapreduce-project/src/java/org/apache/hadoop/mapred/JobInProgress.java
So how to fix this problem ????? I already found that it seems we couldn't move away one of both to run spoon analysis, because it will cause another problem of "missing files"
Exception in thread "main" spoon.compiler.ModelBuildingException: The import org.apache.hadoop.conf cannot be resolved at xxx
Any comments for the problem? Thanks.