File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
main/java/io/github/treesitter/jtreesitter
test/java/io/github/treesitter/jtreesitter Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 88
99/** A class that defines how to parse a particular language. */
1010@ NullMarked
11- public final class Language {
11+ public final class Language implements Cloneable {
1212 /**
1313 * The latest ABI version that is supported by the current version of the library.
1414 *
@@ -192,6 +192,17 @@ public Query query(String source) throws QueryError {
192192 return new Query (this , source );
193193 }
194194
195+ /**
196+ * Get another reference to the language.
197+ *
198+ * @since 0.24.0
199+ */
200+ @ Override
201+ @ SuppressWarnings ("MethodDoesntCallSuperMethod" )
202+ public Language clone () {
203+ return new Language (ts_language_copy (self ));
204+ }
205+
195206 @ Override
196207 public boolean equals (Object o ) {
197208 if (this == o ) return true ;
Original file line number Diff line number Diff line change @@ -92,6 +92,6 @@ void query() {
9292 @ Test
9393 void testEquals () {
9494 var other = new Language (TreeSitterJava .language ());
95- assertEquals (language , other );
95+ assertEquals (other , language . clone () );
9696 }
9797}
You can’t perform that action at this time.
0 commit comments