Fixed for Bug4986#4993
Conversation
|
@srikanth-sankaran @noopur2507 |
I'll take a look, Thanks for PR @RagiGeorge |
|
@iloveeclipse |
iloveeclipse
left a comment
There was a problem hiding this comment.
Just some code styling issues, I haven't checked if the code actually does something meaningful
There was a problem hiding this comment.
Pull request overview
This PR targets Eclipse JDT compiler diagnostics by correcting a malformed error message emitted when a statically imported field is inaccessible (issue #4986), and adds a regression test to lock in the expected wording.
Changes:
- Adjust
ProblemReporter#importProblemto special-case certain static-import field visibility errors and build cleaner message arguments. - Add a new regression test covering the inaccessible static-import field message formatting.
- Introduce a helper (
isSelfImport) to detect when the imported field originates from the same compilation unit.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java |
Adds regression test asserting the corrected error message for an inaccessible statically imported field. |
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java |
Tweaks argument construction for field-import problems and adds isSelfImport(FieldBinding) helper to scope the fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a7675a8 to
8a60791
Compare
|
Hi @iloveeclipse Please review. Thanks |
Fix #4986
What it does
Fixes a malformed error message shown for inaccessible fields used via static imports and adds a regression test.
How to test
Reproduce with a private static field referenced via import static; verify the error text matches the expected output.
##Before fix

after fix