diff --git a/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/TSqlLanguageModule.java b/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/TSqlLanguageModule.java new file mode 100644 index 0000000000..7cf569c2ec --- /dev/null +++ b/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/TSqlLanguageModule.java @@ -0,0 +1,25 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.tsql; + +import net.sourceforge.pmd.cpd.Tokenizer; +import net.sourceforge.pmd.lang.LanguagePropertyBundle; +import net.sourceforge.pmd.lang.impl.CpdOnlyLanguageModuleBase; +import net.sourceforge.pmd.lang.tsql.cpd.TSqlTokenizer; + +/** + * @author pguyot@kallisys.net + */ +public class TSqlLanguageModule extends CpdOnlyLanguageModuleBase { + + public TSqlLanguageModule() { + super(LanguageMetadata.withId("tsql").name("TSql").extensions("sql")); + } + + @Override + public Tokenizer createCpdTokenizer(LanguagePropertyBundle bundle) { + return new TSqlTokenizer(); + } +} diff --git a/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlLanguage.java b/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlLanguage.java deleted file mode 100644 index 7f087b1238..0000000000 --- a/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlLanguage.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * BSD-style license; for more info see http://pmd.sourceforge.net/license.html - */ - -package net.sourceforge.pmd.lang.tsql.cpd; - -import net.sourceforge.pmd.cpd.AbstractLanguage; - -/** - * @author pguyot@kallisys.net - */ -public class TSqlLanguage extends AbstractLanguage { - - public TSqlLanguage() { - super("TSql", "tsql", new TSqlTokenizer(), ".sql"); - } -} diff --git a/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizer.java b/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizer.java index 6274dbf6da..9676b37f7c 100644 --- a/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizer.java +++ b/pmd-tsql/src/main/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizer.java @@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.tsql.cpd; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Lexer; -import net.sourceforge.pmd.cpd.internal.AntlrTokenizer; +import net.sourceforge.pmd.cpd.impl.AntlrTokenizer; import net.sourceforge.pmd.lang.tsql.ast.TSqlLexer; public class TSqlTokenizer extends AntlrTokenizer { diff --git a/pmd-tsql/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language b/pmd-tsql/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language deleted file mode 100644 index 1baf52236f..0000000000 --- a/pmd-tsql/src/main/resources/META-INF/services/net.sourceforge.pmd.cpd.Language +++ /dev/null @@ -1 +0,0 @@ -net.sourceforge.pmd.lang.tsql.cpd.TSqlLanguage diff --git a/pmd-tsql/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language b/pmd-tsql/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language new file mode 100644 index 0000000000..59fe8792ad --- /dev/null +++ b/pmd-tsql/src/main/resources/META-INF/services/net.sourceforge.pmd.lang.Language @@ -0,0 +1 @@ +net.sourceforge.pmd.lang.tsql.TSqlLanguageModule diff --git a/pmd-tsql/src/test/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizerTest.java b/pmd-tsql/src/test/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizerTest.java index 6723ebc2fc..79f3d42e41 100644 --- a/pmd-tsql/src/test/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizerTest.java +++ b/pmd-tsql/src/test/java/net/sourceforge/pmd/lang/tsql/cpd/TSqlTokenizerTest.java @@ -4,27 +4,14 @@ package net.sourceforge.pmd.lang.tsql.cpd; -import java.util.Properties; - import org.junit.jupiter.api.Test; -import net.sourceforge.pmd.cpd.Tokenizer; import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest; class TSqlTokenizerTest extends CpdTextComparisonTest { TSqlTokenizerTest() { - super(".sql"); - } - - @Override - public Tokenizer newTokenizer(Properties properties) { - return new TSqlTokenizer(); - } - - @Override - protected String getResourcePrefix() { - return "../cpd/testdata"; + super("tsql", ".sql"); } @Test