Skip to content

Commit a19eb65

Browse files
authored
Revert "validate only services in the same module (#91)" (#93)
This reverts commit 4fd7024.
1 parent 7bf84d9 commit a19eb65

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

prism-core/src/main/java/io/avaje/prism/internal/ModuleInfoReaderWriter.java

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -215,23 +215,7 @@ public static void write(PrintWriter out, String packageName) {
215215
+ " if (buildPluginAvailable() || moduleElement.isUnnamed() || APContext.isTestCompilation()) {\n"
216216
+ " return;\n"
217217
+ " }\n"
218-
+ " var implSet = new TreeSet<>(implementations);\n"
219-
+ " try (final var file =\n"
220-
+ " APContext.filer()\n"
221-
+ " .getResource(StandardLocation.CLASS_OUTPUT, \"\", \"META-INF/services/\" + providesType)\n"
222-
+ " .toUri()\n"
223-
+ " .toURL()\n"
224-
+ " .openStream();\n"
225-
+ " final var buffer = new BufferedReader(new InputStreamReader(file)); ) {\n"
226-
+ "\n"
227-
+ " String line;\n"
228-
+ " while ((line = buffer.readLine()) != null) {\n"
229-
+ " line.replaceAll(\"\\\\s\", \"\").replace(\",\", \"\\n\").lines().forEach(implSet::add);\n"
230-
+ " }\n"
231-
+ " } catch (Exception e) {\n"
232-
+ " // not a critical error\n"
233-
+ " }\n"
234-
+ " final var missingImpls = implSet.stream().map(this::replace$).filter(this::isSameModule).collect(toSet());\n"
218+
+ " final var missingImpls = new TreeSet<>(implementations).stream().map(this::replace$).collect(toSet());\n"
235219
+ "\n"
236220
+ " provides()\n"
237221
+ " .forEach(\n"
@@ -254,15 +238,6 @@ public static void write(PrintWriter out, String packageName) {
254238
+ " }\n"
255239
+ " }\n"
256240
+ "\n"
257-
+ " private boolean isSameModule(String type) {\n"
258-
+ " var element = APContext.typeElement(type);\n"
259-
+ " return element != null\n"
260-
+ " && APContext.elements()\n"
261-
+ " .getModuleOf(element)\n"
262-
+ " .getSimpleName()\n"
263-
+ " .contentEquals(moduleElement.getSimpleName());\n"
264-
+ " }\n"
265-
+ "\n"
266241
+ " private static boolean buildPluginAvailable() {\n"
267242
+ " return isPresent(\"avaje-plugin-exists.txt\");\n"
268243
+ " }\n"

0 commit comments

Comments
 (0)