rbtr-lang-java 2026.9.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rbtr_lang_java-2026.9.0.dev1/LICENSE +21 -0
- rbtr_lang_java-2026.9.0.dev1/PKG-INFO +64 -0
- rbtr_lang_java-2026.9.0.dev1/README.md +37 -0
- rbtr_lang_java-2026.9.0.dev1/pyproject.toml +58 -0
- rbtr_lang_java-2026.9.0.dev1/pyproject.toml.orig +62 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/__init__.py +1 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/java.scm +45 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/plugin.py +52 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/py.typed +0 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/__init__.py +0 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/__snapshots__/test_samples/test_edges_match_snapshot.json +4 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/__snapshots__/test_samples/test_extraction_matches_snapshot.json +515 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/cases_docstrings.py +113 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/cases_extraction.py +215 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/samples/java/com/example/format/Formatter.java +6 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/samples/java/java.java +75 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/test_docstrings.py +43 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/test_extraction.py +57 -0
- rbtr_lang_java-2026.9.0.dev1/src/rbtr_lang_java/tests/test_samples.py +73 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alejandro Giacometti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rbtr-lang-java
|
|
3
|
+
Version: 2026.9.0.dev1
|
|
4
|
+
Summary: rbtr — Java language plugin
|
|
5
|
+
Keywords: code-search,code-index,tree-sitter,static-analysis,semantic-search,developer-tools,java
|
|
6
|
+
Author: Alejandro Giacometti
|
|
7
|
+
Author-email: Alejandro Giacometti <alejandro.giacometti@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Java
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: rbtr==2026.9.0.dev1
|
|
19
|
+
Requires-Dist: tree-sitter-java
|
|
20
|
+
Requires-Python: >=3.13
|
|
21
|
+
Project-URL: Homepage, https://github.com/janrito/rbtr
|
|
22
|
+
Project-URL: Repository, https://github.com/janrito/rbtr
|
|
23
|
+
Project-URL: Documentation, https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-java#readme
|
|
24
|
+
Project-URL: Issues, https://github.com/janrito/rbtr/issues
|
|
25
|
+
Project-URL: Changelog, https://github.com/janrito/rbtr/releases
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# rbtr-lang-java
|
|
29
|
+
|
|
30
|
+
Java support for [rbtr]. Optional plugin — install with
|
|
31
|
+
`pip install rbtr[java]`.
|
|
32
|
+
|
|
33
|
+
[rbtr]: https://github.com/janrito/rbtr/tree/main/packages/rbtr#readme
|
|
34
|
+
|
|
35
|
+
## What it ingests
|
|
36
|
+
|
|
37
|
+
Java is class-only (no free functions), so extraction is class-centred:
|
|
38
|
+
|
|
39
|
+
- **Classes** — classes, interfaces, enums, records, annotations.
|
|
40
|
+
- **Methods** — methods and constructors, scoped to their type.
|
|
41
|
+
- **Variables** — fields (class members are data-scope, captured as
|
|
42
|
+
variables) and enum constants.
|
|
43
|
+
- **Imports** — `import` (and `import static`) declarations.
|
|
44
|
+
|
|
45
|
+
Leading Javadoc (`/** … */`) folds into the symbol's content.
|
|
46
|
+
|
|
47
|
+
## Chunks produced
|
|
48
|
+
|
|
49
|
+
```java
|
|
50
|
+
public class Formatter { // class "Formatter"
|
|
51
|
+
private int width; // variable "width", scope "Formatter"
|
|
52
|
+
Formatter(int w) { … } // method "Formatter", scope "Formatter"
|
|
53
|
+
String format(String s) { … } // method "format", scope "Formatter"
|
|
54
|
+
}
|
|
55
|
+
import java.util.List; // import, metadata {module: java.util.List}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Embedded / injected chunks
|
|
59
|
+
|
|
60
|
+
None. Java does not embed other languages.
|
|
61
|
+
|
|
62
|
+
## Grammar & dependencies
|
|
63
|
+
|
|
64
|
+
Uses the `tree-sitter-java` grammar. No dependency on other language plugins.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# rbtr-lang-java
|
|
2
|
+
|
|
3
|
+
Java support for [rbtr]. Optional plugin — install with
|
|
4
|
+
`pip install rbtr[java]`.
|
|
5
|
+
|
|
6
|
+
[rbtr]: https://github.com/janrito/rbtr/tree/main/packages/rbtr#readme
|
|
7
|
+
|
|
8
|
+
## What it ingests
|
|
9
|
+
|
|
10
|
+
Java is class-only (no free functions), so extraction is class-centred:
|
|
11
|
+
|
|
12
|
+
- **Classes** — classes, interfaces, enums, records, annotations.
|
|
13
|
+
- **Methods** — methods and constructors, scoped to their type.
|
|
14
|
+
- **Variables** — fields (class members are data-scope, captured as
|
|
15
|
+
variables) and enum constants.
|
|
16
|
+
- **Imports** — `import` (and `import static`) declarations.
|
|
17
|
+
|
|
18
|
+
Leading Javadoc (`/** … */`) folds into the symbol's content.
|
|
19
|
+
|
|
20
|
+
## Chunks produced
|
|
21
|
+
|
|
22
|
+
```java
|
|
23
|
+
public class Formatter { // class "Formatter"
|
|
24
|
+
private int width; // variable "width", scope "Formatter"
|
|
25
|
+
Formatter(int w) { … } // method "Formatter", scope "Formatter"
|
|
26
|
+
String format(String s) { … } // method "format", scope "Formatter"
|
|
27
|
+
}
|
|
28
|
+
import java.util.List; // import, metadata {module: java.util.List}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Embedded / injected chunks
|
|
32
|
+
|
|
33
|
+
None. Java does not embed other languages.
|
|
34
|
+
|
|
35
|
+
## Grammar & dependencies
|
|
36
|
+
|
|
37
|
+
Uses the `tree-sitter-java` grammar. No dependency on other language plugins.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.11.26,<1"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[tool.uv.build-backend]
|
|
6
|
+
module-name = "rbtr_lang_java"
|
|
7
|
+
|
|
8
|
+
[tool.uv.sources.rbtr]
|
|
9
|
+
workspace = true
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "rbtr-lang-java"
|
|
13
|
+
version = "2026.9.0-dev1"
|
|
14
|
+
description = "rbtr — Java language plugin"
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
license-files = ["LICENSE"]
|
|
18
|
+
keywords = [
|
|
19
|
+
"code-search",
|
|
20
|
+
"code-index",
|
|
21
|
+
"tree-sitter",
|
|
22
|
+
"static-analysis",
|
|
23
|
+
"semantic-search",
|
|
24
|
+
"developer-tools",
|
|
25
|
+
"java",
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 4 - Beta",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"Programming Language :: Java",
|
|
31
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Topic :: Software Development :: Libraries",
|
|
34
|
+
"Topic :: Text Processing :: Indexing",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
requires-python = ">=3.13"
|
|
38
|
+
dependencies = [
|
|
39
|
+
"rbtr==2026.9.0-dev1",
|
|
40
|
+
"tree-sitter-java",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[[project.authors]]
|
|
44
|
+
name = "Alejandro Giacometti"
|
|
45
|
+
email = "alejandro.giacometti@gmail.com"
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://github.com/janrito/rbtr"
|
|
49
|
+
Repository = "https://github.com/janrito/rbtr"
|
|
50
|
+
Documentation = "https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-java#readme"
|
|
51
|
+
Issues = "https://github.com/janrito/rbtr/issues"
|
|
52
|
+
Changelog = "https://github.com/janrito/rbtr/releases"
|
|
53
|
+
|
|
54
|
+
[project.entry-points."rbtr.languages"]
|
|
55
|
+
java = "rbtr_lang_java.plugin:java"
|
|
56
|
+
|
|
57
|
+
[dependency-groups]
|
|
58
|
+
dev = ["rbtr[test]"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.11.26,<1"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[tool.uv.build-backend]
|
|
6
|
+
module-name = "rbtr_lang_java"
|
|
7
|
+
# No source-exclude: the plugin's tests, samples, and snapshots ship with
|
|
8
|
+
# the wheel (they are the language's golden record), and java.scm ships as
|
|
9
|
+
# package data.
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "rbtr-lang-java"
|
|
13
|
+
version = "2026.9.0-dev1"
|
|
14
|
+
description = "rbtr — Java language plugin"
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
license-files = ["LICENSE"]
|
|
18
|
+
authors = [
|
|
19
|
+
{ name = "Alejandro Giacometti", email = "alejandro.giacometti@gmail.com" },
|
|
20
|
+
]
|
|
21
|
+
keywords = [
|
|
22
|
+
"code-search",
|
|
23
|
+
"code-index",
|
|
24
|
+
"tree-sitter",
|
|
25
|
+
"static-analysis",
|
|
26
|
+
"semantic-search",
|
|
27
|
+
"developer-tools",
|
|
28
|
+
"java",
|
|
29
|
+
]
|
|
30
|
+
classifiers = [
|
|
31
|
+
"Development Status :: 4 - Beta",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
33
|
+
"Programming Language :: Java",
|
|
34
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Topic :: Software Development :: Libraries",
|
|
37
|
+
"Topic :: Text Processing :: Indexing",
|
|
38
|
+
"Typing :: Typed",
|
|
39
|
+
]
|
|
40
|
+
requires-python = ">=3.13"
|
|
41
|
+
dependencies = [
|
|
42
|
+
"rbtr==2026.9.0-dev1",
|
|
43
|
+
"tree-sitter-java",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/janrito/rbtr"
|
|
48
|
+
Repository = "https://github.com/janrito/rbtr"
|
|
49
|
+
Documentation = "https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-java#readme"
|
|
50
|
+
Issues = "https://github.com/janrito/rbtr/issues"
|
|
51
|
+
Changelog = "https://github.com/janrito/rbtr/releases"
|
|
52
|
+
|
|
53
|
+
[project.entry-points."rbtr.languages"]
|
|
54
|
+
# The value resolves to the language's `LanguageRegistration` (named by its
|
|
55
|
+
# id) — see the rbtr ARCHITECTURE "External plugins" note.
|
|
56
|
+
java = "rbtr_lang_java.plugin:java"
|
|
57
|
+
|
|
58
|
+
[tool.uv.sources]
|
|
59
|
+
rbtr = { workspace = true }
|
|
60
|
+
|
|
61
|
+
[dependency-groups]
|
|
62
|
+
dev = ["rbtr[test]"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Java language plugin package."""
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
; Top-level comments (Java: `//` line and `/* */`, `/** */` block).
|
|
2
|
+
[(line_comment) (block_comment)] @comment
|
|
3
|
+
|
|
4
|
+
(method_declaration
|
|
5
|
+
name: (identifier) @_method_name) @method
|
|
6
|
+
|
|
7
|
+
(constructor_declaration
|
|
8
|
+
name: (identifier) @_method_name) @method
|
|
9
|
+
|
|
10
|
+
(field_declaration
|
|
11
|
+
declarator: (variable_declarator
|
|
12
|
+
name: (identifier) @_var_name)) @variable
|
|
13
|
+
|
|
14
|
+
(class_declaration
|
|
15
|
+
name: (identifier) @_cls_name) @class
|
|
16
|
+
|
|
17
|
+
(interface_declaration
|
|
18
|
+
name: (identifier) @_cls_name) @class
|
|
19
|
+
|
|
20
|
+
(enum_declaration
|
|
21
|
+
name: (identifier) @_cls_name) @class
|
|
22
|
+
|
|
23
|
+
(enum_declaration
|
|
24
|
+
body: (enum_body
|
|
25
|
+
(enum_constant
|
|
26
|
+
name: (identifier) @_var_name) @variable))
|
|
27
|
+
|
|
28
|
+
(record_declaration
|
|
29
|
+
name: (identifier) @_cls_name) @class
|
|
30
|
+
|
|
31
|
+
(record_declaration
|
|
32
|
+
parameters: (formal_parameters
|
|
33
|
+
(formal_parameter
|
|
34
|
+
name: (identifier) @_var_name) @variable))
|
|
35
|
+
|
|
36
|
+
(annotation_type_declaration
|
|
37
|
+
name: (identifier) @_cls_name) @class
|
|
38
|
+
|
|
39
|
+
(annotation_type_declaration
|
|
40
|
+
body: (annotation_type_body
|
|
41
|
+
(annotation_type_element_declaration
|
|
42
|
+
name: (identifier) @_method_name) @method))
|
|
43
|
+
|
|
44
|
+
(import_declaration
|
|
45
|
+
(scoped_identifier) @_import_module) @import
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Java language plugin.
|
|
2
|
+
|
|
3
|
+
Provides class, method, and import extraction.
|
|
4
|
+
|
|
5
|
+
Extracted chunks::
|
|
6
|
+
|
|
7
|
+
class User {} → class "User", scope ""
|
|
8
|
+
class Service {
|
|
9
|
+
void process() {} → method "process", scope "Service"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
import java.util.HashMap
|
|
13
|
+
→ import, metadata {module: "java.util.HashMap"}
|
|
14
|
+
import static org.junit.Assert.assertEquals
|
|
15
|
+
→ import, metadata {module: "org.junit.Assert.assertEquals"}
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from rbtr.languages.registration import (
|
|
21
|
+
LanguageRegistration,
|
|
22
|
+
ModuleStyle,
|
|
23
|
+
QueryExtraction,
|
|
24
|
+
load_query,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# ── Query ────────────────────────────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# ── Plugin ───────────────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
java = LanguageRegistration(
|
|
34
|
+
id="java",
|
|
35
|
+
extensions=frozenset({".java"}),
|
|
36
|
+
grammar_module="tree_sitter_java",
|
|
37
|
+
extraction=QueryExtraction(
|
|
38
|
+
query=load_query(__package__, "java"),
|
|
39
|
+
scope_types=frozenset(
|
|
40
|
+
{
|
|
41
|
+
"class_declaration",
|
|
42
|
+
"interface_declaration",
|
|
43
|
+
"enum_declaration",
|
|
44
|
+
"record_declaration",
|
|
45
|
+
"annotation_type_declaration",
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
source_roots=("", "src/main/java"),
|
|
50
|
+
module_style=ModuleStyle.DOTTED,
|
|
51
|
+
extraction_serial=4,
|
|
52
|
+
)
|
|
File without changes
|
|
File without changes
|