@opensip-cli/lang-java 0.1.0

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.
Files changed (45) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/adapter.test.d.ts +2 -0
  5. package/dist/__tests__/adapter.test.d.ts.map +1 -0
  6. package/dist/__tests__/adapter.test.js +167 -0
  7. package/dist/__tests__/adapter.test.js.map +1 -0
  8. package/dist/__tests__/strip.test.d.ts +2 -0
  9. package/dist/__tests__/strip.test.d.ts.map +1 -0
  10. package/dist/__tests__/strip.test.js +57 -0
  11. package/dist/__tests__/strip.test.js.map +1 -0
  12. package/dist/__tests__/substrate.test.d.ts +2 -0
  13. package/dist/__tests__/substrate.test.d.ts.map +1 -0
  14. package/dist/__tests__/substrate.test.js +72 -0
  15. package/dist/__tests__/substrate.test.js.map +1 -0
  16. package/dist/adapter.d.ts +6 -0
  17. package/dist/adapter.d.ts.map +1 -0
  18. package/dist/adapter.js +12 -0
  19. package/dist/adapter.js.map +1 -0
  20. package/dist/enclosing.d.ts +12 -0
  21. package/dist/enclosing.d.ts.map +1 -0
  22. package/dist/enclosing.js +19 -0
  23. package/dist/enclosing.js.map +1 -0
  24. package/dist/index.d.ts +7 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +7 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/parse.d.ts +17 -0
  29. package/dist/parse.d.ts.map +1 -0
  30. package/dist/parse.js +21 -0
  31. package/dist/parse.js.map +1 -0
  32. package/dist/predicates.d.ts +26 -0
  33. package/dist/predicates.d.ts.map +1 -0
  34. package/dist/predicates.js +28 -0
  35. package/dist/predicates.js.map +1 -0
  36. package/dist/shared-tree.d.ts +10 -0
  37. package/dist/shared-tree.d.ts.map +1 -0
  38. package/dist/shared-tree.js +14 -0
  39. package/dist/shared-tree.js.map +1 -0
  40. package/dist/strip.d.ts +5 -0
  41. package/dist/strip.d.ts.map +1 -0
  42. package/dist/strip.js +120 -0
  43. package/dist/strip.js.map +1 -0
  44. package/package.json +50 -0
  45. package/wasm/tree-sitter-java.wasm +0 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ OpenSIP CLI
2
+ Copyright 2026 opensip-ai
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
+ this software except in compliance with the License. A copy of the License is
6
+ included in the LICENSE file and is also available at:
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ <!-- Generated by scripts/build-package-readmes.mjs — do not edit by hand.
2
+ Change the package's "description" (or the generator template) and run
3
+ `pnpm docs:readmes`. CI enforces sync via `pnpm docs:readmes:check`. -->
4
+
5
+ # @opensip-cli/lang-java
6
+
7
+ > Java language adapter for opensip-cli
8
+
9
+ This is an **internal library** of the opensip-cli toolkit. It is published so the CLI and tools can depend on it; most users will not install it directly.
10
+
11
+ Part of [**opensip-cli**](https://github.com/opensip-ai/opensip-cli) — an open-source codebase-analysis toolkit: fitness checks (`fit`), static call-graph analysis (`graph`), and simulation (`sim`).
12
+
13
+ ## Install
14
+
15
+ Most users install the CLI, which bundles the first-party tools:
16
+
17
+ ```bash
18
+ curl -fsSL https://opensip.ai/cli/install.sh | bash
19
+ ```
20
+
21
+ This package is published for the CLI and advanced plugin authors; most users should not install `@opensip-cli/lang-java` directly.
22
+
23
+ ## Documentation
24
+
25
+ - 📚 Project docs: https://opensip.ai/docs/opensip-cli/
26
+ - 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.0/docs/public/70-reference/02-package-catalog.md
27
+ - 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.0/packages/languages/lang-java
28
+
29
+ ## License
30
+
31
+ Apache-2.0 © opensip-ai
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/adapter.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,167 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { javaAdapter } from '../adapter.js';
3
+ import { stripComments, stripStrings } from '../strip.js';
4
+ describe('javaAdapter', () => {
5
+ it('declares the expected identity and extension', () => {
6
+ expect(javaAdapter.id).toBe('java');
7
+ expect(javaAdapter.fileExtensions).toContain('.java');
8
+ });
9
+ it('parse() returns a real tree-sitter tree + source', () => {
10
+ const src = 'class A {\n void m() {}\n}';
11
+ const tree = javaAdapter.parse(src, 'A.java');
12
+ expect(tree).not.toBeNull();
13
+ expect(tree?.source).toBe(src);
14
+ expect(tree?.tree.rootNode.type).toBe('program');
15
+ });
16
+ });
17
+ describe('java stripStrings', () => {
18
+ it('replaces regular string content but preserves length', () => {
19
+ const src = 'String s = "hello world";';
20
+ const out = stripStrings(src);
21
+ expect(out.length).toBe(src.length);
22
+ expect(out).not.toContain('hello');
23
+ expect(out).toContain('String s =');
24
+ expect(out).toContain('"');
25
+ });
26
+ it('strips text block body but preserves the triple quotes and newlines', () => {
27
+ const src = 'String s = """\nfoo bar\n""";';
28
+ const out = stripStrings(src);
29
+ expect(out.length).toBe(src.length);
30
+ expect(out).not.toContain('foo');
31
+ expect(out).not.toContain('bar');
32
+ // Triple quotes (delimiters) survive
33
+ expect(out).toContain('"""');
34
+ // Newlines are preserved
35
+ expect(out.split('\n').length).toBe(src.split('\n').length);
36
+ });
37
+ it('preserves char literals (single chars are code, not strings)', () => {
38
+ const src = "char c = 'x';";
39
+ const out = stripStrings(src);
40
+ expect(out).toBe(src);
41
+ });
42
+ it('preserves char literals with escapes', () => {
43
+ const src = String.raw `char c = '\n';`;
44
+ const out = stripStrings(src);
45
+ expect(out).toBe(src);
46
+ });
47
+ it('preserves newlines inside text blocks', () => {
48
+ const src = 'String x = """\nline1\nline2\n""";';
49
+ const out = stripStrings(src);
50
+ expect(out.length).toBe(src.length);
51
+ expect(out.split('\n').length).toBe(src.split('\n').length);
52
+ });
53
+ it('handles escapes inside regular strings', () => {
54
+ const src = String.raw `String s = "a\"b";`;
55
+ const out = stripStrings(src);
56
+ expect(out.length).toBe(src.length);
57
+ expect(out).not.toContain(String.raw `a\"b`);
58
+ });
59
+ // F1: text-block scanner must honor backslash escapes per JLS §3.10.6.
60
+ // A literal `\"""` inside a text block is a backslash, an escaped quote,
61
+ // then two literal quotes — NOT a closing delimiter.
62
+ it('does not prematurely close a text block on an escaped triple quote', () => {
63
+ const src = 'String s = """\n literal \\""" inside\n """;\nint after = 1;';
64
+ const out = stripStrings(src);
65
+ expect(out.length).toBe(src.length);
66
+ // Body content should be stripped
67
+ expect(out).not.toContain('literal');
68
+ expect(out).not.toContain('inside');
69
+ // The trailing code outside the text block must NOT be stripped
70
+ expect(out).toContain('int after = 1;');
71
+ });
72
+ // F1: graceful end-of-source recovery when a text block is unterminated.
73
+ it('recovers from an unterminated text block at end of source', () => {
74
+ const src = 'String s = """\n unterminated';
75
+ const out = stripStrings(src);
76
+ expect(out.length).toBe(src.length);
77
+ expect(out).not.toContain('unterminated');
78
+ // Outer prefix is preserved
79
+ expect(out).toContain('String s =');
80
+ expect(out).toContain('"""');
81
+ });
82
+ // N2: when `"""` is NOT followed by a line terminator, the text-block
83
+ // detection must fall through to the regular-string branch. Pin the
84
+ // happy path through that fall-through so a future change in
85
+ // scanRegularString's empty-string fast path does not silently break
86
+ // Java's not-a-text-block semantics.
87
+ it(String.raw `falls through to regular-string when """ has no following line terminator`, () => {
88
+ // `String s = """abc";` — the leading `""` is an empty regular
89
+ // string; the third `"` opens a new regular string with body `abc`,
90
+ // closing at the trailing `"`. Result: both string regions are
91
+ // stripped, and the surrounding code structure survives.
92
+ const src = 'String s = """abc";';
93
+ const out = stripStrings(src);
94
+ expect(out.length).toBe(src.length);
95
+ // The body content is stripped.
96
+ expect(out).not.toContain('abc');
97
+ // Outer code structure survives — no scanner spin.
98
+ expect(out).toContain('String s =');
99
+ expect(out).toContain(';');
100
+ });
101
+ // F2: stray apostrophe in malformed input must not swallow following code.
102
+ it('does not swallow code on a stray apostrophe (malformed input)', () => {
103
+ const src = "char c = 'a; int x = 1;";
104
+ const out = stripStrings(src);
105
+ expect(out.length).toBe(src.length);
106
+ // The trailing statement is real code and must survive intact
107
+ expect(out).toContain('int x = 1;');
108
+ });
109
+ // F2: a unicode-escape char literal (`'A'` = 8 chars including quotes)
110
+ // must still close inside the 8-char scan cap.
111
+ it('closes a unicode-escape char literal within the 8-char cap', () => {
112
+ const src = String.raw `char c = 'A'; int x = 1;`;
113
+ const out = stripStrings(src);
114
+ expect(out).toBe(src);
115
+ expect(out).toContain('int x = 1;');
116
+ });
117
+ // F6: '\'' is the canonical case where the escape branch must run before
118
+ // the closing-quote branch. If the order is wrong, this test fails.
119
+ it(String.raw `parses an escaped-apostrophe char literal '\''`, () => {
120
+ const src = String.raw `char c = '\''; int x = 1;`;
121
+ const out = stripStrings(src);
122
+ expect(out).toBe(src);
123
+ // Followup statement must not be eaten
124
+ expect(out).toContain('int x = 1;');
125
+ });
126
+ });
127
+ describe('java stripComments', () => {
128
+ it('replaces line comments', () => {
129
+ const src = 'int x = 1; // comment';
130
+ const out = stripComments(src);
131
+ expect(out.length).toBe(src.length);
132
+ expect(out).not.toContain('comment');
133
+ expect(out).toContain('int x = 1;');
134
+ });
135
+ it('replaces block comments', () => {
136
+ const src = 'int x = /* hi */ 2;';
137
+ const out = stripComments(src);
138
+ expect(out.length).toBe(src.length);
139
+ expect(out).not.toContain('hi');
140
+ expect(out).toContain('int x =');
141
+ expect(out).toContain('2;');
142
+ });
143
+ it('does not nest block comments (Java semantics)', () => {
144
+ // The first */ closes the block; the second one is plain code.
145
+ const src = 'int x = /* outer /* inner */ rest */ 1;';
146
+ const out = stripComments(src);
147
+ expect(out.length).toBe(src.length);
148
+ // The inner section is replaced
149
+ expect(out).not.toContain('outer');
150
+ expect(out).not.toContain('inner');
151
+ // ...but the trailing `rest */ 1;` is back in code-land
152
+ expect(out).toContain('rest');
153
+ });
154
+ it('strips strings as well as comments', () => {
155
+ const src = 'String s = "// not a comment";';
156
+ const out = stripComments(src);
157
+ expect(out.length).toBe(src.length);
158
+ // The `// not a comment` was a STRING, not a comment, but stripComments
159
+ // replaces both kinds of regions.
160
+ expect(out).not.toContain('not a comment');
161
+ // The outer structure (assignment, semicolon, quotes) is intact
162
+ expect(out).toContain('String s =');
163
+ expect(out).toContain('"');
164
+ expect(out).toContain(';');
165
+ });
166
+ });
167
+ //# sourceMappingURL=adapter.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.test.js","sourceRoot":"","sources":["../../src/__tests__/adapter.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,GAAG,GAAG,6BAA6B,CAAC;QAC1C,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAA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AAC;QAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=strip.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/strip.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { stripStrings, stripComments } from '../strip.js';
3
+ describe('stripStrings (Java)', () => {
4
+ it('strips double-quoted strings', () => {
5
+ const out = stripStrings('String s = "hello";');
6
+ expect(out).not.toContain('hello');
7
+ });
8
+ it('strips text blocks (triple-quoted multi-line strings)', () => {
9
+ const src = 'String s = """\nline1\nline2\n""";';
10
+ const out = stripStrings(src);
11
+ expect(out).not.toContain('line1');
12
+ expect(out).not.toContain('line2');
13
+ });
14
+ it('handles escape sequences', () => {
15
+ const out = stripStrings(String.raw `String s = "a\"b";`);
16
+ expect(out).not.toContain('a');
17
+ });
18
+ it('preserves char literals', () => {
19
+ expect(stripStrings("char c = 'a';")).toContain("'a'");
20
+ });
21
+ it('handles unterminated string', () => {
22
+ const out = stripStrings('String s = "unterminated');
23
+ expect(out).toContain('String s = ');
24
+ });
25
+ it('passes through code with no strings unchanged', () => {
26
+ const code = 'class Foo { int x = 1; }';
27
+ expect(stripStrings(code)).toBe(code);
28
+ });
29
+ it('handles unterminated text block', () => {
30
+ const out = stripStrings('String s = """\nunterminated');
31
+ expect(out).toContain('String s = ');
32
+ expect(out).not.toContain('unterminated');
33
+ });
34
+ it('handles char literal hitting a newline before closing quote', () => {
35
+ const out = stripStrings("char c = 'unterminated\nint x = 1;");
36
+ expect(out).toContain('int x = 1;');
37
+ });
38
+ });
39
+ describe('stripComments (Java)', () => {
40
+ it('strips line comments', () => {
41
+ const out = stripComments('int x = 1; // comment');
42
+ expect(out).not.toContain('comment');
43
+ });
44
+ it('strips block comments', () => {
45
+ const out = stripComments('int x = 1; /* hidden */ int y = 2;');
46
+ expect(out).not.toContain('hidden');
47
+ });
48
+ it('strips javadoc-style comments', () => {
49
+ const out = stripComments('/** doc */\nclass Foo {}');
50
+ expect(out).not.toContain('doc');
51
+ });
52
+ it('handles unterminated block comment', () => {
53
+ const out = stripComments('int x = 1; /* oops');
54
+ expect(out).toContain('int x = 1;');
55
+ });
56
+ });
57
+ //# sourceMappingURL=strip.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip.test.js","sourceRoot":"","sources":["../../src/__tests__/strip.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,GAAG,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,GAAG,GAAG,oCAAoC,CAAC;QACjD,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAA,oBAAoB,CA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AAM,GAAG,GAAG,aAAa,CAAC,uBAAuB,CAAC,CAAC;QACnD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,GAAG,GAAG,aAAa,CAAC,oCAAoC,CAAC,CAAC;QAChE,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,GAAG,GAAG,aAAa,CAAC,0BAA0B,CAAC,CAAC;QACtD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,GAAG,GAAG,aAAa,CAAC,oBAAoB,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=substrate.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"substrate.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/substrate.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ import { RunScope, runWithScopeSync } from '@opensip-cli/core';
2
+ import { initParseCache, clearParseCache } from '@opensip-cli/core/languages/parse-cache.js';
3
+ import { walkNodes } from '@opensip-cli/tree-sitter';
4
+ import { describe, expect, it } from 'vitest';
5
+ import { findEnclosingFunction, getEnclosingFunctionName } from '../enclosing.js';
6
+ import { parseJava } from '../parse.js';
7
+ import { isCatch, isClass, isComment, isConditional, isConstructor, isFunction, isLoop, isMethod, isString, } from '../predicates.js';
8
+ import { getSharedTree } from '../shared-tree.js';
9
+ const SRC = [
10
+ 'package app;',
11
+ '// c',
12
+ 'class S {',
13
+ ' S() {}',
14
+ ' void m() {',
15
+ ' String x = "h";',
16
+ ' if (true) { return; }',
17
+ ' for (int i = 0; i < 3; i++) {}',
18
+ ' try { } catch (RuntimeException e) { }',
19
+ ' }',
20
+ '}',
21
+ '',
22
+ ].join('\n');
23
+ function root() {
24
+ const tree = parseJava(SRC, 'S.java');
25
+ if (!tree)
26
+ throw new Error('no tree');
27
+ return tree.tree.rootNode;
28
+ }
29
+ function count(pred) {
30
+ let n = 0;
31
+ walkNodes(root(), (node) => {
32
+ if (pred(node))
33
+ n++;
34
+ });
35
+ return n;
36
+ }
37
+ describe('java substrate', () => {
38
+ it('predicates match the tree-sitter-java node types', () => {
39
+ expect(count(isFunction)).toBe(2);
40
+ expect(count(isMethod)).toBe(1);
41
+ expect(count(isConstructor)).toBe(1);
42
+ expect(count(isClass)).toBe(1);
43
+ expect(count(isComment)).toBe(1);
44
+ expect(count(isString)).toBe(1);
45
+ expect(count(isCatch)).toBe(1);
46
+ expect(count(isConditional)).toBe(1);
47
+ expect(count(isLoop)).toBe(1);
48
+ });
49
+ it('getSharedTree caches within an active parse cache', () => {
50
+ runWithScopeSync(new RunScope(), () => {
51
+ initParseCache();
52
+ try {
53
+ const a = getSharedTree('X.java', 'class X {}');
54
+ const b = getSharedTree('X.java', 'class X {}');
55
+ expect(a).toBe(b);
56
+ }
57
+ finally {
58
+ clearParseCache();
59
+ }
60
+ });
61
+ });
62
+ it('findEnclosingFunction resolves the nearest method/constructor', () => {
63
+ const strings = [];
64
+ walkNodes(root(), (n) => {
65
+ if (n.type === 'string_literal')
66
+ strings.push(n);
67
+ });
68
+ expect(getEnclosingFunctionName(strings[0])).toBe('m');
69
+ expect(findEnclosingFunction(strings[0])?.type).toBe('method_declaration');
70
+ });
71
+ });
72
+ //# sourceMappingURL=substrate.test.js.map
@@ -0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,EAAE,YAAY,CAAC,CAAC;gBAChD,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;oBAAS,CAAC;gBACT,eAAe,EAAE,CAAC;YACpB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,MAAM,OAAO,GAAW,EAAE,CAAC;QAC3B,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE;YACtB,IAAI,CAAC,CAAC,IAAI,KAAK,gBAAgB;gBAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type JavaTree } from './parse.js';
2
+ import type { LanguageAdapter } from '@opensip-cli/core';
3
+ export declare const javaAdapter: LanguageAdapter<JavaTree>;
4
+ /** Plugin contract — exported as the lang plugin's `adapters` array. */
5
+ export declare const adapters: readonly [LanguageAdapter<import("@opensip-cli/tree-sitter").ParsedFile, unknown>];
6
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,QAAQ,CAMjD,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,QAAQ,oFAAyB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { parseJava } from './parse.js';
2
+ import { stripComments, stripStrings } from './strip.js';
3
+ export const javaAdapter = {
4
+ id: 'java',
5
+ fileExtensions: ['.java'],
6
+ parse: parseJava,
7
+ stripStrings,
8
+ stripComments,
9
+ };
10
+ /** Plugin contract — exported as the lang plugin's `adapters` array. */
11
+ export const adapters = [javaAdapter];
12
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAIzD,MAAM,CAAC,MAAM,WAAW,GAA8B;IACpD,EAAE,EAAE,MAAM;IACV,cAAc,EAAE,CAAC,OAAO,CAAC;IACzB,KAAK,EAAE,SAAS;IAChB,YAAY;IACZ,aAAa;CACd,CAAC;AAEF,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,WAAW,CAAU,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Composed enclosing-scope helpers for Java (ADR-0010) — the per-language layer
3
+ * over the generic `findEnclosing`/`nameOf` from `@opensip-cli/tree-sitter`.
4
+ * `isMethod` is grammar-direct (Java's `method_declaration`) and lives in
5
+ * predicates.ts; this module composes the enclosing-function lookups.
6
+ */
7
+ import { type Node } from '@opensip-cli/tree-sitter';
8
+ /** The nearest enclosing method/constructor of `node`, or `null` at class scope. */
9
+ export declare function findEnclosingFunction(node: Node): Node | null;
10
+ /** The name of the nearest enclosing method/constructor, or `null`. */
11
+ export declare function getEnclosingFunctionName(node: Node): string | null;
12
+ //# sourceMappingURL=enclosing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enclosing.d.ts","sourceRoot":"","sources":["../src/enclosing.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,EAAyB,KAAK,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAI5E,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAE7D;AAED,uEAAuE;AACvE,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAGlE"}
@@ -0,0 +1,19 @@
1
+ // @fitness-ignore-file duplicate-utility-functions -- ADR-0010: the per-language tree-sitter vocabulary intentionally shares helper names across lang-* with grammar-specific implementations; consolidating would defeat the substrate design.
2
+ /**
3
+ * Composed enclosing-scope helpers for Java (ADR-0010) — the per-language layer
4
+ * over the generic `findEnclosing`/`nameOf` from `@opensip-cli/tree-sitter`.
5
+ * `isMethod` is grammar-direct (Java's `method_declaration`) and lives in
6
+ * predicates.ts; this module composes the enclosing-function lookups.
7
+ */
8
+ import { findEnclosing, nameOf } from '@opensip-cli/tree-sitter';
9
+ import { isFunction } from './predicates.js';
10
+ /** The nearest enclosing method/constructor of `node`, or `null` at class scope. */
11
+ export function findEnclosingFunction(node) {
12
+ return findEnclosing(node, isFunction);
13
+ }
14
+ /** The name of the nearest enclosing method/constructor, or `null`. */
15
+ export function getEnclosingFunctionName(node) {
16
+ const fn = findEnclosingFunction(node);
17
+ return fn ? nameOf(fn) : null;
18
+ }
19
+ //# sourceMappingURL=enclosing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enclosing.js","sourceRoot":"","sources":["../src/enclosing.ts"],"names":[],"mappings":"AAAA,gPAAgP;AAChP;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAa,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,oFAAoF;AACpF,MAAM,UAAU,qBAAqB,CAAC,IAAU;IAC9C,OAAO,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AACzC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,wBAAwB,CAAC,IAAU;IACjD,MAAM,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { javaAdapter, adapters } from './adapter.js';
2
+ export { parseJava, type JavaTree } from './parse.js';
3
+ export { getSharedTree } from './shared-tree.js';
4
+ export { stripStrings, stripComments } from './strip.js';
5
+ export { isFunction, isMethod, isConstructor, isClass, isComment, isString, isCatch, isConditional, isLoop, } from './predicates.js';
6
+ export { findEnclosingFunction, getEnclosingFunctionName } from './enclosing.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EACL,UAAU,EACV,QAAQ,EACR,aAAa,EACb,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,EACP,aAAa,EACb,MAAM,GACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { javaAdapter, adapters } from './adapter.js';
2
+ export { parseJava } from './parse.js';
3
+ export { getSharedTree } from './shared-tree.js';
4
+ export { stripStrings, stripComments } from './strip.js';
5
+ export { isFunction, isMethod, isConstructor, isClass, isComment, isString, isCatch, isConditional, isLoop, } from './predicates.js';
6
+ export { findEnclosingFunction, getEnclosingFunctionName } from './enclosing.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,EAAiB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EACL,UAAU,EACV,QAAQ,EACR,aAAa,EACb,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,EACP,aAAa,EACb,MAAM,GACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @fileoverview Java parse — web-tree-sitter + vendored tree-sitter-java.wasm.
3
+ *
4
+ * ADR-0010: `lang-java` is the canonical Java parse substrate — fitness checks
5
+ * parse via the adapter (`getSharedTree`) and the graph Java adapter consumes
6
+ * this too. The grammar loads once at module top level (the WASM runtime is
7
+ * initialized by `@opensip-cli/tree-sitter`'s top-level `Parser.init()`); a
8
+ * single reused parser keeps `parse()` synchronous. Tree-sitter recovers from
9
+ * syntax errors with MISSING nodes, so a malformed file yields a partial tree
10
+ * (non-null) rather than throwing.
11
+ */
12
+ import { type ParsedFile } from '@opensip-cli/tree-sitter';
13
+ /** Parsed Java source: tree-sitter parse tree plus the original source text. */
14
+ export type JavaTree = ParsedFile;
15
+ /** Parses Java source into a {@link JavaTree}, or null when no tree is produced. */
16
+ export declare function parseJava(content: string, _filePath: string): JavaTree | null;
17
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAA0C,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOnG,gFAAgF;AAChF,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC;AAElC,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAG7E"}
package/dist/parse.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @fileoverview Java parse — web-tree-sitter + vendored tree-sitter-java.wasm.
3
+ *
4
+ * ADR-0010: `lang-java` is the canonical Java parse substrate — fitness checks
5
+ * parse via the adapter (`getSharedTree`) and the graph Java adapter consumes
6
+ * this too. The grammar loads once at module top level (the WASM runtime is
7
+ * initialized by `@opensip-cli/tree-sitter`'s top-level `Parser.init()`); a
8
+ * single reused parser keeps `parse()` synchronous. Tree-sitter recovers from
9
+ * syntax errors with MISSING nodes, so a malformed file yields a partial tree
10
+ * (non-null) rather than throwing.
11
+ */
12
+ import { fileURLToPath } from 'node:url';
13
+ import { loadGrammar, createParser, parseToTree } from '@opensip-cli/tree-sitter';
14
+ const grammar = await loadGrammar(fileURLToPath(new URL('../wasm/tree-sitter-java.wasm', import.meta.url)));
15
+ const parser = createParser(grammar);
16
+ /** Parses Java source into a {@link JavaTree}, or null when no tree is produced. */
17
+ export function parseJava(content, _filePath) {
18
+ const tree = parseToTree(parser, content);
19
+ return tree ? { tree, source: content } : null;
20
+ }
21
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,0BAA0B,CAAC;AAEnG,MAAM,OAAO,GAAG,MAAM,WAAW,CAC/B,aAAa,CAAC,IAAI,GAAG,CAAC,+BAA+B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CACzE,CAAC;AACF,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;AAKrC,oFAAoF;AACpF,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,SAAiB;IAC1D,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * v1 per-language node-kind predicates for Java (ADR-0010). The generic
3
+ * traversal/position helpers live in `@opensip-cli/tree-sitter`; only the
4
+ * grammar-specific node `type` strings differ. Node types are from the
5
+ * tree-sitter-java grammar.
6
+ */
7
+ import type { Node } from '@opensip-cli/tree-sitter';
8
+ /** A method or constructor declaration (both are callable defs). */
9
+ export declare const isFunction: (node: Node) => boolean;
10
+ /** A method declaration. */
11
+ export declare const isMethod: (node: Node) => boolean;
12
+ /** A constructor declaration. */
13
+ export declare const isConstructor: (node: Node) => boolean;
14
+ /** A class declaration. */
15
+ export declare const isClass: (node: Node) => boolean;
16
+ /** A line or block comment. */
17
+ export declare const isComment: (node: Node) => boolean;
18
+ /** A string literal. */
19
+ export declare const isString: (node: Node) => boolean;
20
+ /** A `catch` clause — Java's error-handling node. */
21
+ export declare const isCatch: (node: Node) => boolean;
22
+ /** An `if` statement. */
23
+ export declare const isConditional: (node: Node) => boolean;
24
+ /** A `for`, `while`, or enhanced-`for` (for-each) loop. */
25
+ export declare const isLoop: (node: Node) => boolean;
26
+ //# sourceMappingURL=predicates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../src/predicates.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD,oEAAoE;AACpE,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,KAAG,OACuC,CAAC;AAEhF,4BAA4B;AAC5B,eAAO,MAAM,QAAQ,GAAI,MAAM,IAAI,KAAG,OAA6C,CAAC;AAEpF,iCAAiC;AACjC,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,OAAkD,CAAC;AAE9F,2BAA2B;AAC3B,eAAO,MAAM,OAAO,GAAI,MAAM,IAAI,KAAG,OAA4C,CAAC;AAElF,+BAA+B;AAC/B,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,OACwB,CAAC;AAEhE,wBAAwB;AACxB,eAAO,MAAM,QAAQ,GAAI,MAAM,IAAI,KAAG,OAAyC,CAAC;AAEhF,qDAAqD;AACrD,eAAO,MAAM,OAAO,GAAI,MAAM,IAAI,KAAG,OAAuC,CAAC;AAE7E,yBAAyB;AACzB,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,OAAuC,CAAC;AAEnF,2DAA2D;AAC3D,eAAO,MAAM,MAAM,GAAI,MAAM,IAAI,KAAG,OAGI,CAAC"}
@@ -0,0 +1,28 @@
1
+ // @fitness-ignore-file duplicate-utility-functions -- ADR-0010: the per-language tree-sitter vocabulary intentionally shares helper names across lang-* with grammar-specific implementations; consolidating would defeat the substrate design.
2
+ /**
3
+ * v1 per-language node-kind predicates for Java (ADR-0010). The generic
4
+ * traversal/position helpers live in `@opensip-cli/tree-sitter`; only the
5
+ * grammar-specific node `type` strings differ. Node types are from the
6
+ * tree-sitter-java grammar.
7
+ */
8
+ /** A method or constructor declaration (both are callable defs). */
9
+ export const isFunction = (node) => node.type === 'method_declaration' || node.type === 'constructor_declaration';
10
+ /** A method declaration. */
11
+ export const isMethod = (node) => node.type === 'method_declaration';
12
+ /** A constructor declaration. */
13
+ export const isConstructor = (node) => node.type === 'constructor_declaration';
14
+ /** A class declaration. */
15
+ export const isClass = (node) => node.type === 'class_declaration';
16
+ /** A line or block comment. */
17
+ export const isComment = (node) => node.type === 'line_comment' || node.type === 'block_comment';
18
+ /** A string literal. */
19
+ export const isString = (node) => node.type === 'string_literal';
20
+ /** A `catch` clause — Java's error-handling node. */
21
+ export const isCatch = (node) => node.type === 'catch_clause';
22
+ /** An `if` statement. */
23
+ export const isConditional = (node) => node.type === 'if_statement';
24
+ /** A `for`, `while`, or enhanced-`for` (for-each) loop. */
25
+ export const isLoop = (node) => node.type === 'for_statement' ||
26
+ node.type === 'while_statement' ||
27
+ node.type === 'enhanced_for_statement';
28
+ //# sourceMappingURL=predicates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicates.js","sourceRoot":"","sources":["../src/predicates.ts"],"names":[],"mappings":"AAAA,gPAAgP;AAChP;;;;;GAKG;AAIH,oEAAoE;AACpE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAU,EAAW,EAAE,CAChD,IAAI,CAAC,IAAI,KAAK,oBAAoB,IAAI,IAAI,CAAC,IAAI,KAAK,yBAAyB,CAAC;AAEhF,4BAA4B;AAC5B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,oBAAoB,CAAC;AAEpF,iCAAiC;AACjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,yBAAyB,CAAC;AAE9F,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAmB,CAAC;AAElF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAU,EAAW,EAAE,CAC/C,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC;AAEhE,wBAAwB;AACxB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC;AAEhF,qDAAqD;AACrD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC;AAE7E,yBAAyB;AACzB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC;AAEnF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAU,EAAW,EAAE,CAC5C,IAAI,CAAC,IAAI,KAAK,eAAe;IAC7B,IAAI,CAAC,IAAI,KAAK,iBAAiB;IAC/B,IAAI,CAAC,IAAI,KAAK,wBAAwB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Cached Java parse entry point — the analog of `lang-typescript`'s
3
+ * `getSharedSourceFile`. Routes through `core`'s active `LanguageParseCache`
4
+ * so a file parsed by a fitness check and by the graph adapter in the same run
5
+ * is parsed once; falls back to a direct parse when no cache is active.
6
+ */
7
+ import type { JavaTree } from './parse.js';
8
+ /** Returns the shared (cached) Java parse tree for `filePath`, or null when unparseable. */
9
+ export declare function getSharedTree(filePath: string, content: string): JavaTree | null;
10
+ //# sourceMappingURL=shared-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-tree.d.ts","sourceRoot":"","sources":["../src/shared-tree.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAEhF"}
@@ -0,0 +1,14 @@
1
+ // @fitness-ignore-file duplicate-utility-functions -- ADR-0010: the per-language tree-sitter vocabulary intentionally shares helper names across lang-* with grammar-specific implementations; consolidating would defeat the substrate design.
2
+ /**
3
+ * Cached Java parse entry point — the analog of `lang-typescript`'s
4
+ * `getSharedSourceFile`. Routes through `core`'s active `LanguageParseCache`
5
+ * so a file parsed by a fitness check and by the graph adapter in the same run
6
+ * is parsed once; falls back to a direct parse when no cache is active.
7
+ */
8
+ import { getParseTree } from '@opensip-cli/core/languages/parse-cache.js';
9
+ import { javaAdapter } from './adapter.js';
10
+ /** Returns the shared (cached) Java parse tree for `filePath`, or null when unparseable. */
11
+ export function getSharedTree(filePath, content) {
12
+ return getParseTree(javaAdapter, filePath, content);
13
+ }
14
+ //# sourceMappingURL=shared-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-tree.js","sourceRoot":"","sources":["../src/shared-tree.ts"],"names":[],"mappings":"AAAA,gPAAgP;AAChP;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,4FAA4F;AAC5F,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,OAAe;IAC7D,OAAO,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Replace string literal content with whitespace; preserves length. */
2
+ export declare const stripStrings: (content: string) => string;
3
+ /** Replace string literals AND comments with whitespace; preserves length. */
4
+ export declare const stripComments: (content: string) => string;
5
+ //# sourceMappingURL=strip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip.d.ts","sourceRoot":"","sources":["../src/strip.ts"],"names":[],"mappings":"AAqIA,wEAAwE;AACxE,eAAO,MAAM,YAAY,6BAAwB,CAAC;AAClD,8EAA8E;AAC9E,eAAO,MAAM,aAAa,6BAAyB,CAAC"}
package/dist/strip.js ADDED
@@ -0,0 +1,120 @@
1
+ // Java string and comment stripping.
2
+ //
3
+ // Hand-written lexer that recognizes:
4
+ // - Line comments (//) and block comments (slash-star ... star-slash, non-nesting)
5
+ // - Regular strings ("...") with escape handling
6
+ // - Text blocks (""" ... """) — Java 13+ multi-line strings, opened by
7
+ // `"""` followed by a line terminator and closed by `"""`
8
+ // - Char literals ('a', '\n') — preserved as-is (single character is code,
9
+ // not a string)
10
+ //
11
+ // Both strip functions preserve byte length: replacement is whitespace
12
+ // (newlines preserved) so line/column positions remain stable.
13
+ import { makeStripper, scanBlockCommentNonNesting, scanCharLiteral, scanLineComment, scanRegularString, } from '@opensip-cli/core';
14
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- token-state-machine: cyclomatic complexity is inherent to lexer-style scanners; splitting hurts readability
15
+ function scan(src) {
16
+ const stringRegions = [];
17
+ const commentRegions = [];
18
+ const len = src.length;
19
+ let i = 0;
20
+ // INVARIANT: every iteration of the outer loop MUST advance `i`. Each
21
+ // branch either (a) sets `i = result.end` / `i = result.next` from a
22
+ // helper that always reports a strictly-increasing position, or
23
+ // (b) falls through to the `i++` at the bottom. A future branch that
24
+ // forgets to advance — or misuses `result.end` (note: scanCharLiteral
25
+ // returns `start + 1` on overflow, which IS still an advance) — would
26
+ // spin. Keep this invariant in mind when adding new token branches.
27
+ while (i < len) {
28
+ const c = src[i];
29
+ const next = src[i + 1];
30
+ // Line comment: // ... \n
31
+ if (c === '/' && next === '/') {
32
+ const start = i;
33
+ const lc = scanLineComment(src, i);
34
+ i = lc.end;
35
+ commentRegions.push({ start, end: i });
36
+ continue;
37
+ }
38
+ // Block comment: /* ... */ (Java block comments do NOT nest)
39
+ if (c === '/' && next === '*') {
40
+ const start = i;
41
+ const bc = scanBlockCommentNonNesting(src, i);
42
+ i = bc.end;
43
+ commentRegions.push({ start, end: i });
44
+ continue;
45
+ }
46
+ // Text block: """ followed by line terminator, ... """
47
+ // Per JLS, the opening delimiter is `"""` followed by optional
48
+ // whitespace and then a line terminator. The body starts after that
49
+ // terminator and ends at the next `"""`.
50
+ if (c === '"' && src[i + 1] === '"' && src[i + 2] === '"') {
51
+ // Look past optional whitespace for a newline to confirm text block
52
+ let j = i + 3;
53
+ while (j < len && (src[j] === ' ' || src[j] === '\t'))
54
+ j++;
55
+ if (j < len && (src[j] === '\n' || src[j] === '\r')) {
56
+ // It's a text block. Body starts after the line terminator.
57
+ // Skip the line terminator (handle \r\n).
58
+ j += src[j] === '\r' && src[j + 1] === '\n' ? 2 : 1;
59
+ const contentStart = j;
60
+ // Scan to closing """ — track backslash escapes so a literal `\"""`
61
+ // inside the body does not prematurely close the text block (JLS §3.10.6
62
+ // honors the same escape sequences as regular string literals).
63
+ let bodyEscape = false;
64
+ let closed = false;
65
+ while (j < len) {
66
+ if (bodyEscape) {
67
+ bodyEscape = false;
68
+ j++;
69
+ continue;
70
+ }
71
+ if (src[j] === '\\') {
72
+ bodyEscape = true;
73
+ j++;
74
+ continue;
75
+ }
76
+ if (src[j] === '"' && src[j + 1] === '"' && src[j + 2] === '"') {
77
+ const contentEnd = j;
78
+ stringRegions.push({ start: contentStart, end: contentEnd });
79
+ i = j + 3;
80
+ closed = true;
81
+ break;
82
+ }
83
+ j++;
84
+ }
85
+ if (!closed) {
86
+ // Unterminated text block — record what we have
87
+ stringRegions.push({ start: contentStart, end: len });
88
+ i = len;
89
+ }
90
+ continue;
91
+ }
92
+ // Not a text block (e.g. `""` empty string followed by another `"`).
93
+ // Fall through to regular string handling.
94
+ }
95
+ // Regular string: "..."
96
+ if (c === '"') {
97
+ const result = scanRegularString(src, i);
98
+ stringRegions.push({ start: i + 1, end: result.contentEnd });
99
+ i = result.next;
100
+ continue;
101
+ }
102
+ // Char literal: '...' — preserve as code (single character, not a string).
103
+ // Use the shared scanCharLiteral helper from core (default 8-char cap
104
+ // matches the lang-cpp / lang-rust heuristic; branch order is
105
+ // load-bearing — see core's scanCharLiteral docstring and lang-java F6).
106
+ if (c === "'") {
107
+ const result = scanCharLiteral(src, i);
108
+ i = result.end;
109
+ continue;
110
+ }
111
+ i++;
112
+ }
113
+ return { stringRegions, commentRegions };
114
+ }
115
+ const stripper = makeStripper(scan);
116
+ /** Replace string literal content with whitespace; preserves length. */
117
+ export const stripStrings = stripper.stripStrings;
118
+ /** Replace string literals AND comments with whitespace; preserves length. */
119
+ export const stripComments = stripper.stripComments;
120
+ //# sourceMappingURL=strip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip.js","sourceRoot":"","sources":["../src/strip.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,EAAE;AACF,sCAAsC;AACtC,mFAAmF;AACnF,iDAAiD;AACjD,uEAAuE;AACvE,4DAA4D;AAC5D,2EAA2E;AAC3E,kBAAkB;AAClB,EAAE;AACF,uEAAuE;AACvE,+DAA+D;AAE/D,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,iBAAiB,GAGlB,MAAM,mBAAmB,CAAC;AAE3B,uKAAuK;AACvK,SAAS,IAAI,CAAC,GAAW;IACvB,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,MAAM,cAAc,GAAa,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IACvB,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,sEAAsE;IACtE,qEAAqE;IACrE,gEAAgE;IAChE,qEAAqE;IACrE,sEAAsE;IACtE,sEAAsE;IACtE,oEAAoE;IACpE,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAExB,0BAA0B;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,CAAC,CAAC;YAChB,MAAM,EAAE,GAAG,eAAe,CAAC,GAAG,EA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CAAC;YACd,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACzC,aAAa,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;YAC7D,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;YAChB,SAAS;QACX,CAAC;QAED,2EAA2E;QAC3E,sEAAsE;QACtE,8DAA8D;QAC9D,yEAAyE;QACzE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACd,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACvC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;YACf,SAAS;QACX,CAAC;QAED,CAAC,EAAE,CAAC;IACN,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;AACpC,wEAAwE;AACxE,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;AAClD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@opensip-cli/lang-java",
3
+ "version": "0.1.0",
4
+ "license": "Apache-2.0",
5
+ "description": "Java language adapter for opensip-cli",
6
+ "keywords": [
7
+ "opensip-cli",
8
+ "static-analysis",
9
+ "code-quality",
10
+ "parser",
11
+ "ast",
12
+ "tree-sitter",
13
+ "java"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/opensip-ai/opensip-cli.git",
18
+ "directory": "packages/languages/lang-java"
19
+ },
20
+ "homepage": "https://github.com/opensip-ai/opensip-cli",
21
+ "bugs": {
22
+ "url": "https://github.com/opensip-ai/opensip-cli/issues"
23
+ },
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": "./dist/index.js"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "wasm",
33
+ "LICENSE",
34
+ "NOTICE"
35
+ ],
36
+ "dependencies": {
37
+ "@opensip-cli/core": "0.1.0",
38
+ "@opensip-cli/tree-sitter": "0.1.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^24.13.2",
42
+ "vitest": "^4.1.8"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc",
46
+ "test": "vitest run --passWithNoTests",
47
+ "typecheck": "tsc --noEmit",
48
+ "clean": "rm -rf dist"
49
+ }
50
+ }
Binary file