From 995261dba6102b984777981f246b6cab9b7ebb44 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 3 Feb 2010 17:43:35 +0000 Subject: [PATCH] returns without value aren't returning a value; ignored allocation result false positive (IDEA-51880) --- .../GroovyResultOfArrayAllocationIgnored.html | 8 -- .../GroovyInspectionProvider.java | 1 - ...ultOfArrayAllocationIgnoredInspection.java | 88 ------------------- ...ltOfObjectAllocationIgnoredInspection.java | 31 +++---- .../MissingReturnInspection.java | 4 +- .../groovy/lang/GroovyHighlightingTest.java | 37 ++++---- .../groovy/lang/MissingReturnTest.java | 42 +++++++++ .../SingleAllocationInClosure.groovy | 3 + .../MissingReturnFromClosure.groovy | 0 .../MissingReturnImplicitReturns.groovy | 0 .../MissingReturnLastNull.groovy | 0 .../MissingReturnOvertReturnType.groovy | 0 .../MissingReturnThrowException.groovy | 0 .../MissingReturnTryCatch.groovy | 0 .../MissingReturnWithAssertion.groovy | 0 .../MissingReturnWithIf.groovy | 0 .../MissingReturnWithLastLoop.groovy | 0 .../MissingReturnWithUnknownCall.groovy | 0 .../missingReturn/ReturnsWithoutValue.groovy | 5 ++ 19 files changed, 78 insertions(+), 141 deletions(-) delete mode 100644 plugins/groovy/resources/inspectionDescriptions/GroovyResultOfArrayAllocationIgnored.html delete mode 100644 plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfArrayAllocationIgnoredInspection.java create mode 100644 plugins/groovy/test/org/jetbrains/plugins/groovy/lang/MissingReturnTest.java create mode 100644 plugins/groovy/testdata/highlighting/SingleAllocationInClosure.groovy rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnFromClosure.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnImplicitReturns.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnLastNull.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnOvertReturnType.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnThrowException.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnTryCatch.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnWithAssertion.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnWithIf.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnWithLastLoop.groovy (100%) rename plugins/groovy/testdata/highlighting/{ => missingReturn}/MissingReturnWithUnknownCall.groovy (100%) create mode 100644 plugins/groovy/testdata/highlighting/missingReturn/ReturnsWithoutValue.groovy diff --git a/plugins/groovy/resources/inspectionDescriptions/GroovyResultOfArrayAllocationIgnored.html b/plugins/groovy/resources/inspectionDescriptions/GroovyResultOfArrayAllocationIgnored.html deleted file mode 100644 index e7c96f8a8870..000000000000 --- a/plugins/groovy/resources/inspectionDescriptions/GroovyResultOfArrayAllocationIgnored.html +++ /dev/null @@ -1,8 +0,0 @@ - -
- -This inspection reports any instances of Groovy array allocation where the array allocated ignored. -Such allocation expressions are legal Groovy, but are usually either inadvertant, or -evidence of a very odd object initialization strategy. -
Powered by InspectorGroovy
- diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionProvider.java index 13a92bf7135b..0ec9cb19965e 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionProvider.java @@ -133,7 +133,6 @@ public class GroovyInspectionProvider implements InspectionToolProvider, Applica GroovyInfiniteLoopStatementInspection.class, GroovyInfiniteRecursionInspection.class, GroovyDivideByZeroInspection.class, - GroovyResultOfArrayAllocationIgnoredInspection.class, GroovyResultOfObjectAllocationIgnoredInspection.class, GroovyClassNamingConventionInspection.class, diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfArrayAllocationIgnoredInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfArrayAllocationIgnoredInspection.java deleted file mode 100644 index 26f5ae45befd..000000000000 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfArrayAllocationIgnoredInspection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2007-2008 Dave Griffith - * - * 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 org.jetbrains.plugins.groovy.codeInspection.bugs; - -import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.codeInspection.BaseInspection; -import org.jetbrains.plugins.groovy.codeInspection.BaseInspectionVisitor; -import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrCodeBlock; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrOpenBlock; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrNewExpression; -import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement; - -public class GroovyResultOfArrayAllocationIgnoredInspection extends BaseInspection { - - @Nls - @NotNull - public String getGroupDisplayName() { - return PROBABLE_BUGS; - } - - @Nls - @NotNull - public String getDisplayName() { - return "Result of array allocation ignored"; - } - - @Nullable - protected String buildErrorString(Object... args) { - final Boolean isCompleteExpression = (Boolean) args[0]; - if (isCompleteExpression.booleanValue()) { - return "Result of #ref is ignored #loc"; - } else { - return "Result of new #ref[] is ignored #loc"; - } - } - - public boolean isEnabledByDefault() { - return true; - } - - public BaseInspectionVisitor buildVisitor() { - return new Visitor(); - } - - private static class Visitor extends BaseInspectionVisitor { - - public void visitNewExpression(GrNewExpression newExpression) { - super.visitNewExpression(newExpression); - final PsiElement parent = newExpression.getParent(); - if (!(parent instanceof GrCodeBlock)) { - return; - } - if (newExpression.getArrayCount() == 0) { - return; - } - if (parent instanceof GrOpenBlock) { - final GrOpenBlock openBlock = (GrOpenBlock) parent; - if (ControlFlowUtils.openBlockCompletesWithStatement(openBlock, newExpression)) { - return; - } - } - - final GrCodeReferenceElement referenceElement = newExpression.getReferenceElement(); - if (referenceElement != null) { - registerError(referenceElement, Boolean.FALSE); - } else { - registerError(newExpression, Boolean.TRUE); - } - } - } -} \ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfObjectAllocationIgnoredInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfObjectAllocationIgnoredInspection.java index 1b1f50d6a96e..9f958a4d2ce3 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfObjectAllocationIgnoredInspection.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyResultOfObjectAllocationIgnoredInspection.java @@ -22,12 +22,11 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.codeInspection.BaseInspection; import org.jetbrains.plugins.groovy.codeInspection.BaseInspectionVisitor; import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils; +import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock; import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrCodeBlock; import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrOpenBlock; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrNewExpression; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression; public class GroovyResultOfObjectAllocationIgnoredInspection extends BaseInspection { @@ -45,7 +44,7 @@ public class GroovyResultOfObjectAllocationIgnoredInspection extends BaseInspect @Nullable protected String buildErrorString(Object... args) { - return "Result of new #ref() is ignored #loc"; + return "Result of new #ref" + (args[0].equals(new Integer(0)) ? "()" : "[]") + " is ignored #loc"; } @@ -62,29 +61,19 @@ public class GroovyResultOfObjectAllocationIgnoredInspection extends BaseInspect public void visitNewExpression(GrNewExpression newExpression) { super.visitNewExpression(newExpression); final PsiElement parent = newExpression.getParent(); - if (!(parent instanceof GrCodeBlock)) { + if (parent instanceof GrClosableBlock) { return; } - if (parent instanceof GrOpenBlock) { - final GrOpenBlock openBlock = (GrOpenBlock) parent; - if (ControlFlowUtils.openBlockCompletesWithStatement(openBlock, newExpression)) { - return; - } - } else if (parent instanceof GrClosableBlock) { - final PsiElement grandParent = parent.getParent(); - if (grandParent instanceof GrMethodCallExpression) { - return; - } else if (grandParent instanceof GrReferenceExpression) { - final PsiElement greatGrandParent = grandParent.getParent(); - if (greatGrandParent instanceof GrMethodCallExpression) { + + if (parent instanceof GrCodeBlock || parent instanceof GroovyFile) { + if (parent instanceof GrOpenBlock) { + final GrOpenBlock openBlock = (GrOpenBlock)parent; + if (ControlFlowUtils.openBlockCompletesWithStatement(openBlock, newExpression)) { return; } } + registerError(newExpression.getReferenceElement(), newExpression.getArrayCount()); } - if (newExpression.getArrayCount() != 0) { - return; - } - registerError(newExpression.getReferenceElement()); } } } \ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/noReturnMethod/MissingReturnInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/noReturnMethod/MissingReturnInspection.java index 305c5a12cdb1..684dbfe780ac 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/noReturnMethod/MissingReturnInspection.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/noReturnMethod/MissingReturnInspection.java @@ -99,7 +99,9 @@ public class MissingReturnInspection extends GroovySuppressableInspectionTool { final PsiElement element = instruction.getElement(); if (element instanceof GrReturnStatement) { sometimes.set(true); - hasExplicitReturn.set(true); + if (((GrReturnStatement)element).getReturnValue() != null) { + hasExplicitReturn.set(true); + } } else if (element instanceof GrThrowStatement || element instanceof GrAssertStatement) { sometimes.set(true); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java index 77b588826275..8b44f59bd3ee 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java @@ -18,10 +18,10 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection; import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyUncheckedAssignmentOfMemberOfRawTypeInspection; +import org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyResultOfObjectAllocationIgnoredInspection; import org.jetbrains.plugins.groovy.codeInspection.control.GroovyTrivialConditionalInspection; import org.jetbrains.plugins.groovy.codeInspection.control.GroovyTrivialIfInspection; import org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyLongMethodInspection; -import org.jetbrains.plugins.groovy.codeInspection.noReturnMethod.MissingReturnInspection; import org.jetbrains.plugins.groovy.codeInspection.unassignedVariable.UnassignedVariableAccessInspection; import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUnresolvedAccessInspection; import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUntypedAccessInspection; @@ -34,6 +34,17 @@ import java.io.IOException; * @author peter */ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase { + public static final DefaultLightProjectDescriptor GROOVY_17_PROJECT_DESCRIPTOR = new DefaultLightProjectDescriptor() { + @Override + public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) { + final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel(); + final VirtualFile groovyJar = + JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_7LibraryName()+"!/"); + modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES); + modifiableModel.commit(); + } + }; + @Override protected String getBasePath() { return TestUtils.getTestDataPath() + "highlighting/"; @@ -42,16 +53,7 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase { @NotNull @Override protected LightProjectDescriptor getProjectDescriptor() { - return new DefaultLightProjectDescriptor() { - @Override - public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) { - final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel(); - final VirtualFile groovyJar = - JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_7LibraryName()+"!/"); - modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES); - modifiableModel.commit(); - } - }; + return GROOVY_17_PROJECT_DESCRIPTOR; } public void testDuplicateClosurePrivateVariable() throws Throwable { @@ -139,18 +141,9 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase { public void testDefaultMapConstructorNamedArgsError() throws Throwable {doTest();} public void testDefaultMapConstructorWhenDefConstructorExists() throws Throwable {doTest();} - public void testUnresolvedLhsAssignment() throws Throwable { doTest(new GroovyUnresolvedAccessInspection()); } + public void testSingleAllocationInClosure() throws Throwable {doTest(new GroovyResultOfObjectAllocationIgnoredInspection());} - public void testMissingReturnWithLastLoop() throws Throwable { doTest(new MissingReturnInspection()); } - public void testMissingReturnWithUnknownCall() throws Throwable { doTest(new MissingReturnInspection()); } - public void testMissingReturnWithIf() throws Throwable { doTest(new MissingReturnInspection()); } - public void testMissingReturnWithAssertion() throws Throwable { doTest(new MissingReturnInspection()); } - public void testMissingReturnThrowException() throws Throwable { doTest(new MissingReturnInspection()); } - public void testMissingReturnTryCatch() throws Throwable { doTest(new MissingReturnInspection()); } - public void testMissingReturnLastNull() throws Throwable { doTest(new MissingReturnInspection()); } - public void testMissingReturnImplicitReturns() throws Throwable {doTest(new MissingReturnInspection());} - public void testMissingReturnOvertReturnType() throws Throwable {doTest(new MissingReturnInspection());} - public void testMissingReturnFromClosure() throws Throwable {doTest(new MissingReturnInspection());} + public void testUnresolvedLhsAssignment() throws Throwable { doTest(new GroovyUnresolvedAccessInspection()); } public void testUnresolvedMethodCallWithTwoDeclarations() throws Throwable{ doTest(); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/MissingReturnTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/MissingReturnTest.java new file mode 100644 index 000000000000..62e41e0863e9 --- /dev/null +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/MissingReturnTest.java @@ -0,0 +1,42 @@ +package org.jetbrains.plugins.groovy.lang; + +import com.intellij.testFramework.LightProjectDescriptor; +import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.plugins.groovy.codeInspection.noReturnMethod.MissingReturnInspection; +import org.jetbrains.plugins.groovy.util.TestUtils; + +/** + * @author peter + */ +public class MissingReturnTest extends LightCodeInsightFixtureTestCase { + + @Override + protected String getBasePath() { + return TestUtils.getTestDataPath() + "highlighting/missingReturn"; + } + + @NotNull + @Override + protected LightProjectDescriptor getProjectDescriptor() { + return GroovyHighlightingTest.GROOVY_17_PROJECT_DESCRIPTOR; + } + + public void testMissingReturnWithLastLoop() throws Throwable { doTest(); } + public void testMissingReturnWithUnknownCall() throws Throwable { doTest(); } + public void testMissingReturnWithIf() throws Throwable { doTest(); } + public void testMissingReturnWithAssertion() throws Throwable { doTest(); } + public void testMissingReturnThrowException() throws Throwable { doTest(); } + public void testMissingReturnTryCatch() throws Throwable { doTest(); } + public void testMissingReturnLastNull() throws Throwable { doTest(); } + public void testMissingReturnImplicitReturns() throws Throwable {doTest();} + public void testMissingReturnOvertReturnType() throws Throwable {doTest();} + public void testMissingReturnFromClosure() throws Throwable {doTest();} + public void testReturnsWithoutValue() throws Throwable {doTest();} + + private void doTest() throws Exception { + myFixture.enableInspections(new MissingReturnInspection()); + myFixture.testHighlighting(true, false, false, getTestName(false) + ".groovy"); + } + +} diff --git a/plugins/groovy/testdata/highlighting/SingleAllocationInClosure.groovy b/plugins/groovy/testdata/highlighting/SingleAllocationInClosure.groovy new file mode 100644 index 000000000000..af443dcb0267 --- /dev/null +++ b/plugins/groovy/testdata/highlighting/SingleAllocationInClosure.groovy @@ -0,0 +1,3 @@ +def c = { new String() } +def d = { new String[0] } +new String() \ No newline at end of file diff --git a/plugins/groovy/testdata/highlighting/MissingReturnFromClosure.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnFromClosure.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnFromClosure.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnFromClosure.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnImplicitReturns.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnImplicitReturns.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnImplicitReturns.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnImplicitReturns.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnLastNull.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnLastNull.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnLastNull.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnLastNull.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnOvertReturnType.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnOvertReturnType.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnOvertReturnType.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnOvertReturnType.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnThrowException.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnThrowException.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnThrowException.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnThrowException.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnTryCatch.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnTryCatch.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnTryCatch.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnTryCatch.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnWithAssertion.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithAssertion.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnWithAssertion.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithAssertion.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnWithIf.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithIf.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnWithIf.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithIf.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnWithLastLoop.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithLastLoop.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnWithLastLoop.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithLastLoop.groovy diff --git a/plugins/groovy/testdata/highlighting/MissingReturnWithUnknownCall.groovy b/plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithUnknownCall.groovy similarity index 100% rename from plugins/groovy/testdata/highlighting/MissingReturnWithUnknownCall.groovy rename to plugins/groovy/testdata/highlighting/missingReturn/MissingReturnWithUnknownCall.groovy diff --git a/plugins/groovy/testdata/highlighting/missingReturn/ReturnsWithoutValue.groovy b/plugins/groovy/testdata/highlighting/missingReturn/ReturnsWithoutValue.groovy new file mode 100644 index 000000000000..af3e771e5421 --- /dev/null +++ b/plugins/groovy/testdata/highlighting/missingReturn/ReturnsWithoutValue.groovy @@ -0,0 +1,5 @@ +list.each {c -> + if (some) { + return + } +} \ No newline at end of file