resolve conflicting names (IDEA-119412)

This commit is contained in:
Anna Kozlova
2014-01-21 18:22:42 +04:00
parent 9cc6ad8c00
commit aaa813a877
3 changed files with 12 additions and 1 deletions
@@ -720,7 +720,7 @@ public class PsiClassImpl extends JavaStubPsiElement<PsiClassStub<?>> implements
PsiMethod method = myValueOfMethod;
if (method == null && isEnum() && getName() != null) {
PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + " valueOf(String name) throws IllegalArgumentException {}", this);
final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + " valueOf(String name) throws java.lang.IllegalArgumentException {}", this);
myValueOfMethod = method = new LightMethod(getManager(), valuesMethod, this);
}
return method;
@@ -0,0 +1,10 @@
enum SomeEnumeration {
A;
public static SomeEnumeration fromValue(String v) {
return valueOf(v);
}
}
public class IllegalArgumentException extends Exception {}
@@ -59,4 +59,5 @@ public class LightAdvHighlightingJdk6Test extends LightDaemonAnalyzerTestCase {
public void testRedundantCastInConditionalExpression() throws Exception { setLanguageLevel(LanguageLevel.JDK_1_6); doTest(true, false); }
public void testJava5CastConventions() { setLanguageLevel(LanguageLevel.JDK_1_5); doTest(true, false); }
public void testUnhandledExceptions() { doTest(true, false); }
public void testUnhandledExceptionsValueOf() { doTest(true, false); }
}