Skip to content

Commit

Permalink
UI Freezes since 2023-09
Browse files Browse the repository at this point in the history
 experimental fix for eclipse-jdt#1728

 disable annotation resolution / evaluation for some clients
  • Loading branch information
stephan-herrmann committed Apr 2, 2024
1 parent e53e413 commit 3c15c2b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ CompleteTypeBindingsSteps next() {
return this; // no-change to signal "at end"
}

boolean isRequired(boolean buildFieldsAndMethods, boolean resolveAnnotations) {
return switch (this) {
case BUILD_FIELDS_AND_METHODS -> buildFieldsAndMethods;
case INTEGRATE_ANNOTATIONS_IN_HIERARCHY -> resolveAnnotations;
default -> true;
};
}

/** values without NONE */
static final CompleteTypeBindingsSteps[] realValues = Arrays.copyOfRange(values(), 1, values().length-1);

Expand Down Expand Up @@ -601,11 +609,14 @@ public void completeTypeBindings(CompilationUnitDeclaration parsedUnit) {
* suitable replacement will be substituted (such as Object for a missing superclass)
*/
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean buildFieldsAndMethods) {
completeTypeBindings(parsedUnit, buildFieldsAndMethods, true);
}
public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean buildFieldsAndMethods, boolean resolveAnnotations) {
if (parsedUnit.scope == null) return; // parsing errors were too severe
LookupEnvironment rootEnv = this.root;
CompilationUnitDeclaration previousUnitBeingCompleted = rootEnv.unitBeingCompleted;
for (CompleteTypeBindingsSteps step : CompleteTypeBindingsSteps.realValues) {
if (step != CompleteTypeBindingsSteps.BUILD_FIELDS_AND_METHODS || buildFieldsAndMethods)
if (step.isRequired(buildFieldsAndMethods, resolveAnnotations))
step.perform((rootEnv.unitBeingCompleted = parsedUnit).scope);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, Acc

if (unit != null) {
environment.buildTypeBindings(unit, accessRestriction);
environment.completeTypeBindings(unit, true);
environment.completeTypeBindings(unit, true, false /* no annotations */);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, Acc
org.eclipse.jdt.core.ICompilationUnit cu = ((SourceTypeElementInfo)sourceType).getHandle().getCompilationUnit();
rememberAllTypes(unit, cu, false);

environment.completeTypeBindings(unit, true/*build constructor only*/);
environment.completeTypeBindings(unit, true/*build constructor only*/, false /*no annotations*/);
} catch (AbortCompilation e) {
// missing 'java.lang' package: ignore
}
Expand Down

0 comments on commit 3c15c2b

Please sign in to comment.