mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-21 00:21:30 +00:00
fix: address adversarial review findings 1-6 — flaky test, wildcard import fixture, varargs fixed-prefix test, qualified generic stripping, JSDoc updates
Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/172c8a1a-cdf3-4de8-9142-f2c12c14b0a6 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
parent
2db403f5b1
commit
e69f4ef984
9 changed files with 86 additions and 3 deletions
|
|
@ -76,7 +76,7 @@ export function interpretJavaTypeBinding(captures: CaptureMatch): ParsedTypeBind
|
|||
const typeCap = captures['@type-binding.type'];
|
||||
if (nameCap === undefined || typeCap === undefined) return null;
|
||||
|
||||
const rawType = stripQualifier(stripGeneric(typeCap.text.trim()));
|
||||
const rawType = stripGeneric(stripQualifier(typeCap.text.trim()));
|
||||
|
||||
// Skip `var` — tree-sitter-java parses `var` as type_identifier with
|
||||
// text "var". When used without a constructor initializer, there's no
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
* and report parity as a dashboard input.
|
||||
*
|
||||
* **Parity baseline (29 failures):** The 29 gaps in forced registry mode
|
||||
* are tracked in the PR description and this JSDoc. If the gap count
|
||||
* are tracked in this PR (#1482) and this JSDoc. If the gap count
|
||||
* changes (up or down), update this baseline accordingly.
|
||||
*
|
||||
* ### Known flip-blockers (must fix before adding to MIGRATED_LANGUAGES)
|
||||
|
|
@ -38,6 +38,12 @@
|
|||
* Edge cases with nested classes may remain.
|
||||
* - Generic superclass receiver binding: `BaseModel<T>` now strips
|
||||
* to `BaseModel` via JVM type-erasure fallback in `stripGeneric`.
|
||||
* - Wildcard import (`import com.example.*`) file selection is
|
||||
* nondeterministic when multiple classes share a package directory.
|
||||
* May produce wrong-file edges in forced mode.
|
||||
* - Qualified generic type parameters in field/parameter annotations
|
||||
* (`com.example.BaseModel<T>`) — rare in practice but may miss
|
||||
* resolution when the full qualifier is present with generics.
|
||||
*/
|
||||
|
||||
import type { ParsedFile } from 'gitnexus-shared';
|
||||
|
|
|
|||
|
|
@ -1,10 +1,18 @@
|
|||
package com.example.app;
|
||||
|
||||
import com.example.util.Logger;
|
||||
import com.example.util.Formatter;
|
||||
|
||||
public class Main {
|
||||
public void run() {
|
||||
Logger logger = new Logger();
|
||||
logger.record("hello", "world", "test");
|
||||
|
||||
Formatter fmt = new Formatter();
|
||||
// 2-arg call: satisfies fixed prefix (level) + 1 vararg
|
||||
fmt.format(1, "hello");
|
||||
// 3-arg call: satisfies fixed prefix (level) + 2 varargs
|
||||
fmt.format(2, "hello", "world");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package com.example.util;
|
||||
|
||||
public class Formatter {
|
||||
/** Varargs with a required fixed prefix — 0-arg calls should be rejected. */
|
||||
public void format(int level, String... args) {
|
||||
for (String a : args) System.out.println(level + ": " + a);
|
||||
}
|
||||
}
|
||||
10
gitnexus/test/fixtures/lang-resolution/java-wildcard-import/com/example/app/Main.java
vendored
Normal file
10
gitnexus/test/fixtures/lang-resolution/java-wildcard-import/com/example/app/Main.java
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package com.example.app;
|
||||
|
||||
import com.example.models.*;
|
||||
|
||||
public class Main {
|
||||
public void run() {
|
||||
User user = new User();
|
||||
user.save();
|
||||
}
|
||||
}
|
||||
7
gitnexus/test/fixtures/lang-resolution/java-wildcard-import/com/example/models/Order.java
vendored
Normal file
7
gitnexus/test/fixtures/lang-resolution/java-wildcard-import/com/example/models/Order.java
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package com.example.models;
|
||||
|
||||
public class Order {
|
||||
public void submit() {
|
||||
System.out.println("submitting order");
|
||||
}
|
||||
}
|
||||
7
gitnexus/test/fixtures/lang-resolution/java-wildcard-import/com/example/models/User.java
vendored
Normal file
7
gitnexus/test/fixtures/lang-resolution/java-wildcard-import/com/example/models/User.java
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package com.example.models;
|
||||
|
||||
public class User {
|
||||
public void save() {
|
||||
System.out.println("saving user");
|
||||
}
|
||||
}
|
||||
|
|
@ -441,6 +441,43 @@ describe('Java variadic call resolution', () => {
|
|||
}
|
||||
expect(allDangling).toEqual([]);
|
||||
});
|
||||
|
||||
it('resolves 2-arg call to fixed-prefix varargs method format(int, String...) in Formatter.java', () => {
|
||||
const calls = getRelationships(result, 'CALLS');
|
||||
const fmtCall = calls.find((c) => c.target === 'format');
|
||||
expect(fmtCall).toBeDefined();
|
||||
expect(fmtCall!.source).toBe('run');
|
||||
expect(fmtCall!.targetFilePath).toBe('com/example/util/Formatter.java');
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Wildcard import: `import com.example.models.*` resolves to a package file
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe('Java wildcard import resolution', () => {
|
||||
let result: PipelineResult;
|
||||
|
||||
beforeAll(async () => {
|
||||
result = await runPipelineFromRepo(path.join(FIXTURES, 'java-wildcard-import'), () => {});
|
||||
}, 60000);
|
||||
|
||||
it('parses wildcard import without errors and creates graph nodes', () => {
|
||||
// The wildcard import (`import com.example.models.*`) exercises the
|
||||
// directoryChild branch in resolveJavaImportTarget. Even if no IMPORTS
|
||||
// edge is created (nondeterministic file selection — documented flip
|
||||
// blocker), the graph must contain valid nodes for all classes.
|
||||
const classes = getNodesByLabel(result, 'Class');
|
||||
expect(classes).toContain('Main');
|
||||
expect(classes).toContain('User');
|
||||
expect(classes).toContain('Order');
|
||||
});
|
||||
|
||||
it('resolves user.save() call via wildcard-imported User', () => {
|
||||
const calls = getRelationships(result, 'CALLS');
|
||||
const saveCall = calls.find((c) => c.target === 'save' && c.source === 'run');
|
||||
expect(saveCall).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ describe('worker pool integration', () => {
|
|||
|
||||
try {
|
||||
await expect(pool.dispatch<any, any>([{ path: 'crash.ts', content: '' }])).rejects.toThrow(
|
||||
/simulated startup crash|exited with code/,
|
||||
/simulated startup crash|exited with code|idle timeout/,
|
||||
);
|
||||
const warnRecords = cap.records().filter((r) => Number(r.level) >= 40 /* warn or above */);
|
||||
expect(warnRecords.length).toBeGreaterThan(0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue