Skip to content

Commit

Permalink
Do not suggest "extends" on enum or record
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelistria committed Jan 29, 2025
1 parent 76e9c9c commit 0e761eb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.MethodRef;
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.jdt.core.dom.ModuleDeclaration;
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.NameQualifiedType;
Expand Down Expand Up @@ -127,6 +126,7 @@
import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.SearchEngine;
Expand Down Expand Up @@ -835,7 +835,8 @@ public void complete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit sour
//
// }
boolean isInterface = typeDecl instanceof TypeDeclaration realTypeDecl && realTypeDecl.isInterface();
if (CharOperation.prefixEquals(this.prefix.toCharArray(), Keywords.EXTENDS)) {
boolean isEnumOrRecord = typeDecl instanceof RecordDeclaration || typeDecl instanceof EnumDeclaration;
if (!isEnumOrRecord && CharOperation.prefixEquals(this.prefix.toCharArray(), Keywords.EXTENDS)) {
this.requestor.accept(createKeywordProposal(Keywords.EXTENDS, this.offset, this.offset));
}
if (!isInterface && CharOperation.prefixEquals(this.prefix.toCharArray(), Keywords.IMPLEMENTS)) {
Expand Down

0 comments on commit 0e761eb

Please sign in to comment.