### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v retrieving revision 1.411 diff -u -r1.411 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 22 Apr 2010 16:11:44 -0000 1.411 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 21 May 2010 11:24:25 -0000 @@ -520,6 +520,7 @@ boolean assistNodeIsConstructor; boolean assistNodeIsSuperType; boolean assistNodeIsExtendedType; + boolean assistNodeIsInterfaceExcludingAnnotations; int assistNodeInJavadoc = 0; boolean assistNodeCanBeSingleMemberAnnotation = false; @@ -2774,7 +2775,7 @@ CompletionOnParameterizedQualifiedTypeReference ref = (CompletionOnParameterizedQualifiedTypeReference) astNode; this.insideQualifiedReference = true; - + this.assistNodeIsInterfaceExcludingAnnotations = ref.isInterfaceExcludingAnnotations(); this.assistNodeIsClass = ref.isClass(); this.assistNodeIsException = ref.isException(); this.assistNodeIsInterface = ref.isInterface(); @@ -3041,7 +3042,7 @@ this.assistNodeIsConstructor = ref.isConstructorType; this.assistNodeIsSuperType = ref.isSuperType(); this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); - + this.assistNodeIsInterfaceExcludingAnnotations = ref.isInterfaceExcludingAnnotations(); this.completionToken = ref.completionIdentifier; long completionPosition = ref.sourcePositions[ref.tokens.length]; @@ -3175,7 +3176,7 @@ this.assistNodeIsConstructor = singleRef.isConstructorType; this.assistNodeIsSuperType = singleRef.isSuperType(); this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); - + this.assistNodeIsInterfaceExcludingAnnotations = singleRef.isInterfaceExcludingAnnotations(); // can only be an annotation if preceeded by EXTENDS // can be the start of a qualified type name if (qualifiedBinding == null) { if (this.completionToken.length == 0 && @@ -4038,7 +4039,7 @@ } private int computeRelevanceForInterface(){ - if(this.assistNodeIsInterface) { + if(this.assistNodeIsInterface || this.assistNodeIsInterfaceExcludingAnnotations) { return R_INTERFACE; } return 0; @@ -9254,6 +9255,8 @@ memberType.isStatic()) { continue next; } + + if (this.assistNodeIsInterfaceExcludingAnnotations && memberType.isAnnotationType()) continue next; for (int i = typesFound.size; --i >= 0;) { ReferenceBinding otherType = (ReferenceBinding) typesFound.elementAt(i); @@ -9284,6 +9287,8 @@ if(!this.insideQualifiedReference) { if(this.assistNodeIsClass) { if(!memberType.isClass()) continue next; + } else if (this.assistNodeIsInterfaceExcludingAnnotations) { + if (!memberType.isInterface()) continue next; } else if(this.assistNodeIsInterface) { if(!memberType.isInterface() && !memberType.isAnnotationType()) continue next; } else if (this.assistNodeIsAnnotation) { @@ -9767,10 +9772,14 @@ if (localType == otherType) continue next; } + + if (this.assistNodeIsInterfaceExcludingAnnotations && localType.isAnnotationType()) continue next; if (this.assistNodeIsExtendedType && localType.isFinal()) continue next; if(this.assistNodeIsClass) { if(!localType.isClass()) continue next; + } else if (this.assistNodeIsInterfaceExcludingAnnotations) { + if (!localType.isInterface()) continue next; } else if(this.assistNodeIsInterface) { if(!localType.isInterface() && !localType.isAnnotationType()) continue next; } else if (this.assistNodeIsAnnotation) { @@ -10081,6 +10090,7 @@ findNestedTypes(token, scope.enclosingSourceType(), scope, proposeAllMemberTypes, typesFound); if(!this.assistNodeIsInterface && + !this.assistNodeIsInterfaceExcludingAnnotations && !this.assistNodeIsConstructor && !this.assistNodeIsAnnotation && this.assistNodeInJavadoc == 0) { @@ -10115,6 +10125,8 @@ SourceTypeBinding sourceType = types[i]; if(isForbidden(sourceType)) continue next; + + if (this.assistNodeIsInterfaceExcludingAnnotations && sourceType.isAnnotationType()) continue next; if(proposeAllMemberTypes && sourceType != outerInvocationType) { @@ -10152,6 +10164,8 @@ if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue next; if(this.assistNodeIsClass) { if(!sourceType.isClass()) continue next; + } else if (this.assistNodeIsInterfaceExcludingAnnotations) { + if (!sourceType.isInterface()) continue next; } else if(this.assistNodeIsInterface) { if(!sourceType.isInterface() && !sourceType.isAnnotationType()) continue next; } else if (this.assistNodeIsAnnotation) { @@ -10283,6 +10297,8 @@ int searchFor = IJavaSearchConstants.TYPE; if(this.assistNodeIsClass) { searchFor = IJavaSearchConstants.CLASS; + } else if(this.assistNodeIsInterfaceExcludingAnnotations) { + searchFor = IJavaSearchConstants.INTERFACE; } else if(this.assistNodeIsInterface) { searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; } else if(this.assistNodeIsEnum) { @@ -10357,7 +10373,7 @@ if (isForbidden(sourceType)) continue; if (this.assistNodeIsClass && sourceType.isInterface()) continue; - if (this.assistNodeIsInterface && sourceType.isClass()) continue; + if ((this.assistNodeIsInterface || this.assistNodeIsInterfaceExcludingAnnotations) && sourceType.isClass()) continue; char[] qualifiedSourceTypeName = CharOperation.concatWith(sourceType.compoundName, '.'); @@ -10462,6 +10478,8 @@ int searchFor = IJavaSearchConstants.TYPE; if(this.assistNodeIsClass) { searchFor = IJavaSearchConstants.CLASS; + } else if (this.assistNodeIsInterfaceExcludingAnnotations) { + searchFor = IJavaSearchConstants.INTERFACE; } else if(this.assistNodeIsInterface) { searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; } else if(this.assistNodeIsEnum) { @@ -10570,6 +10588,8 @@ if (this.assistNodeIsExtendedType && refBinding.isFinal()) continue next; if(this.assistNodeIsClass) { if(!refBinding.isClass()) continue next; + } else if (this.assistNodeIsInterfaceExcludingAnnotations) { + if (!refBinding.isInterface()) continue next; } else if(this.assistNodeIsInterface) { if(!refBinding.isInterface() && !refBinding.isAnnotationType()) continue next; } else if (this.assistNodeIsAnnotation) { @@ -10700,6 +10720,8 @@ if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; if(this.assistNodeIsClass) { if(!typeBinding.isClass()) continue; + } else if (this.assistNodeIsInterfaceExcludingAnnotations) { + if (!typeBinding.isInterface()) continue; } else if(this.assistNodeIsInterface) { if(!typeBinding.isInterface() && !typeBinding.isAnnotationType()) continue; } else if (this.assistNodeIsAnnotation) { @@ -10803,6 +10825,8 @@ if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; if(this.assistNodeIsClass) { if(!typeBinding.isClass()) continue; + } else if (this.assistNodeIsInterfaceExcludingAnnotations) { + if (!typeBinding.isInterface()) continue; } else if(this.assistNodeIsInterface) { if(!typeBinding.isInterface() && !typeBinding.isAnnotationType()) continue; } else if (this.assistNodeIsAnnotation) { Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java,v retrieving revision 1.12 diff -u -r1.12 CompletionOnParameterizedQualifiedTypeReference.java --- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java 7 Mar 2009 00:59:00 -0000 1.12 +++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java 21 May 2010 11:24:25 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,6 +36,8 @@ public static final int K_CLASS = 1; public static final int K_INTERFACE = 2; public static final int K_EXCEPTION = 3; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310423 + public static final int K_INTERFACE_EXCLUDING_ANNOTATIONS = 4; private int kind = K_TYPE; public char[] completionIdentifier; @@ -75,6 +77,10 @@ public boolean isSuperType(){ return this.kind == K_CLASS || this.kind == K_INTERFACE; } + + public boolean isInterfaceExcludingAnnotations(){ + return this.kind == K_INTERFACE_EXCLUDING_ANNOTATIONS; + } public TypeBinding resolveType(BlockScope scope, boolean checkBounds) { super.resolveType(scope, checkBounds); @@ -92,6 +98,7 @@ output.append("'); return output; } + + public void setKind(int kind) { + this.kind = kind; + } } Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java,v retrieving revision 1.29 diff -u -r1.29 CompletionOnQualifiedTypeReference.java --- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java 16 Jan 2009 14:29:29 -0000 1.29 +++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java 21 May 2010 11:24:26 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,8 @@ public static final int K_CLASS = 1; public static final int K_INTERFACE = 2; public static final int K_EXCEPTION = 3; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310423 + public static final int K_INTERFACE_EXCLUDING_ANNOTATIONS = 4; private int kind = K_TYPE; public char[] completionIdentifier; @@ -85,6 +87,10 @@ public boolean isSuperType(){ return this.kind == K_CLASS || this.kind == K_INTERFACE; } + +public boolean isInterfaceExcludingAnnotations(){ + return this.kind == K_INTERFACE_EXCLUDING_ANNOTATIONS; +} public void setKind(int kind) { this.kind = kind; } @@ -94,6 +100,7 @@ output.append("