Repository navigation
chore: suppress discouraged access to Xtext friend packages - #1615
Merged
Merged
Conversation
These classes use Xtext packages exported only to named friend bundles, such as org.eclipse.xtext.xbase.compiler and its output package, which Eclipse reports as 201 discouraged access warnings. The use is deliberate: both generators subclass JvmModelGenerator, the inferrers pass ITreeAppendable to JvmTypesBuilder, the Format inferrer uses RuleNames, and the test classes use IResourceLoader and ReferenceSearchResult directly. Suppress "restriction" on these 16 classes. New classes using these packages still get the warning, except in xtext.format, whose existing access rules already cover xbase and common.types.util. unusedWarningToken reports a suppression once it is no longer needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joaodinissf
force-pushed
the
chore/suppress-xtext-friend-access
branch
from
November 6, 2026 00:53
4a86083 to
c68b210
Compare
rubenporras
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suppresses the 201
Discouraged accesswarnings Eclipse reports on Xtext packages exported only to named friend bundles.The problem
The Export, Scope, Expression and Format languages and two test bundles use packages such as
org.eclipse.xtext.xbase.compiler,org.eclipse.xtext.xbase.compiler.output,org.eclipse.xtext.common.types.util,org.eclipse.xtext.xtextandorg.eclipse.xtext.builder.resourceloader. Xtext exports these withx-friendslists, which the DDK bundles aren't on.The use is deliberate. Both generators subclass
JvmModelGenerator, and the Export one also overrides methods that takeITreeAppendable. The inferrers passITreeAppendabletoJvmTypesBuilder.setBody, the Format inferrer usesRuleNames, and the test classes useIResourceLoaderandReferenceSearchResultdirectly.The change
Adds
"restriction"to@SuppressWarningson the 16 affected classes, which matches how Xtext handles this in its own code. New classes using these packages still get the warning, except inxtext.format, whose existing access rules already coverxbase/**andcommon/types/util/**.unusedWarningTokenreports a suppression once it's no longer needed..classpath, includingxtext.format, whose rules don't coverorg.eclipse.xtext.xtext. A new rule would silently allow new uses across the whole project.JvmTypeReferenceBuilderinstead ofTypeReferences: it callsTypeReferencesinternally, and it returns an unknown reference where these callers check fornull.StringConcatenationClientinstead ofITreeAppendable: the generator subclasses would still needITreeAppendable, andJavaBodyAppendercontrols imports and blank lines closely enough that generated output could change.This also bumps the four affected bundles in the released features:
xtext.export,xtext.expression,xtext.formatandxtext.scope.Testing
Discouraged accesswarnings went, and no new warnings appeared.clean verifywithcheckstyle:check,pmd:check,pmd:cpd-checkandspotbugs:checkpasses, including the version baseline check. 451 tests ran with no failures or errors, and 2 were skipped.🤖 Generated with Claude Code