@@ -2591,6 +2591,9 @@ private void completeSimpleName(SimpleName simpleName) {
25912591 if (simpleName .getParent () instanceof PackageDeclaration ) {
25922592 suggestDefaultCompletions = false ;
25932593 }
2594+ if (simpleName .getParent () instanceof AbstractTypeDeclaration typeDecl && typeDecl .getName () == simpleName ) {
2595+ suggestDefaultCompletions = false ;
2596+ }
25942597 }
25952598
25962599 private void completeModuleDeclaration (ModuleDeclaration moduleDeclaration ) {
@@ -4828,6 +4831,12 @@ private CompletionProposal toProposal(IType type, int access, int modifiers) {
48284831 }
48294832 }
48304833
4834+ boolean isMember = false ;
4835+ try {
4836+ isMember = type .isMember ();
4837+ } catch (JavaModelException e ) {
4838+ // do nothing
4839+ }
48314840 Javadoc javadoc = (Javadoc ) DOMCompletionUtils .findParent (this .toComplete , new int [] { ASTNode .JAVADOC });
48324841 ASTNode parentTypeDeclaration = DOMCompletionUtils .findParentTypeDeclaration (this .toComplete );
48334842 if (parentTypeDeclaration != null || javadoc != null ) {
@@ -4836,9 +4845,9 @@ private CompletionProposal toProposal(IType type, int access, int modifiers) {
48364845 boolean isInJavaLang = type .getFullyQualifiedName ().startsWith ("java.lang." ) && !type .getFullyQualifiedName ().substring ("java.lang." .length ()).contains ("." );
48374846 IPackageBinding currentPackageBinding = completionContext .getCurrentTypeBinding () == null ? null : completionContext .getCurrentTypeBinding ().getPackage ();
48384847 // TODO: what about qualified references to inner classes?
4839- if (packageFrag != null && (currentPackageBinding == null
4848+ if (packageFrag != null && ! packageFrag . getElementName (). isEmpty () && (currentPackageBinding == null
48404849 || (this .qualifiedPrefix .startsWith (packageFrag .getElementName ()) && javadoc != null )
4841- || (!packageFrag .getElementName ().equals (currentPackageBinding .getName ())
4850+ || (( !packageFrag .getElementName ().equals (currentPackageBinding .getName ()) || ( isMember && this . qualifiedPrefix . equals ( this . prefix ) && ! type . getCompilationUnit (). equals ( this . modelUnit ) ))
48424851 && !packageFrag .getElementName ().equals ("java.lang" ))) && !inImports && !isInJavaLang ) { //$NON-NLS-1$
48434852 completion .insert (0 , '.' );
48444853 completion .insert (0 , packageFrag .getElementName ());
0 commit comments