Skip to content

Commit ce1b9bc

Browse files
wenytang-mscopilotCopilot
authored
fix(test-plans): use self-contained Maven fixture for resolve-unknown-type plan (#1617)
The plan previously pointed at redhat-developer/vscode-java's salut Maven fixture, which configures maven-compiler-plugin with <source>1.7</source>/<target>1.7</target>. On the CI runners (which install only JDK 21) this puts the workspace in a state where JDT reports compliance warnings on the pom but skips full semantic analysis on the Java source -- the inserted `Gson gson;` field never produces a `Gson cannot be resolved to a type` diagnostic, so navigateToError can never find the error and applyCodeAction `Resolve unknown type` is unreachable. Older versions of @vscjava/vscode-autotest masked this failure mode by silently pressing Enter on whatever the first Code Action happened to be; once that fallback was removed upstream the plan started reliably failing in scheduled runs (e.g. actions/runs/25419116469). Add a minimal self-owned Maven fixture under test-fixtures/maven-resolve-type that explicitly targets JDK 11 (<release>11</release>), matching the JDK installed by the workflow. Locally this brings navigateToError from a 30s timeout to ~8s and the full plan to 6/6 passing. Co-authored-by: copilot <copilot@local> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 57f31b4 commit ce1b9bc

4 files changed

Lines changed: 56 additions & 11 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Maven Resolve Unknown Type — Test Fixture
2+
3+
This fixture is consumed by `test-plans/java-maven-resolve-type.yaml`.
4+
5+
It is a minimal self-contained Maven project intentionally configured with
6+
JDK 11 compliance (`<release>11</release>`), so JDT runs full semantic
7+
analysis under the JDK 21 toolchain that the E2E workflow installs. This
8+
avoids the historical problem of using fixtures with `<source>1.7</source>`,
9+
which causes JDT to emit only syntactic warnings (e.g. "compiler
10+
compliance 1.7 but JRE 11 is used") and silently skip semantic
11+
diagnostics — making the `Gson cannot be resolved to a type` error never
12+
surface and breaking the `Resolve unknown type` Code Action assertion.
13+
14+
The plan inserts `Gson gson;` into `App.java`, expects JDT to publish the
15+
unresolved-type diagnostic, and then exercises `vscode-maven`'s
16+
`Resolve unknown type` Code Action.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.example</groupId>
5+
<artifactId>maven-resolve-type</artifactId>
6+
<version>1.0.0-SNAPSHOT</version>
7+
<build>
8+
<plugins>
9+
<plugin>
10+
<artifactId>maven-compiler-plugin</artifactId>
11+
<version>3.8.0</version>
12+
<configuration>
13+
<release>11</release>
14+
</configuration>
15+
</plugin>
16+
</plugins>
17+
</build>
18+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.example;
2+
3+
public class App {
4+
public static void main(String[] args) {
5+
}
6+
}

test-plans/java-maven-resolve-type.yaml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
# Verify: Type unknown type → hover shows "Resolve unknown type" → add dependency and import
55
#
66
# Prerequisites:
7-
# - vscode-java repo cloned locally
8-
# - JDK installed and available
9-
# - Maven installed
7+
# - JDK 11+ installed and available on PATH (the workflow installs JDK 21)
8+
# - Maven installed (or the redhat.java embedded one)
109
#
1110
# Usage: autotest run test-plans/java-maven-resolve-type.yaml
11+
#
12+
# Fixture: test-fixtures/maven-resolve-type — self-contained, owned by this
13+
# repo. Uses JDK 11 compliance to ensure JDT runs full semantic analysis
14+
# and publishes the unresolved-type diagnostic (see fixture README).
1215

1316
name: "Maven for Java — Resolve Unknown Type"
1417
description: |
@@ -21,7 +24,7 @@ setup:
2124
extensions:
2225
- "vscjava.vscode-java-pack"
2326
vscodeVersion: "stable"
24-
workspace: "../../vscode-java/test/resources/projects/maven/salut"
27+
workspace: "../test-fixtures/maven-resolve-type"
2528
timeout: 90
2629

2730
steps:
@@ -32,20 +35,22 @@ steps:
3235
timeout: 120
3336

3437
# ── Open Java file ──────────────────────────────────────
35-
- id: "open-foo"
36-
action: "open file Foo.java"
37-
verify: "Foo.java file is open in the editor"
38+
- id: "open-app"
39+
action: "open file App.java"
40+
verify: "App.java file is open in the editor"
3841
timeout: 15
3942

4043
# ── Type unknown type ─────────────────────────────────────────
41-
# wiki: "type 'Gson gson;'" — use insertLineInFile so LS detects the change
44+
# wiki: "type 'Gson gson;'" — use insertLineInFile so LS detects the change.
45+
# Line 4 places the field directly inside the class body of App.java.
4246
- id: "insert-unknown-type"
43-
action: "insertLineInFile src/main/java/java/Foo.java 10 Gson gson;"
47+
action: "insertLineInFile src/main/java/com/example/App.java 4 Gson gson;"
4448
waitBefore: 3
4549

4650
# ── Verify Code Action: Resolve unknown type ────────────
47-
# wiki: hover shows "Resolve unknown type" → apply Code Action
48-
# Wait for LS to detect the Gson error before navigating
51+
# wiki: hover shows "Resolve unknown type" → apply Code Action.
52+
# navigateToError polls for diagnostics up to 30s and fails clearly if
53+
# the LS hasn't published the unresolved-type error yet.
4954
- id: "navigate-to-error"
5055
action: "navigateToError 1"
5156
waitBefore: 5

0 commit comments

Comments
 (0)