|
4 | 4 | import io.avaje.inject.spi.DependencyMeta;
|
5 | 5 |
|
6 | 6 | import javax.annotation.processing.FilerException;
|
7 |
| -import javax.lang.model.element.*; |
| 7 | +import javax.lang.model.element.Element; |
| 8 | +import javax.lang.model.element.ElementKind; |
| 9 | +import javax.lang.model.element.Name; |
| 10 | +import javax.lang.model.element.TypeElement; |
8 | 11 | import javax.tools.JavaFileObject;
|
9 | 12 | import java.io.IOException;
|
10 | 13 | import java.util.*;
|
@@ -183,8 +186,17 @@ private void initialiseModule() {
|
183 | 186 | if (!moduleInitialised) {
|
184 | 187 | try {
|
185 | 188 | initialiseName(MetaTopPackage.of(metaData.values()));
|
| 189 | + context.addModule(moduleFullName); |
186 | 190 | moduleInitialised = true;
|
187 | 191 | } catch (IOException e) {
|
| 192 | + if (context.isDuplicateModule(moduleFullName)) { |
| 193 | + String msg = "Attempting to create 2 modules both called " + moduleFullName |
| 194 | + + ". This can occur when a custom scope (named from it's annotation) has a name clash with" + |
| 195 | + " the default module which can be named from the package. Look to resolve this by either " + |
| 196 | + "changing the name of the custom scope annotation, or explicitly naming the default scope " + |
| 197 | + "using @InjectModule(name), or changing the top level package used by the default scope"; |
| 198 | + throw new IllegalStateException(msg); |
| 199 | + } |
188 | 200 | context.logError("Failed to create module filer " + e.getMessage());
|
189 | 201 | }
|
190 | 202 | }
|
|
0 commit comments