live templates: incorrect adding generic parameter IDEA-134434

This commit is contained in:
Andrey Starovoyt
2014-12-23 18:18:43 +03:00
parent 74eaf5419f
commit b20fc1c936
9 changed files with 108 additions and 21 deletions
@@ -0,0 +1,15 @@
// "Create method 'f'" "true"
public class CreateMethodTest {
public <T> void aMethod(final T t) {
class Nested {
public T call() {
T result = f(t);
return result;
}
private T f(T t) {
<selection>return null;</selection>
}
}
}
}
@@ -0,0 +1,11 @@
// "Create method 'f'" "true"
public class CreateMethodTest {
public <T> void aMethod(final T t) {
class Nested {
public T call() {
T result = f<caret>(t);
return result;
}
}
}
}
@@ -0,0 +1,13 @@
import java.util.List;
class Foo {
<T> void method1(final T[] val) {
class Inner {
void method2() {
for (T t : <selection>val</selection><caret>) {
}
}
}
}
}
@@ -0,0 +1,11 @@
import java.util.List;
class Foo {
<T> void method1(final T[] val) {
class Inner {
void method2() {
<caret>
}
}
}
}
@@ -0,0 +1,10 @@
class Example {
<T> void test(T[] foo) {
new Runnable() {
@Override
public void run() {
foo.for<caret>
}
};
}
}
@@ -0,0 +1,12 @@
class Example {
<T> void test(T[] foo) {
new Runnable() {
@Override
public void run() {
for (T t : foo) {
<caret>
}
}
};
}
}
@@ -385,6 +385,13 @@ class Foo {
checkResult();
}
public void testIterParameterizedInnerInMethod() {
configure();
startTemplate("iter", "iterations")
stripTrailingSpaces();
checkResult();
}
public void testAsListToar() {
configure();
startTemplate("toar", "other")
@@ -955,6 +962,4 @@ class Foo {
}
""")
}
}
@@ -34,6 +34,10 @@ public class ForeachTemplateTest extends PostfixTemplateTestCase {
doTest();
}
public void testInAnonymousRunnable() {
doTest();
}
public void testFinalLocals() {
CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
boolean oldGenerateFinalLocals = settings.GENERATE_FINAL_LOCALS;