INRIA / INRIA/spoon

[Bug]: Attempting to build model of Dubbo (3.1.1)

Open
#4,952 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

### Describe the bug

I try to analyze Dubbo source code, but Spoon throws a ModelBuildingException. Shall I use Spoon to analyze such multi-pom.xml projects? Or I need to set some properties of maven laucher?

### Source code you are trying to analyze/transform

```Java
Source code are downloaded from https://github.com/apache/dubbo/archive/refs/tags/dubbo-3.1.1.zip
```

### Source code for your Spoon processing

```Java
MavenLauncher launcher = new MavenLauncher(
"/home/cstar/Downloads/dubbo-dubbo-3.1.1",
MavenLauncher.SOURCE_TYPE.APP_SOURCE);
launcher.buildModel();
```

### Actual output

```Java
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" spoon.compiler.ModelBuildingException: The type Application is already defined
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblem(JDTBasedSpoonCompiler.java:598)
at spoon.support.compiler.jdt.TreeBuilderRequestor.acceptResult(TreeBuilderRequestor.java:29)
at spoon.support.compiler.jdt.TreeBuilderCompiler.buildUnits(TreeBuilderCompiler.java:110)
at spoon.support.compiler.jdt.JDTBatchCompiler.getUnits(JDTBatchCompiler.java:283)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnits(JDTBasedSpoonCompiler.java:416)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnitsAndModel(JDTBasedSpoonCompiler.java:368)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildSources(JDTBasedSpoonCompiler.java:334)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:115)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:98)
at spoon.Launcher.buildModel(Launcher.java:782)
at Main.main(Main.java:9)

Process finished with exit code 1
```

### Expected output

```Java
build model successfully.
```

### Spoon Version

10.1.1

### JVM Version

11

### What operating system are you using?

Ubuntu 20.04.3 LTS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.