diff --git a/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/contentassist/CodeCompletionTest16.java b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/contentassist/CodeCompletionTest16.java new file mode 100644 index 00000000000..76bb013ceed --- /dev/null +++ b/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/contentassist/CodeCompletionTest16.java @@ -0,0 +1,183 @@ +/******************************************************************************* + * Copyright (c) 2024 GK Software AG, IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Stephan Herrmann - initial API and implementation - https://bugs.eclipse.org/425183 + * IBM Corporation - initial API and implementation + * Red Hat Inc. - modified to test Java 16 + *******************************************************************************/ +package org.eclipse.jdt.text.tests.contentassist; + +import static org.junit.Assert.assertEquals; + +import java.util.Hashtable; +import java.util.List; + +import org.junit.Rule; +import org.junit.Test; + +import org.eclipse.jdt.testplugin.JavaProjectHelper; +import org.eclipse.jdt.testplugin.TestOptions; + +import org.eclipse.core.runtime.CoreException; + +import org.eclipse.jface.preference.IPreferenceStore; + +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.contentassist.ICompletionProposal; +import org.eclipse.jface.text.source.ISourceViewer; + +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; + +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; + +import org.eclipse.jdt.internal.core.manipulation.CodeTemplateContextType; +import org.eclipse.jdt.internal.core.manipulation.StubUtility; + +import org.eclipse.jdt.ui.JavaUI; +import org.eclipse.jdt.ui.PreferenceConstants; +import org.eclipse.jdt.ui.tests.core.rules.Java16ProjectTestSetup; +import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext; + +import org.eclipse.jdt.internal.ui.JavaPlugin; +import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; +import org.eclipse.jdt.internal.ui.text.java.JavaAllCompletionProposalComputer; +import org.eclipse.jdt.internal.ui.text.java.JavaTypeCompletionProposalComputer; + +/** + * Those tests are made to run on Java 16 + */ +public class CodeCompletionTest16 extends AbstractCompletionTest { + @Rule + public Java16ProjectTestSetup j16s= new Java16ProjectTestSetup(true); + + private IJavaProject fJProject1; + + @Override + public void setUp() throws Exception { + fJProject1= j16s.getProject(); + fJProject1.setOption(JavaCore.COMPILER_COMPLIANCE, "16"); + fJProject1.setOption(JavaCore.COMPILER_SOURCE, "16"); + fJProject1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, "16"); + fJProject1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED); + + + Hashtable options= TestOptions.getDefaultOptions(); + options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1"); + options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE); + options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4"); + options.put(JavaCore.CODEASSIST_FIELD_PREFIXES, "f"); + options.put(JavaCore.COMPILER_COMPLIANCE, "16"); + options.put(JavaCore.COMPILER_SOURCE, "16"); + options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, "16"); + JavaCore.setOptions(options); + + IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); + store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, true); + store.setValue(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, true); + store.setValue(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, true); + + StubUtility.setCodeTemplate(CodeTemplateContextType.OVERRIDECOMMENT_ID, "/* (non-Javadoc)\n * ${see_to_overridden}\n */", null); + StubUtility.setCodeTemplate(CodeTemplateContextType.DELEGATECOMMENT_ID, "/* (non-Javadoc)\n * ${see_to_target}\n */", null); + StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null); + StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID, "/**\n * Constructor.\n */", null); + StubUtility.setCodeTemplate(CodeTemplateContextType.METHODCOMMENT_ID, "/**\n * Method.\n */", null); + StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "//TODO\n${body_statement}", null); + StubUtility.setCodeTemplate(CodeTemplateContextType.GETTERCOMMENT_ID, "/**\n * @return the ${bare_field_name}\n */", fJProject1); + StubUtility.setCodeTemplate(CodeTemplateContextType.SETTERCOMMENT_ID, "/**\n * @param ${param} the ${bare_field_name} to set\n */", fJProject1); + } + + @Override + public void tearDown() throws Exception { + IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); + store.setToDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS); + store.setToDefault(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS); + store.setToDefault(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS); + closeAllEditors(); + JavaProjectHelper.clear(fJProject1, j16s.getDefaultClasspath()); + } + + public static void closeEditor(IEditorPart editor) { + IWorkbenchPartSite site; + IWorkbenchPage page; + if (editor != null && (site= editor.getSite()) != null && (page= site.getPage()) != null) + page.closeEditor(editor, false); + } + + public static void closeAllEditors() { + for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) { + for (IWorkbenchPage page : window.getPages()) { + for (IEditorReference editorReference : page.getEditorReferences()) { + closeEditor(editorReference.getEditor(false)); + } + } + } + } + + private JavaContentAssistInvocationContext createContext(int offset, ICompilationUnit cu) throws PartInitException, JavaModelException { + JavaEditor editor= (JavaEditor) JavaUI.openInEditor(cu); + ISourceViewer viewer= editor.getViewer(); + return new JavaContentAssistInvocationContext(viewer, offset, editor); + } + + @Test + public void testBug560674() throws CoreException { + IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src"); + + IPackageFragment pack1= sourceFolder.createPackageFragment("test1", false, null); + String contents= + "package test1\n" + + "public record X1(int abcd) {\n" + + " abc \n" + + "}\n"; + ICompilationUnit cu= pack1.createCompilationUnit("X1.java", contents, false, null); + + + String str= "abc "; + + int offset= contents.indexOf(str) + str.length() - 1; + + JavaTypeCompletionProposalComputer comp= new JavaAllCompletionProposalComputer(); + + List proposals= comp.computeCompletionProposals(createContext(offset, cu), null); + ICompletionProposal proposal = proposals.get(0); + + IEditorPart part= JavaUI.openInEditor(cu); + IDocument doc= JavaUI.getDocumentProvider().getDocument(part.getEditorInput()); + if (proposal != null) { + proposal.apply(doc); + } + + String expectedContents= + "package test1\n" + + "public record X1(int abcd) {\n" + + " /**\n" + + " * Method.\n" + + " */\n" + + " public int abcd() {\n" + + " return abcd;\n" + + " } \n" + + "}\n"; + assertEquals(expectedContents, doc.get()); + } + +} diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.java index b5af4445934..87ad327e042 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.java @@ -44,6 +44,7 @@ private JavaTextMessages() { public static String GetterSetterCompletionProposal_setter_label; public static String MethodCompletionProposal_constructor_label; public static String MethodCompletionProposal_method_label; + public static String RecordAccessorCompletionProposal_accessor_label; static { NLS.initializeMessages(BUNDLE_NAME, JavaTextMessages.class); diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.properties index 1b0425d22b8..50ccc4519bf 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.properties +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTextMessages.properties @@ -51,6 +51,7 @@ GetterSetterCompletionProposal_getter_label=Getter for ''{0}'' GetterSetterCompletionProposal_setter_label=Setter for ''{0}'' MethodCompletionProposal_constructor_label=Constructor MethodCompletionProposal_method_label=Method stub +RecordAccessorCompletionProposal_accessor_label=Record accessor stub ContentAssistProcessor_computing_proposals=Computing completion proposals ContentAssistProcessor_collecting_proposals=Collecting proposals diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/MethodDeclarationCompletionProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/MethodDeclarationCompletionProposal.java index d2bfaaf4cb1..c532d166aec 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/MethodDeclarationCompletionProposal.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/MethodDeclarationCompletionProposal.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -28,6 +28,7 @@ import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.TextUtilities; +import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.Signature; @@ -58,6 +59,7 @@ public class MethodDeclarationCompletionProposal extends JavaTypeCompletionPropo public static void evaluateProposals(IType type, String prefix, int offset, int length, int relevance, Set suggestedMethods, Collection result) throws CoreException { IMethod[] methods= type.getMethods(); + IField[] components= type.getRecordComponents(); if (!type.isInterface()) { String constructorName= type.getElementName(); if (constructorName.length() > 0 && constructorName.startsWith(prefix) && !hasMethod(methods, constructorName) && suggestedMethods.add(constructorName)) { @@ -65,9 +67,10 @@ public static void evaluateProposals(IType type, String prefix, int offset, int } } - if (prefix.length() > 0 && !"main".equals(prefix) && !hasMethod(methods, prefix) && suggestedMethods.add(prefix)) { //$NON-NLS-1$ - if (!JavaConventionsUtil.validateMethodName(prefix, type).matches(IStatus.ERROR)) + if (prefix.length() > 0 && !"main".equals(prefix) && !hasMethod(methods, prefix) && !hasRecordComponent(components, prefix) && suggestedMethods.add(prefix)) { //$NON-NLS-1$ + if (!JavaConventionsUtil.validateMethodName(prefix, type).matches(IStatus.ERROR)) { result.add(new MethodDeclarationCompletionProposal(type, prefix, Signature.SIG_VOID, offset, length, relevance)); + } } } @@ -80,6 +83,15 @@ private static boolean hasMethod(IMethod[] methods, String name) { return false; } + private static boolean hasRecordComponent(IField[] components, String name) { + for (IField curr : components) { + if (curr.getElementName().equals(name)) { + return true; + } + } + return false; + } + private final IType fType; private final String fReturnTypeSig; private final String fMethodName; @@ -140,7 +152,9 @@ protected boolean updateReplacementString(IDocument document, char trigger, int } } if (fReturnTypeSig != null) { - if (!isInterface) { + if (fType.isRecord()) { + buf.append("public "); //$NON-NLS-1$ + } else if (!isInterface) { buf.append("private "); //$NON-NLS-1$ } } else { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/RecordAccessorCompletionProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/RecordAccessorCompletionProposal.java new file mode 100644 index 00000000000..d7b5028e4be --- /dev/null +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/RecordAccessorCompletionProposal.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2024 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.ui.text.java; + +import java.util.Collection; +import java.util.Set; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; + +import org.eclipse.jface.viewers.StyledString; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.TextUtilities; + +import org.eclipse.jdt.core.IField; +import org.eclipse.jdt.core.IMethod; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.Signature; +import org.eclipse.jdt.core.dom.rewrite.ImportRewrite; +import org.eclipse.jdt.core.formatter.CodeFormatter; +import org.eclipse.jdt.core.manipulation.CodeGeneration; + +import org.eclipse.jdt.internal.core.manipulation.util.Strings; +import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings; +import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil; +import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil; + +import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal; + +import org.eclipse.jdt.internal.ui.JavaPluginImages; +import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; +import org.eclipse.jdt.internal.ui.preferences.formatter.FormatterProfileManager; + + +/** + * Record accessor declaration proposal. + */ +public class RecordAccessorCompletionProposal extends JavaTypeCompletionProposal { + + + public static void evaluateProposals(IType type, String prefix, int offset, int length, int relevance, Set suggestedMethods, Collection result) throws CoreException { + IMethod[] methods= type.getMethods(); + if (!type.isRecord()) { + return; + } + if (prefix.length() > 0 && !hasMethod(methods, prefix)) { + if (!JavaConventionsUtil.validateMethodName(prefix, type).matches(IStatus.ERROR)) { + IField[] fields= type.getRecordComponents(); + for (IField field : fields) { + if (field.getElementName().startsWith(prefix)) { + if (suggestedMethods.add(field.getElementName())) { + result.add(new RecordAccessorCompletionProposal(type, field.getElementName(), field.getTypeSignature(), offset, length, relevance + 1)); + } + } + } + } + } + } + + private static boolean hasMethod(IMethod[] methods, String name) { + for (IMethod curr : methods) { + if (curr.getElementName().equals(name) && curr.getParameterTypes().length == 0) { + return true; + } + } + return false; + } + + private final IType fType; + private final String fReturnTypeSig; + private final String fMethodName; + + public RecordAccessorCompletionProposal(IType type, String methodName, String returnTypeSig, int start, int length, int relevance) { + super("", type.getCompilationUnit(), start, length, null, getDisplayName(methodName, returnTypeSig), relevance); //$NON-NLS-1$ + Assert.isNotNull(type); + Assert.isNotNull(methodName); + Assert.isNotNull(returnTypeSig); + + fType= type; + fMethodName= methodName; + fReturnTypeSig= returnTypeSig; + + setImage(JavaPluginImages.get(JavaPluginImages.IMG_MISC_PUBLIC)); + } + + private static StyledString getDisplayName(String methodName, String returnTypeSig) { + StyledString buf= new StyledString(); + buf.append(methodName); + buf.append('('); + buf.append(')'); + buf.append(" : "); //$NON-NLS-1$ + buf.append(Signature.toString(returnTypeSig)); + buf.append(" - ", StyledString.QUALIFIER_STYLER); //$NON-NLS-1$ + buf.append(JavaTextMessages.RecordAccessorCompletionProposal_accessor_label, StyledString.QUALIFIER_STYLER); + return buf; + } + + @Override + protected boolean updateReplacementString(IDocument document, char trigger, int offset, ImportRewrite impRewrite) throws CoreException, BadLocationException { + + CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings(fType.getJavaProject()); + boolean addComments= settings.createComments; + + String[] empty= new String[0]; + String lineDelim= TextUtilities.getDefaultLineDelimiter(document); + String declTypeName= fType.getTypeQualifiedName('.'); + + StringBuilder buf= new StringBuilder(); + if (addComments) { + String comment= CodeGeneration.getMethodComment(fType.getCompilationUnit(), declTypeName, fMethodName, empty, empty, fReturnTypeSig, empty, null, lineDelim); + if (comment != null) { + buf.append(comment); + buf.append(lineDelim); + } + } + buf.append("public "); //$NON-NLS-1$ + + if (fReturnTypeSig != null) { + buf.append(Signature.toString(fReturnTypeSig)); + } + buf.append(' '); + buf.append(fMethodName); + buf.append("() {"); //$NON-NLS-1$ + buf.append(lineDelim); + + String returnStatement= "return " + fMethodName + ";"; //$NON-NLS-1$ //$NON-NLS-2$ + buf.append(returnStatement); + buf.append(lineDelim); + buf.append("}"); //$NON-NLS-1$ + buf.append(lineDelim); + String stub= buf.toString(); + + // use the code formatter + IRegion region= document.getLineInformationOfOffset(getReplacementOffset()); + int lineStart= region.getOffset(); + int indent= Strings.computeIndentUnits(document.get(lineStart, getReplacementOffset() - lineStart), settings.tabWidth, settings.indentWidth); + + String replacement= CodeFormatterUtil.format(CodeFormatter.K_CLASS_BODY_DECLARATIONS, stub, indent, lineDelim, FormatterProfileManager.getProjectSettings(fType.getJavaProject())); + + if (replacement.endsWith(lineDelim)) { + replacement= replacement.substring(0, replacement.length() - lineDelim.length()); + } + + setReplacementString(Strings.trimLeadingTabsAndSpaces(replacement)); + return true; + } + + @Override + public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) { + return ""; // don't let method stub proposals complete incrementally //$NON-NLS-1$ + } + + /* + * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension4#isAutoInsertable() + */ + @Override + public boolean isAutoInsertable() { + return false; + } + +} diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java index d3156d9a6be..a828a125096 100755 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2023 IBM Corporation and others. + * Copyright (c) 2000, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -18,11 +18,19 @@ import java.util.List; import java.util.Set; +import org.eclipse.swt.graphics.Image; + import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.StyledString; + +import org.eclipse.jface.text.contentassist.IContextInformation; + import org.eclipse.jdt.core.CompletionContext; import org.eclipse.jdt.core.CompletionProposal; import org.eclipse.jdt.core.CompletionRequestor; @@ -35,9 +43,11 @@ import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.formatter.CodeFormatter; + import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil; import org.eclipse.jdt.internal.corext.util.CollectionsUtil; import org.eclipse.jdt.internal.corext.util.TypeFilter; + import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.preferences.formatter.FormatterProfileManager; import org.eclipse.jdt.internal.ui.text.java.AnnotationAtttributeProposalInfo; @@ -57,14 +67,11 @@ import org.eclipse.jdt.internal.ui.text.java.MethodProposalInfo; import org.eclipse.jdt.internal.ui.text.java.OverrideCompletionProposal; import org.eclipse.jdt.internal.ui.text.java.ProposalContextInformation; +import org.eclipse.jdt.internal.ui.text.java.RecordAccessorCompletionProposal; import org.eclipse.jdt.internal.ui.text.java.RelevanceComputer; import org.eclipse.jdt.internal.ui.text.javadoc.JavadocInlineTagCompletionProposal; import org.eclipse.jdt.internal.ui.text.javadoc.JavadocLinkTypeCompletionProposal; import org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.swt.graphics.Image; /** * Java UI implementation of CompletionRequestor. Produces @@ -677,6 +684,7 @@ private void acceptPotentialMethodDeclaration(CompletionProposal proposal) { int relevance= computeRelevance(proposal); GetterSetterCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance + 2, fSuggestedMethodNames, fJavaProposals); + RecordAccessorCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance + 1, fSuggestedMethodNames, fJavaProposals); MethodDeclarationCompletionProposal.evaluateProposals(type, prefix, completionStart, completionEnd - completionStart, relevance, fSuggestedMethodNames, fJavaProposals); } } catch (CoreException e) {