Skip to content

Commit fc37cb2

Browse files
committed
ScriptLanguageIndex: give details on duplicates
In particular, it helps to know which JAR file each language came from.
1 parent b37942c commit fc37cb2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/org/scijava/script/ScriptLanguageIndex.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import javax.script.ScriptEngineFactory;
4141

4242
import org.scijava.log.LogService;
43+
import org.scijava.util.ClassUtils;
4344
import org.scijava.util.FileUtils;
4445

4546
/**
@@ -175,8 +176,13 @@ private String overwriteMessage(final boolean overwrite, final String type,
175176
{
176177
return (overwrite ? "Overwriting " : "Not overwriting ") + //
177178
type + " '" + key + "':\n" + //
178-
"\tproposed = " + proposed.getClass().getName() + "\n" +
179-
"\texisting = " + existing.getClass().getName();
179+
"\tproposed = " + details(proposed) + "\n" +
180+
"\texisting = " + details(existing);
180181
}
181182

183+
/** Helper method of {@link #overwriteMessage}. */
184+
private String details(final ScriptLanguage language) {
185+
final Class<?> c = language.getClass();
186+
return c.getName() + " [" + ClassUtils.getLocation(c);
187+
}
182188
}

0 commit comments

Comments
 (0)