Class ExternSymbols
extern construct. Use it before turning a symbol's source token into a location
shown to a user; do not re-derive the EXTERN check.
Why this matters, concretely. A built-in symbol has a perfectly good source token, and that
token's source name is a file that DOES NOT EXIST. The bootstrap constructs its source in memory as
new CompilableSource(".", "org-ek9-lang.ek9", ...)
(Ek9BuiltinIntrospectionSupplier), so a Go-to-Definition on String.trim() that trusts
the token resolves to <cwd>/org-ek9-lang.ek9 at a synthetic line — a path no editor can open.
The symbol is real; the FILE is not. Nothing about the token itself says so, which is exactly why this
has to be an explicit check rather than something a caller notices.
Why it is shared (2026-09-13). ReferencesExtractor had this as a private method and
guarded correctly; compiler-ide's NavigationProvider had no such check at all, so the
IDE's Go-to-Definition on any built-in navigated to a non-existent file. Two consumers of the same
rule, one of them wrong, is precisely the shape that a copied predicate produces — so it is now one
function in the lowest module, visible to compiler-services and compiler-ide alike.
⚠️ The owner check is DEFENCE, and its triggering shape is unverified. An earlier version of
this javadoc asserted that "a method is not itself marked EXTERN; its owning aggregate is" —
that is FALSE for built-ins, and falsification caught it: removing the owner branch left the test
green. Measured on org.ek9.lang::String.trim(), the method AND the aggregate both carry
EXTERN = TRUE, so the first branch alone is sufficient there. The owner branch is retained
because it came from ReferencesExtractor's original private guard and removing it would be a
silent behaviour change to a well-tested consumer — but which shape needs it (a user-declared
defines extern module, most likely) has NOT been established. Establish it before relying on
it, and do not restate the claim this paragraph replaced.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisExternallyProvided(ISymbol symbol) Is this symbol externally provided, so its source token must NOT be shown as a location?
-
Method Details
-
isExternallyProvided
Is this symbol externally provided, so its source token must NOT be shown as a location?- Parameters:
symbol- the symbol to test;nullis not external (there is nothing to show anyway)- Returns:
- true when the symbol, or the aggregate owning it, is marked
EXTERN
-