2626import org .sonarsource .api .sonarlint .SonarLintSide ;
2727
2828/**
29- * The extension point to define a new language
29+ * The extension point to define a new language. A Language is defined by a key and a name (aka label).
30+ * <br/><br/>
31+ * When source files are analyzed on SonarLint or on scanner side, they will be optionally assigned to a language. A given source file
32+ * (see {@link org.sonar.api.batch.fs.InputFile}) can only have one language (or no language).
33+ * Implementors can declare file extensions (using {@link #getFileSuffixes()})
34+ * or filename patterns (using {@link #filenamePatterns()} that will be used to decide which language should be associated to a file.
35+ * <br/>
36+ * Since a source file can only have one language, patterns should match disjoint sets of files.
3037 *
3138 * @since 1.10
3239 */
@@ -53,7 +60,8 @@ public interface Language {
5360 * returning <code>["**/*.jav", "**/*.java"]</code>.<br/>
5461 * The filename extension matching is case-insensitive, so declaring <code>["java"]</code> will match "src/main/java/Foo.java" and
5562 * "src/main/java/Foo.JAVA".<br/>
56- * If both {@link #getFileSuffixes()} and {@link #filenamePatterns()} are provided, both will be considered.
63+ * If both {@link #getFileSuffixes()} and {@link #filenamePatterns()} are provided, both will be considered. Implementors should be careful
64+ * to have each language suffix and patterns matching disjoint set of files, since a file can be assigned to only one language.
5765 */
5866 String [] getFileSuffixes ();
5967
@@ -71,7 +79,8 @@ default boolean publishAllFiles() {
7179 * Pattern are considered relative: <code>["pom.xml"]</code> is equivalent to <code>["**/pom.xml"]</code> <br/>
7280 * The filename extension matching is case-insensitive, so declaring <code>["**/*Test.java"]</code> will match "FooTest.java" and
7381 * "FooTest.JAVA" but <strong>not</strong> "FooTEST.java".<br/>
74- * If both {@link #getFileSuffixes()} and {@link #filenamePatterns()} are provided, both will be considered.
82+ * If both {@link #getFileSuffixes()} and {@link #filenamePatterns()} are provided, both will be considered. Implementors should be careful
83+ * to have each language suffix and patterns matching disjoint set of files, since a file can be assigned to only one language.
7584 * @since 9.16
7685 */
7786 default String [] filenamePatterns () {
0 commit comments