### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.ui
diff --git ui/org/eclipse/jdt/internal/ui/text/java/FilledArgumentNamesMethodProposal.java ui/org/eclipse/jdt/internal/ui/text/java/FilledArgumentNamesMethodProposal.java
index 783be74..6bc58f0 100644
--- ui/org/eclipse/jdt/internal/ui/text/java/FilledArgumentNamesMethodProposal.java
+++ ui/org/eclipse/jdt/internal/ui/text/java/FilledArgumentNamesMethodProposal.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -142,6 +142,9 @@
buffer.append(RPAREN);
+ if (canAppendSemicolon())
+ buffer.append(SEMICOLON);
+
return buffer.toString();
}
diff --git ui/org/eclipse/jdt/internal/ui/text/java/JavaMethodCompletionProposal.java ui/org/eclipse/jdt/internal/ui/text/java/JavaMethodCompletionProposal.java
index 30a84df..b7f613d 100644
--- ui/org/eclipse/jdt/internal/ui/text/java/JavaMethodCompletionProposal.java
+++ ui/org/eclipse/jdt/internal/ui/text/java/JavaMethodCompletionProposal.java
@@ -23,6 +23,7 @@
import org.eclipse.jdt.core.CompletionProposal;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil;
@@ -57,6 +58,8 @@
super.apply(document, trigger, offset);
if (needsLinkedMode()) {
setUpLinkedMode(document, ')');
+ } else if (getReplacementString().endsWith(";")) { //$NON-NLS-1$
+ setUpLinkedMode(document, ';');
}
}
@@ -126,6 +129,21 @@
return fHasParameters;
}
+ /**
+ * Returns true
if the method can be completed with a semicolon.
+ *
+ * Note:
Return type of a constructor is void.
+ *
true
if the return type of the method is void and the method is not a
+ * constructor, false
if the return type is non-void or the method is a
+ * constructor.
+ * @since 3.9
+ */
+ protected final boolean canAppendSemicolon() {
+ return CharOperation.equals(new char[] { Signature.C_VOID }, Signature.getReturnType(fProposal.getSignature())) && !fProposal.isConstructor();
+ }
+
private boolean computeHasParameters() throws IllegalArgumentException {
return Signature.getParameterCount(fProposal.getSignature()) > 0;
}
@@ -188,6 +206,9 @@
buffer.append(RPAREN);
+ if (canAppendSemicolon())
+ buffer.append(SEMICOLON);
+
return buffer.toString();
}
diff --git ui/org/eclipse/jdt/internal/ui/text/java/LazyJavaCompletionProposal.java ui/org/eclipse/jdt/internal/ui/text/java/LazyJavaCompletionProposal.java
index 4b12870..a2c579c 100644
--- ui/org/eclipse/jdt/internal/ui/text/java/LazyJavaCompletionProposal.java
+++ ui/org/eclipse/jdt/internal/ui/text/java/LazyJavaCompletionProposal.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -43,6 +43,7 @@
protected static final String RPAREN= ")"; //$NON-NLS-1$
protected static final String COMMA= ","; //$NON-NLS-1$
protected static final String SPACE= " "; //$NON-NLS-1$
+ protected static final String SEMICOLON= ";"; //$NON-NLS-1$
protected static final class FormatterPrefs {
/* Methods & constructors */
diff --git ui/org/eclipse/jdt/internal/ui/text/java/ParameterGuessingProposal.java ui/org/eclipse/jdt/internal/ui/text/java/ParameterGuessingProposal.java
index 6d5966d..9fa81c3 100644
--- ui/org/eclipse/jdt/internal/ui/text/java/ParameterGuessingProposal.java
+++ ui/org/eclipse/jdt/internal/ui/text/java/ParameterGuessingProposal.java
@@ -281,6 +281,9 @@
buffer.append(RPAREN);
+ if (canAppendSemicolon())
+ buffer.append(SEMICOLON);
+
return buffer.toString();
}