Skip to content

Hide compiler-generated synthetic fields from autocomplete#111

Open
abanchev wants to merge 1 commit intobobbylight:masterfrom
abanchev:hide-synthetic-fields
Open

Hide compiler-generated synthetic fields from autocomplete#111
abanchev wants to merge 1 commit intobobbylight:masterfrom
abanchev:hide-synthetic-fields

Conversation

@abanchev
Copy link

@abanchev abanchev commented Mar 7, 2026

Summary

  • Filter class$0, class$1, etc. fields from Java autocomplete results. These are compiler-generated synthetic fields for .class literal expressions when targeting pre-Java 5 bytecode (e.g. ECJ with -target 1.4).
  • Added a configurable hideSyntheticFields property on JavaLanguageSupport (default: true) with getHideSyntheticFields() / setHideSyntheticFields(boolean) API so users can opt back in if needed.

Motivation

Screenshot 2026-03-07 205727

When working with class files compiled for Java 1.4 targets, the compiler generates static fields like class$0, class$1 to cache Class objects for .class literal expressions. These internal implementation details appear in autocomplete alongside real fields, cluttering the completion list with entries that are never useful to write directly.

Changes

  • SourceCompletionProvider: added hideSyntheticFields flag (default true) and a check in isAccessible() that rejects FieldInfo entries whose name starts with class$
  • JavaCompletionProvider: exposed package-private getSourceProvider() accessor
  • JavaLanguageSupport: added hideSyntheticFields field with public getter/setter, wired through on install()

Filter out class$0, class$1, etc. fields that Java compilers generate
for .class literal expressions when targeting pre-Java 5 bytecode.
These are internal compiler implementation details that should not
appear in completion results.

Added configurable hideSyntheticFields property (default: true) on
JavaLanguageSupport with getter/setter API, wired through to
SourceCompletionProvider.isAccessible().
@abanchev abanchev force-pushed the hide-synthetic-fields branch from 15a9380 to 6138121 Compare March 7, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant