Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ private void inject(PsiClass psiClass, Collection<String> targets) {
.sorted(Comparator.naturalOrder())
.collect(Collectors.joining(", "));

if (interfaceImplementation.isEmpty()) {
return; // Nothing to do, all injected interfaces are already present
}

if (implementsList.getChildren().length == 0) {
StringBuilder text = new StringBuilder();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package pkg;

import java.util.Set;

public class Example implements Set {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pkg/Example": "java/util/Set"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package pkg;

import java.util.Set;

public class Example implements Set {
}
5 changes: 5 additions & 0 deletions tests/src/test/java/net/neoforged/jst/tests/EmbeddedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ void testSimpleInjection() throws Exception {
runInterfaceInjectionTest("simple_injection", tempDir);
}

@Test
void testDeduplication() throws Exception {
runInterfaceInjectionTest("deduplication", tempDir);
}

@Test
void testAdditiveInjection() throws Exception {
runInterfaceInjectionTest("additive_injection", tempDir);
Expand Down
Loading