annotationFiles) {
- String fqn = getFQN(packageName, fromFile);
- if (fqn != null) {
- myExternalAnnotations.put(fqn, annotationFiles);
+ VirtualFile virtualFile = fromFile.getVirtualFile();
+ if (virtualFile != null) {
+ myExternalAnnotations.put(virtualFile, annotationFiles);
}
}
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
index 5a1e1376ba93..bd06902e8b2f 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
@@ -58,18 +59,18 @@ import java.util.regex.Pattern;
public class JavaDocInfoGenerator {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.javadoc.JavaDocInfoGenerator");
- private static final @NonNls Pattern ourNotDot = Pattern.compile("[^.]");
- private static final @NonNls Pattern ourWhitespaces = Pattern.compile("[ \\n\\r\\t]+");
+ @NonNls private static final Pattern ourNotDot = Pattern.compile("[^.]");
+ @NonNls private static final Pattern ourWhitespaces = Pattern.compile("[ \\n\\r\\t]+");
- private static final @NonNls String THROWS_KEYWORD = "throws";
- private static final @NonNls String BR_TAG = "
";
- private static final @NonNls String LINK_TAG = "link";
- private static final @NonNls String LITERAL_TAG = "literal";
- private static final @NonNls String CODE_TAG = "code";
- private static final @NonNls String LINKPLAIN_TAG = "linkplain";
- private static final @NonNls String INHERITDOC_TAG = "inheritDoc";
- private static final @NonNls String DOCROOT_TAG = "docRoot";
- private static final @NonNls String VALUE_TAG = "value";
+ @NonNls private static final String THROWS_KEYWORD = "throws";
+ @NonNls private static final String BR_TAG = "
";
+ @NonNls private static final String LINK_TAG = "link";
+ @NonNls private static final String LITERAL_TAG = "literal";
+ @NonNls private static final String CODE_TAG = "code";
+ @NonNls private static final String LINKPLAIN_TAG = "linkplain";
+ @NonNls private static final String INHERITDOC_TAG = "inheritDoc";
+ @NonNls private static final String DOCROOT_TAG = "docRoot";
+ @NonNls private static final String VALUE_TAG = "value";
private final Project myProject;
private final PsiElement myElement;
@@ -204,7 +205,7 @@ public class JavaDocInfoGenerator {
@Nullable
private static String fixupDoc(@NotNull final StringBuilder buffer) {
String text = buffer.toString();
- if (text.length() == 0) {
+ if (text.isEmpty()) {
return null;
}
if (LOG.isDebugEnabled()) {
@@ -253,14 +254,14 @@ public class JavaDocInfoGenerator {
return null;
if (docURLs != null) {
- StringBuilder errorsSection = new StringBuilder("Following external urls were checked:
");
- errorsSection.append(StringUtil.join(docURLs, "
"));
- errorsSection.append("
The documentation for this element is not found. Please add all the needed paths to API docs in ");
- errorsSection.append("Project Settings.
");
if (buffer.length() == 0) {
buffer.append("");
}
- buffer.insert(buffer.indexOf(""), errorsSection.toString());
+ String errorSection = "Following external urls were checked:
" +
+ StringUtil.join(docURLs, "
") +
+ "
The documentation for this element is not found. Please add all the needed paths to API docs in " +
+ "Project Settings.
";
+ buffer.insert(buffer.indexOf(""), errorSection);
}
return fixupDoc(buffer);
}
@@ -274,7 +275,7 @@ public class JavaDocInfoGenerator {
PsiFile file = aClass.getContainingFile();
if (file instanceof PsiJavaFile) {
String packageName = ((PsiJavaFile)file).getPackageName();
- if (packageName.length() > 0) {
+ if (!packageName.isEmpty()) {
buffer.append("");
buffer.append(packageName);
buffer.append("");
@@ -285,7 +286,7 @@ public class JavaDocInfoGenerator {
buffer.append("");
generateAnnotations(buffer, aClass);
String modifiers = PsiFormatUtil.formatModifiers(aClass, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
- if (modifiers.length() > 0) {
+ if (!modifiers.isEmpty()) {
buffer.append(modifiers);
buffer.append(" ");
}
@@ -445,7 +446,7 @@ public class JavaDocInfoGenerator {
buffer.append("");
generateAnnotations(buffer, field);
String modifiers = PsiFormatUtil.formatModifiers(field, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
- if (modifiers.length() > 0) {
+ if (!modifiers.isEmpty()) {
buffer.append(modifiers);
buffer.append(" ");
}
@@ -487,7 +488,7 @@ public class JavaDocInfoGenerator {
buffer.append("");
String modifiers = PsiFormatUtil.formatModifiers(variable, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
- if (modifiers.length() > 0) {
+ if (!modifiers.isEmpty()) {
buffer.append(modifiers);
buffer.append(" ");
}
@@ -558,7 +559,7 @@ public class JavaDocInfoGenerator {
String htmlText = packageHtmlFile.getText();
try {
- final Document document = JDOMUtil.loadDocument(new ByteArrayInputStream(htmlText.getBytes()));
+ final Document document = JDOMUtil.loadDocument(new ByteArrayInputStream(htmlText.getBytes(CharsetToolkit.UTF8_CHARSET)));
final Element rootTag = document.getRootElement();
if (rootTag != null) {
final Element subTag = rootTag.getChild("body");
@@ -616,7 +617,7 @@ public class JavaDocInfoGenerator {
}
}
- private static void generateAnnotations(@NonNls StringBuilder buffer, PsiModifierListOwner owner) {
+ private static void generateAnnotations(@NonNls @NotNull StringBuilder buffer, @NotNull PsiModifierListOwner owner) {
final PsiModifierList ownerModifierList = owner.getModifierList();
if (ownerModifierList == null) return;
PsiAnnotation[] annotations = ownerModifierList.getAnnotations();
@@ -638,8 +639,8 @@ public class JavaDocInfoGenerator {
generateType(buffer, type, owner);
final PsiNameValuePair[] attributes = annotation.getParameterList().getAttributes();
if (attributes.length > 0) {
- boolean first = true;
buffer.append("(");
+ boolean first = true;
for (PsiNameValuePair pair : attributes) {
if (!first) buffer.append(" ");
first = false;
@@ -672,7 +673,7 @@ public class JavaDocInfoGenerator {
buffer.append("");
String modifiers = PsiFormatUtil.formatModifiers(parameter, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
- if (modifiers.length() > 0) {
+ if (!modifiers.isEmpty()) {
buffer.append(modifiers);
buffer.append(" ");
}
@@ -721,10 +722,10 @@ public class JavaDocInfoGenerator {
}
buffer.append("");
- int indent = 0;
generateAnnotations(buffer, method);
String modifiers = PsiFormatUtil.formatModifiers(method, PsiFormatUtilBase.JAVADOC_MODIFIERS_ONLY);
- if (modifiers.length() > 0) {
+ int indent = 0;
+ if (!modifiers.isEmpty()) {
buffer.append(modifiers);
buffer.append(" ");
indent += modifiers.length() + 1;
@@ -732,7 +733,7 @@ public class JavaDocInfoGenerator {
final String typeParamsString = generateTypeParameters(method);
indent += typeParamsString.length();
- if (typeParamsString.length() > 0) {
+ if (!typeParamsString.isEmpty()) {
buffer.append(typeParamsString);
buffer.append(" ");
indent++;
@@ -923,7 +924,7 @@ public class JavaDocInfoGenerator {
String text = description.getText();
if (text != null) {
- if (ourWhitespaces.matcher(text).replaceAll("").length() != 0) {
+ if (!ourWhitespaces.matcher(text).replaceAll("").isEmpty()) {
return false;
}
}
@@ -993,7 +994,7 @@ public class JavaDocInfoGenerator {
}
private String getDocRoot() {
- PsiClass aClass = null;
+ PsiClass aClass;
if (myElement instanceof PsiClass) {
aClass = (PsiClass)myElement;
@@ -1033,10 +1034,7 @@ public class JavaDocInfoGenerator {
if (element instanceof PsiInlineDocTag) {
PsiInlineDocTag tag = (PsiInlineDocTag)element;
final String tagName = tag.getName();
- if (tagName == null) {
- buffer.append(element.getText());
- }
- else if (tagName.equals(LINK_TAG)) {
+ if (tagName.equals(LINK_TAG)) {
generateLinkValue(tag, buffer, false);
}
else if (tagName.equals(LITERAL_TAG)) {
@@ -1091,14 +1089,14 @@ public class JavaDocInfoGenerator {
buffer.append(text);
}
- private void generateLinkValue(PsiInlineDocTag tag, StringBuilder buffer, boolean plainLink) {
+ private static void generateLinkValue(PsiInlineDocTag tag, StringBuilder buffer, boolean plainLink) {
PsiElement[] tagElements = tag.getDataElements();
String text = createLinkText(tagElements);
- if (text.length() > 0) {
+ if (!text.isEmpty()) {
int index = JavaDocUtil.extractReference(text);
String refText = text.substring(0, index).trim();
String label = text.substring(index).trim();
- if (label.length() == 0) {
+ if (label.isEmpty()) {
label = null;
}
generateLink(buffer, refText, label, tagElements[0], plainLink);
@@ -1108,7 +1106,7 @@ public class JavaDocInfoGenerator {
private void generateValueValue(final PsiInlineDocTag tag, final StringBuilder buffer, final PsiElement element) {
String text = createLinkText(tag.getDataElements());
PsiField valueField = null;
- if (text.length() == 0) {
+ if (text.isEmpty()) {
if (myElement instanceof PsiField) valueField = (PsiField) myElement;
}
else {
@@ -1125,7 +1123,7 @@ public class JavaDocInfoGenerator {
}
if (value != null) {
- buffer.append(value.toString());
+ buffer.append(value);
}
else {
buffer.append(element.getText());
@@ -1178,7 +1176,7 @@ public class JavaDocInfoGenerator {
}
@SuppressWarnings({"HardCodedStringLiteral"})
- private void generateSeeAlsoSection(StringBuilder buffer, PsiDocComment comment) {
+ private static void generateSeeAlsoSection(StringBuilder buffer, PsiDocComment comment) {
PsiDocTag[] tags = comment.findTagsByName("see");
if (tags.length > 0) {
buffer.append("");
@@ -1200,7 +1198,7 @@ public class JavaDocInfoGenerator {
int index = JavaDocUtil.extractReference(text);
String refText = text.substring(0, index).trim();
String label = text.substring(index).trim();
- if (label.length() == 0) {
+ if (label.isEmpty()) {
label = null;
}
generateLink(buffer, refText, label, comment, false);
@@ -1231,7 +1229,7 @@ public class JavaDocInfoGenerator {
}
}
- if (collectedTags.size() > 0) {
+ if (!collectedTags.isEmpty()) {
buffer.append("");
buffer.append("- ").append(CodeInsightBundle.message("javadoc.parameters")).append("");
for (Pair> tag : collectedTags) {
@@ -1261,7 +1259,7 @@ public class JavaDocInfoGenerator {
}
private void generateTypeParametersSection(final StringBuilder buffer, final LinkedList>> collectedTags) {
- if (collectedTags.size() > 0) {
+ if (!collectedTags.isEmpty()) {
buffer.append("
");
buffer.append("- ").append(CodeInsightBundle.message("javadoc.type.parameters")).append("");
for (Pair> tag : collectedTags) {
@@ -1347,7 +1345,7 @@ public class JavaDocInfoGenerator {
});
if (pair == null && myElement instanceof PsiMethod) {
- pair = findInheritDocTag(((PsiMethod)myElement), new ReturnTagLocator());
+ pair = findInheritDocTag((PsiMethod)myElement, new ReturnTagLocator());
}
if (pair != null) {
@@ -1451,7 +1449,7 @@ public class JavaDocInfoGenerator {
}
}
- if (collectedTags.size() > 0) {
+ if (!collectedTags.isEmpty()) {
buffer.append("
");
buffer.append("- ").append(CodeInsightBundle.message("javadoc.throws")).append("");
for (Pair> tag : collectedTags) {
@@ -1463,7 +1461,7 @@ public class JavaDocInfoGenerator {
String refText = text.substring(0, index).trim();
generateLink(buffer, refText, null, method, false);
String rest = text.substring(index);
- if (rest.length() > 0 || elements.length > 1) buffer.append(" - ");
+ if (!rest.isEmpty() || elements.length > 1) buffer.append(" - ");
buffer.append(rest);
generateValue(buffer, elements, 1, mapProvider(tag.second, true));
}
@@ -1472,7 +1470,7 @@ public class JavaDocInfoGenerator {
}
@SuppressWarnings({"HardCodedStringLiteral"})
- private void generateSuperMethodsSection(StringBuilder buffer, PsiMethod method, boolean overrides) {
+ private static void generateSuperMethodsSection(StringBuilder buffer, PsiMethod method, boolean overrides) {
PsiClass parentClass = method.getContainingClass();
if (parentClass == null) return;
if (parentClass.isInterface() && !overrides) return;
@@ -1571,7 +1569,7 @@ public class JavaDocInfoGenerator {
if (type instanceof PsiArrayType) {
int rest = generateType(buffer, ((PsiArrayType)type).getComponentType(), context, generateLink);
- if ((type instanceof PsiEllipsisType)) {
+ if (type instanceof PsiEllipsisType) {
buffer.append("...");
return rest + 3;
}
@@ -1586,7 +1584,7 @@ public class JavaDocInfoGenerator {
}
if (type instanceof PsiWildcardType){
- PsiWildcardType wt = ((PsiWildcardType)type);
+ PsiWildcardType wt = (PsiWildcardType)type;
buffer.append("?");
@@ -1631,11 +1629,11 @@ public class JavaDocInfoGenerator {
if (psiClass.hasTypeParameters()) {
StringBuilder subst = new StringBuilder();
- boolean goodSubst = true;
PsiTypeParameter[] params = psiClass.getTypeParameters();
subst.append("<");
+ boolean goodSubst = true;
for (int i = 0; i < params.length; i++) {
PsiType t = psiSubst.substitute(params[i]);
@@ -1669,7 +1667,6 @@ public class JavaDocInfoGenerator {
return text.length();
}
else {
- int length = 0;
final String separator = type instanceof PsiDisjunctionType ? " | " : " & ";
final List componentTypes;
if (type instanceof PsiIntersectionType) {
@@ -1678,6 +1675,7 @@ public class JavaDocInfoGenerator {
else {
componentTypes = ((PsiDisjunctionType)type).getDisjunctions();
}
+ int length = 0;
for (PsiType psiType : componentTypes) {
if (length > 0) {
buffer.append(separator);
@@ -1693,7 +1691,7 @@ public class JavaDocInfoGenerator {
}
@SuppressWarnings({"HardCodedStringLiteral"})
- private String generateTypeParameters(PsiTypeParameterListOwner owner) {
+ private static String generateTypeParameters(PsiTypeParameterListOwner owner) {
if (owner.hasTypeParameters()) {
PsiTypeParameter[] parms = owner.getTypeParameters();
@@ -1765,15 +1763,14 @@ public class JavaDocInfoGenerator {
}
@Nullable
- private PsiMethod findMethodInSuperClass(PsiMethod method, PsiClass aSuper) {
- PsiMethod overriden = null;
+ private static PsiMethod findMethodInSuperClass(PsiMethod method, PsiClass aSuper) {
for (PsiMethod superMethod : method.findDeepestSuperMethods()) {
- overriden = aSuper.findMethodBySignature(superMethod, false);
+ PsiMethod overriden = aSuper.findMethodBySignature(superMethod, false);
if (overriden != null) {
return overriden;
}
}
- return overriden;
+ return null;
}
@Nullable private Pair> searchDocTagInSupers(PsiClassType[] supers,
diff --git a/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.java b/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.java
index 6200d6d97d4c..21b61512b0a0 100644
--- a/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.java
+++ b/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.java
@@ -31,6 +31,7 @@ public class CoreJavaPsiImplementationHelper extends JavaPsiImplementationHelper
return psiClass;
}
+ @NotNull
@Override
public PsiElement getClsFileNavigationElement(PsiJavaFile clsFile) {
return clsFile;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java b/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java
index b506621f6ba0..6a677a902469 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java
@@ -34,6 +34,7 @@ public abstract class JavaPsiImplementationHelper {
public abstract PsiClass getOriginalClass(PsiClass psiClass);
+ @NotNull
public abstract PsiElement getClsFileNavigationElement(PsiJavaFile clsFile);
/**
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
index b35a97e201ae..1c7e013faa22 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.progress.NonCancelableSection;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
+import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.java.LanguageLevel;
@@ -44,12 +45,15 @@ import com.intellij.psi.impl.source.tree.JavaElementType;
import com.intellij.psi.impl.source.tree.TreeElement;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.stubs.*;
+import com.intellij.psi.util.CachedValueProvider;
+import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiUtil;
import com.intellij.reference.SoftReference;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
@@ -263,6 +267,21 @@ public class ClsFileImpl extends ClsRepositoryPsiElement
@Override
@NotNull
public PsiElement getNavigationElement() {
+ return CachedValuesManager.getCachedValue(this, new CachedValueProvider() {
+ @Nullable
+ @Override
+ public Result compute() {
+ PsiElement target = calcNavigationElement();
+ return Result.create(target,
+ ClsFileImpl.this,
+ target.getContainingFile(),
+ FileIndexFacade.getInstance(getProject()).getRootModificationTracker());
+ }
+ });
+ }
+
+ @NotNull
+ private PsiElement calcNavigationElement() {
for (ClsCustomNavigationPolicy customNavigationPolicy : Extensions.getExtensions(ClsCustomNavigationPolicy.EP_NAME)) {
if (customNavigationPolicy instanceof ClsCustomNavigationPolicyEx) {
PsiFile navigationElement = ((ClsCustomNavigationPolicyEx)customNavigationPolicy).getFileNavigationElement(this);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java
index d1e9ff6ed01d..83418ec617b6 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsMethodImpl.java
@@ -18,6 +18,7 @@ package com.intellij.psi.impl.compiled;
import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.AtomicNotNullLazyValue;
import com.intellij.openapi.util.NotNullLazyValue;
import com.intellij.openapi.util.text.StringUtil;
@@ -34,9 +35,7 @@ import com.intellij.psi.impl.source.tree.TreeElement;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.scope.util.PsiScopesUtil;
import com.intellij.psi.search.SearchScope;
-import com.intellij.psi.util.MethodSignature;
-import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
-import com.intellij.psi.util.MethodSignatureUtil;
+import com.intellij.psi.util.*;
import com.intellij.ui.RowIcon;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
@@ -280,6 +279,20 @@ public class ClsMethodImpl extends ClsMemberImpl implements PsiAn
@Nullable
public PsiMethod getSourceMirrorMethod() {
+ return CachedValuesManager.getCachedValue(this, new CachedValueProvider() {
+ @Nullable
+ @Override
+ public Result compute() {
+ return Result.create(calcSourceMirrorMethod(),
+ getContainingFile(),
+ getContainingFile().getNavigationElement(),
+ FileIndexFacade.getInstance(getProject()).getRootModificationTracker());
+ }
+ });
+ }
+
+ @Nullable
+ private PsiMethod calcSourceMirrorMethod() {
PsiClass sourceClassMirror = ((ClsClassImpl)getParent()).getSourceMirrorClass();
if (sourceClassMirror == null) return null;
for (PsiMethod sourceMethod : sourceClassMirror.findMethodsByName(getName(), false)) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/FunctionalInterfaceParameterizationUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/FunctionalInterfaceParameterizationUtil.java
index 86c1f5f90f2e..54a1d1c26598 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/FunctionalInterfaceParameterizationUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/FunctionalInterfaceParameterizationUtil.java
@@ -84,6 +84,9 @@ public class FunctionalInterfaceParameterizationUtil {
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(psiClass.getProject());
final PsiParameter[] targetMethodParams = interfaceMethod.getParameterList().getParameters();
+ if (targetMethodParams.length != lambdaParams.length) {
+ return null;
+ }
for (int i = 0; i < targetMethodParams.length; i++) {
if (resolve) {
session.addConstraint(new TypeEqualityConstraint(lambdaParams[i].getType(), targetMethodParams[i].getType()));
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterForInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterForInitializer.java
new file mode 100644
index 000000000000..7e66580d250b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterForInitializer.java
@@ -0,0 +1,8 @@
+// "Assert 'container != null'" "true"
+class A{
+ void test(){
+ Integer container = null;
+ assert container != null;
+ for (int i = 0, limit = container.intValue(); i < limit; i++){}
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeForInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeForInitializer.java
new file mode 100644
index 000000000000..d2514ec3d55d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeForInitializer.java
@@ -0,0 +1,7 @@
+// "Assert 'container != null'" "true"
+class A{
+ void test(){
+ Integer container = null;
+ for (int i = 0, limit = container.intValue(); i < limit; i++){}
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var03-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var03-out.java
new file mode 100644
index 000000000000..7bd5541628df
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var03-out.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(Object o) {
+ Foo foo = new Foo() {
+ };
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var03.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var03.java
new file mode 100644
index 000000000000..8eb3580cda07
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var03.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ new Foo() { }.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var04-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var04-out.java
new file mode 100644
index 000000000000..8f1a8f394ae8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var04-out.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ int foo = 2 + 2;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var04.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var04.java
new file mode 100644
index 000000000000..45eff860e9e7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var04.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ 2 + 2.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var05-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var05-out.java
new file mode 100644
index 000000000000..d2e6b0f64a2a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var05-out.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ Foo foo = new Foo();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var05.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var05.java
new file mode 100644
index 000000000000..62d6ecab9362
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var05.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ Foo.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var06-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var06-out.java
new file mode 100644
index 000000000000..95b99fcf0b84
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var06-out.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ unresolved.var
+
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var06.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var06.java
new file mode 100644
index 000000000000..a3fcd98b8f21
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var06.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ unresolved.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var07-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var07-out.java
new file mode 100644
index 000000000000..a38c5292caf1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var07-out.java
@@ -0,0 +1,7 @@
+public class Foo {
+ Foo m() {
+ Foo foo = m().m();
+ foo.m();
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var07.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var07.java
new file mode 100644
index 000000000000..b56ec1a69d66
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var07.java
@@ -0,0 +1,6 @@
+public class Foo {
+ Foo m() {
+ m().m()..m();
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var08-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var08-out.java
new file mode 100644
index 000000000000..3cface4f2d89
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var08-out.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ boolean foo = true && false;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var08.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var08.java
new file mode 100644
index 000000000000..71127de628da
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var08.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ true && false.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var09-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var09-out.java
new file mode 100644
index 000000000000..1a4afb63036d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var09-out.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(boolean b) {
+ boolean foo = b && false;
+ m(foo);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var09.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var09.java
new file mode 100644
index 000000000000..1f5a880664d6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var09.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(boolean b) {
+ m(b && false.);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var10-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var10-out.java
new file mode 100644
index 000000000000..ce3f0e38f0c2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var10-out.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ Foo foo = new Foo();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var10.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var10.java
new file mode 100644
index 000000000000..9553064d31eb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var10.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ Foo.;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var11-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var11-out.java
new file mode 100644
index 000000000000..3e4614cb4774
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var11-out.java
@@ -0,0 +1,8 @@
+public class Foo {
+ Foo f;
+ Foo m() {
+ Foo foo = m().m().f;
+ m();
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var11.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var11.java
new file mode 100644
index 000000000000..6d7ad15116fd
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var11.java
@@ -0,0 +1,7 @@
+public class Foo {
+ Foo f;
+ Foo m() {
+ m().m().f.m();
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var12-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var12-out.java
new file mode 100644
index 000000000000..9c9f813bdc26
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var12-out.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ int foo = 1;
+ foo + 2 /* comment */; // comment2
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var12.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var12.java
new file mode 100644
index 000000000000..546614bb8a59
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var12.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ 1. + 2 /* comment */; // comment2
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var13-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var13-out.java
new file mode 100644
index 000000000000..9fc4195c6369
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var13-out.java
@@ -0,0 +1,8 @@
+public class Foo {
+ Foo f;
+ Foo m() {
+ Foo foo = m().m().f;
+ blah();
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var13.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var13.java
new file mode 100644
index 000000000000..8954cf3ca055
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var13.java
@@ -0,0 +1,7 @@
+public class Foo {
+ Foo f;
+ Foo m() {
+ m().m().f.vblah();
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var14-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var14-out.java
new file mode 100644
index 000000000000..7386b3970e49
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var14-out.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ int foo = 1;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var14.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var14.java
new file mode 100644
index 000000000000..ac94b79744ef
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var14.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ 1.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var15-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var15-out.java
new file mode 100644
index 000000000000..8b3d7ad17d1a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var15-out.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ int foo = 2 * 2;
+ foo + 2 * 2; /* boo */
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var15.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var15.java
new file mode 100644
index 000000000000..6f545aec3771
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var15.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ 2 * 2. + 2 * 2; /* boo */
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var16-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var16-out.java
new file mode 100644
index 000000000000..0be974758a61
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var16-out.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ int foo = 2;
+ int i = foo + 2 /**/ ;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var16.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var16.java
new file mode 100644
index 000000000000..7139f9cafec8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var16.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ int i = 2. + 2 /**/ ;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var17-out.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var17-out.java
new file mode 100644
index 000000000000..ba8032892b19
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var17-out.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ int foo = 2 + 3;
+ int i = foo * 4; // blah
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var17.java b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var17.java
new file mode 100644
index 000000000000..71fa61e0285a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/backlog/var/var17.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m() {
+ int i = 2 + 3. * 4; // blah
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowDisabledTemplate.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowDisabledTemplate.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowDisabledTemplate.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateIfPluginIsDisabled.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateIfPluginIsDisabled.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateIfPluginIsDisabled.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateIfTemplateCompletionIsDisabled.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateIfTemplateCompletionIsDisabled.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateIfTemplateCompletionIsDisabled.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateInInappropriateContext.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateInInappropriateContext.java
new file mode 100644
index 000000000000..fc346a6978a6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateInInappropriateContext.java
@@ -0,0 +1 @@
+package com.
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateOnCompletion.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateOnCompletion.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateOnCompletion.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithEnter.java b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithEnter.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithEnter.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithEnter_after.java b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithEnter_after.java
new file mode 100644
index 000000000000..eef0e3ac938d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithEnter_after.java
@@ -0,0 +1,8 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().par
+
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithTab.java b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithTab.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithTab.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithTab_after.java b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithTab_after.java
new file mode 100644
index 000000000000..8214c33f3973
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/quickTypingWithTab_after.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ (new Object())
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/recalculatePrefix.java b/java/java-tests/testData/codeInsight/template/postfix/completion/recalculatePrefix.java
new file mode 100644
index 000000000000..3748a11bca0e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/recalculatePrefix.java
@@ -0,0 +1,9 @@
+public class Foo {
+ void m() {
+ new MyClass().
+ }
+
+ private class MyClass {
+ public void parents() {}
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByEnter.java b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByEnter.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByEnter.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByEnter_after.java b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByEnter_after.java
new file mode 100644
index 000000000000..8214c33f3973
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByEnter_after.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ (new Object())
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByTab.java b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByTab.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByTab.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByTab_after.java b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByTab_after.java
new file mode 100644
index 000000000000..8214c33f3973
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/selectTemplateByTab_after.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ (new Object())
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/showTemplateInAutoPopup.java b/java/java-tests/testData/codeInsight/template/postfix/completion/showTemplateInAutoPopup.java
new file mode 100644
index 000000000000..c238b76993ec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/showTemplateInAutoPopup.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ new Object().
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/showTemplateOnDoubleLiteral.java b/java/java-tests/testData/codeInsight/template/postfix/completion/showTemplateOnDoubleLiteral.java
new file mode 100644
index 000000000000..7528615f6889
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/showTemplateOnDoubleLiteral.java
@@ -0,0 +1,7 @@
+import java.lang.Object;
+
+public class Foo {
+ void m() {
+ 1.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/booleanVariableBeforeAssignment.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/booleanVariableBeforeAssignment.java
new file mode 100644
index 000000000000..8bb04c341b77
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/booleanVariableBeforeAssignment.java
@@ -0,0 +1,8 @@
+package templates;
+
+public class Foo {
+ void m(boolean b, int value) {
+ b.assert
+ value = 123;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/booleanVariableBeforeAssignment_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/booleanVariableBeforeAssignment_after.java
new file mode 100644
index 000000000000..59021298b8a0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/booleanVariableBeforeAssignment_after.java
@@ -0,0 +1,8 @@
+package templates;
+
+public class Foo {
+ void m(boolean b, int value) {
+ assert b;
+ value = 123;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/boxedBooleanVariable.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/boxedBooleanVariable.java
new file mode 100644
index 000000000000..e1ff34e838f6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/boxedBooleanVariable.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(Boolean x) {
+ x.assert
+ return;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/boxedBooleanVariable_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/boxedBooleanVariable_after.java
new file mode 100644
index 000000000000..e79a288ea34e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/boxedBooleanVariable_after.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(Boolean x) {
+ assert x;
+ return;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceof.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceof.java
new file mode 100644
index 000000000000..c77bf98a2ac8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceof.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(Object o) {
+ o instanceof String.assert
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceofBeforeReturnStatement.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceofBeforeReturnStatement.java
new file mode 100644
index 000000000000..fc6fc9f3b90c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceofBeforeReturnStatement.java
@@ -0,0 +1,10 @@
+package templates;
+
+public class Foo {
+ boolean m(Object o) {
+ if (o instanceof T1) return true;
+ o instanceof T2.assert
+
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceofBeforeReturnStatement_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceofBeforeReturnStatement_after.java
new file mode 100644
index 000000000000..3f774e4ab6bd
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceofBeforeReturnStatement_after.java
@@ -0,0 +1,10 @@
+package templates;
+
+public class Foo {
+ boolean m(Object o) {
+ if (o instanceof T1) return true;
+ assert o instanceof T2;
+
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceof_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceof_after.java
new file mode 100644
index 000000000000..ddc453044933
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/instanceof_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(Object o) {
+ assert o instanceof String;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/integerComparison.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/integerComparison.java
new file mode 100644
index 000000000000..1076f05b3e62
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/integerComparison.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(boolean[] xs) {
+ xs.length > 0.assert
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/integerComparison_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/integerComparison_after.java
new file mode 100644
index 000000000000..bd9c38a8ca59
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/integerComparison_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(boolean[] xs) {
+ assert xs.length > 0;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/methodInvocation.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/methodInvocation.java
new file mode 100644
index 000000000000..6ff5cffb4e32
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/methodInvocation.java
@@ -0,0 +1,11 @@
+package templates;
+
+public class Foo {
+ void m() {
+ bar().assert
+ }
+
+ boolean bar() {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/methodInvocation_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/methodInvocation_after.java
new file mode 100644
index 000000000000..b23fa937591b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/methodInvocation_after.java
@@ -0,0 +1,11 @@
+package templates;
+
+public class Foo {
+ void m() {
+ assert bar();
+ }
+
+ boolean bar() {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notBooleanExpression.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notBooleanExpression.java
new file mode 100644
index 000000000000..4a9880c97719
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notBooleanExpression.java
@@ -0,0 +1,8 @@
+package templates;
+
+public class Foo {
+ void m(String b, int value) {
+ b.assert
+ value = 123;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notBooleanExpression_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notBooleanExpression_after.java
new file mode 100644
index 000000000000..4c7902ddbf9b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notBooleanExpression_after.java
@@ -0,0 +1,8 @@
+package templates;
+
+public class Foo {
+ void m(String b, int value) {
+ b.assert
+ value = 123;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notNull.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notNull.java
new file mode 100644
index 000000000000..66e79c1bb469
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notNull.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(Object arg) {
+ arg != null.assert
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notNull_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notNull_after.java
new file mode 100644
index 000000000000..046c21797c82
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/notNull_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(Object arg) {
+ assert arg != null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/severalConditions.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/severalConditions.java
new file mode 100644
index 000000000000..628a35ef2eda
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/severalConditions.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(String s) {
+ s.isEmpty() || s.contains("asas").assert
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/severalConditions_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/severalConditions_after.java
new file mode 100644
index 000000000000..0a417ac7ef26
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/severalConditions_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+ void m(String s) {
+ assert s.isEmpty() || s.contains("asas");
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/unresolvedVariable.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/unresolvedVariable.java
new file mode 100644
index 000000000000..4e9a97297454
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/unresolvedVariable.java
@@ -0,0 +1,8 @@
+package templates;
+
+public class Foo {
+ void m(int value) {
+ b.assert
+ value = 123;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/unresolvedVariable_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/unresolvedVariable_after.java
new file mode 100644
index 000000000000..01d7478a5ddb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/unresolvedVariable_after.java
@@ -0,0 +1,8 @@
+package templates;
+
+public class Foo {
+ void m(int value) {
+ b.assert
+ value = 123;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleExpression.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleExpression.java
new file mode 100644
index 000000000000..716038ea290f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleExpression.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ o.cast
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleExpression_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleExpression_after.java
new file mode 100644
index 000000000000..3b12c849cfed
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleExpression_after.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ (() o)
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/voidExpression.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/voidExpression.java
new file mode 100644
index 000000000000..dba857507b2a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/voidExpression.java
@@ -0,0 +1,7 @@
+public class Foo {
+ void m(Object o) {
+ bar().cast
+ }
+
+ void bar() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/voidExpression_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/voidExpression_after.java
new file mode 100644
index 000000000000..a7dc81786af8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/voidExpression_after.java
@@ -0,0 +1,7 @@
+public class Foo {
+ void m(Object o) {
+ bar().cast
+ }
+
+ void bar() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperations.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperations.java
new file mode 100644
index 000000000000..87e7234acdd5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperations.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(boolean x, boolean y, boolean z) {
+ x & y && z || x ^ y.else
+ foo();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperationsWithMethod.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperationsWithMethod.java
new file mode 100644
index 000000000000..176dcc864798
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperationsWithMethod.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(boolean x, boolean y, boolean z) {
+ foo() & y & z.else
+ Type t = new Type();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperationsWithMethod_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperationsWithMethod_after.java
new file mode 100644
index 000000000000..eee82eca9615
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperationsWithMethod_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m(boolean x, boolean y, boolean z) {
+ if (!(foo() & y & z)) {
+
+ }
+ Type t = new Type();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperations_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperations_after.java
new file mode 100644
index 000000000000..050ff1354669
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/bitOperations_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m(boolean x, boolean y, boolean z) {
+ if ((!(x & y) || !z) && !(x ^ y)) {
+
+ }
+ foo();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/booleanVariable.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/booleanVariable.java
new file mode 100644
index 000000000000..21053e63bdb1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/booleanVariable.java
@@ -0,0 +1,8 @@
+package templates.
+
+public class Foo {
+ void m(boolean x) {
+ x.else
+ value = dummyAssignment;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/booleanVariable_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/booleanVariable_after.java
new file mode 100644
index 000000000000..370b905bc63b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/booleanVariable_after.java
@@ -0,0 +1,10 @@
+package templates.
+
+public class Foo {
+ void m(boolean x) {
+ if (!x) {
+
+ }
+ value = dummyAssignment;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/boxedBooleanVariable.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/boxedBooleanVariable.java
new file mode 100644
index 000000000000..08d11500f2a0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/boxedBooleanVariable.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(Boolean x) {
+ x.else
+ return;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/boxedBooleanVariable_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/boxedBooleanVariable_after.java
new file mode 100644
index 000000000000..11c74ed020e1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/boxedBooleanVariable_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m(Boolean x) {
+ if (!x) {
+
+ }
+ return;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/instanceof.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/instanceof.java
new file mode 100644
index 000000000000..94c43ed49328
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/instanceof.java
@@ -0,0 +1,7 @@
+package completion;
+
+public class Foo {
+ void m(Object o) {
+ o instanceof String.else
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/instanceof_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/instanceof_after.java
new file mode 100644
index 000000000000..b72d0d0d8a7b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/instanceof_after.java
@@ -0,0 +1,9 @@
+package completion;
+
+public class Foo {
+ void m(Object o) {
+ if (!(o instanceof String)) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/integerComparison.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/integerComparison.java
new file mode 100644
index 000000000000..7434a8654092
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/integerComparison.java
@@ -0,0 +1,6 @@
+public class Foo {
+ Foo[] xs;
+ void m() {
+ xs.length == 0.else
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/integerComparison_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/integerComparison_after.java
new file mode 100644
index 000000000000..7c3c5ef365d9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/integerComparison_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ Foo[] xs;
+ void m() {
+ if (xs.length != 0) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/logicalOperations.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/logicalOperations.java
new file mode 100644
index 000000000000..d7cc4fc6fbfb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/logicalOperations.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m(boolean x, boolean y, boolean z) {
+ x && y && z.else
+ value = dummyAssignment;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/logicalOperations_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/logicalOperations_after.java
new file mode 100644
index 000000000000..3ea543f2aded
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/logicalOperations_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m(boolean x, boolean y, boolean z) {
+ if (!x || !y || !z) {
+
+ }
+ value = dummyAssignment;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/notNull.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/notNull.java
new file mode 100644
index 000000000000..2d4f9b706ce9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/notNull.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ o != null.else
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/notNull_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/notNull_after.java
new file mode 100644
index 000000000000..68bc4d648b67
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/notNull_after.java
@@ -0,0 +1,7 @@
+public class Foo {
+ void m(Object o) {
+ if (o == null) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/unresolvedVariable.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/unresolvedVariable.java
new file mode 100644
index 000000000000..e86f073ad151
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/unresolvedVariable.java
@@ -0,0 +1,8 @@
+package templates.
+
+public class Foo {
+ void m() {
+ x.else
+ value = dummyAssignment;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/else/unresolvedVariable_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/else/unresolvedVariable_after.java
new file mode 100644
index 000000000000..90af0e2e935a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/else/unresolvedVariable_after.java
@@ -0,0 +1,8 @@
+package templates.
+
+public class Foo {
+ void m() {
+ x.else
+ value = dummyAssignment;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/field/foo.java b/java/java-tests/testData/codeInsight/template/postfix/templates/field/foo.java
new file mode 100644
index 000000000000..16e74b84c0f1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/field/foo.java
@@ -0,0 +1,5 @@
+public class Foo {
+ public void bar(Foo arg) {
+ arg.field
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/field/foo_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/field/foo_after.java
new file mode 100644
index 000000000000..ca78b61b47f1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/field/foo_after.java
@@ -0,0 +1,7 @@
+public class Foo {
+ private Foo foo;
+
+ public void bar(Foo arg) {
+ foo = arg;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/field/simple.java b/java/java-tests/testData/codeInsight/template/postfix/templates/field/simple.java
new file mode 100644
index 000000000000..9dd7acecffcd
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/field/simple.java
@@ -0,0 +1,5 @@
+public class Foo {
+ public Foo(int arg) {
+ arg.field
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/field/simple_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/field/simple_after.java
new file mode 100644
index 000000000000..5a9937370637
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/field/simple_after.java
@@ -0,0 +1,7 @@
+public class Foo {
+ private int foo;
+
+ public Foo(int arg) {
+ foo = arg;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/for/ints.java b/java/java-tests/testData/codeInsight/template/postfix/templates/for/ints.java
new file mode 100644
index 000000000000..4516e7923856
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/for/ints.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ int[] xs = {1, 2, 3};
+ xs.for
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/for/ints_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/for/ints_after.java
new file mode 100644
index 000000000000..de1f9ba9b447
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/for/ints_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m() {
+ int[] xs = {1, 2, 3};
+ for (int x : xs) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedByteNumber.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedByteNumber.java
new file mode 100644
index 000000000000..4e19541bcdc5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedByteNumber.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ Byte foo = 100;
+ foo.fori
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedByteNumber_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedByteNumber_after.java
new file mode 100644
index 000000000000..7957666d5535
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedByteNumber_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m() {
+ Byte foo = 100;
+ for (Byte i = 0; i < foo; i++) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedIntegerArray.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedIntegerArray.java
new file mode 100644
index 000000000000..de054bb6f260
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedIntegerArray.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ Integer[] xs = {1, 2, 3};
+ xs.fori
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedIntegerArray_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedIntegerArray_after.java
new file mode 100644
index 000000000000..ef1bb9709410
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedIntegerArray_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m() {
+ Integer[] xs = {1, 2, 3};
+ for (int i = 0; i < xs.length; i++) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedLongArray.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedLongArray.java
new file mode 100644
index 000000000000..78789d3d418e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedLongArray.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ Long[] xs = {1, 2, 3};
+ xs.fori
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedLongArray_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedLongArray_after.java
new file mode 100644
index 000000000000..fb7da6aeee5d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/boxedLongArray_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m() {
+ Long[] xs = {1, 2, 3};
+ for (int i = 0; i < xs.length; i++) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/byteNumber.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/byteNumber.java
new file mode 100644
index 000000000000..82457570009f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/byteNumber.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ byte foo = 100;
+ foo.fori
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/byteNumber_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/byteNumber_after.java
new file mode 100644
index 000000000000..db5a610d811f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/byteNumber_after.java
@@ -0,0 +1,8 @@
+public class Foo {
+ void m() {
+ byte foo = 100;
+ for (byte i = 0; i < foo; i++) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/collection.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/collection.java
new file mode 100644
index 000000000000..8a7dcefd43fb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/collection.java
@@ -0,0 +1,7 @@
+import java.util.ArrayList;
+
+public class Foo {
+ void m() {
+ new ArrayList().fori
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/collection_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/collection_after.java
new file mode 100644
index 000000000000..a25108f712f9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/collection_after.java
@@ -0,0 +1,9 @@
+import java.util.ArrayList;
+
+public class Foo {
+ void m() {
+ for (int i = 0; i < new ArrayList().size(); i++) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/fori/intArray.java b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/intArray.java
new file mode 100644
index 000000000000..9811f72d8b6e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/fori/intArray.java
@@ -0,0 +1,6 @@
+public class Foo {
+ void m() {
+ int[] xs = {1, 2, 3};
+ xs.fori