diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java index 2c8100955bf6..b161cbec1885 100644 --- a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java +++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java @@ -38,7 +38,7 @@ public class ApplicationRunLineMarkerProvider implements LineMarkerProvider { public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) { if (element instanceof PsiClass && PsiMethodUtil.findMainInClass((PsiClass)element) != null) return new RunLineMarkerInfo(element, ApplicationConfigurationType.getInstance().getIcon(), null); - if (element instanceof PsiMethod && PsiMethodUtil.isMainMethod((PsiMethod)element)) + if (element instanceof PsiMethod && "main".equals(((PsiMethod)element).getName()) && PsiMethodUtil.isMainMethod((PsiMethod)element)) return new RunLineMarkerInfo(element, ApplicationConfigurationType.getInstance().getIcon(), null); return null; } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java new file mode 100644 index 000000000000..4b33b4623503 --- /dev/null +++ b/java/java-tests/testSrc/com/intellij/codeInsight/navigation/RunLineMarkerTest.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.codeInsight.navigation; + +import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; + +/** + * @author Dmitry Avdeev + */ +public class RunLineMarkerTest extends LightCodeInsightFixtureTestCase { + + public void testRunLineMarker() throws Exception { + myFixture.configureByText("MainTest.java", "public class MainTest {\n" + + " public static void foo(String[] args) {\n" + + " }\n " + + " public static void main(String[] args) {\n" + + " }\n" + + "}"); + assertEquals(0, myFixture.findGuttersAtCaret().size()); + assertEquals(2, myFixture.findAllGutters().size()); + } +}