mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] don't allow to convert constructor to closure (IDEA-175428)
This commit is contained in:
+1
-1
@@ -151,7 +151,7 @@ public class ConvertMethodToClosureIntention extends Intention {
|
||||
if (((GrMethod)parent).getNameIdentifierGroovy() != element) return false;
|
||||
method = (GrMethod)parent;
|
||||
}
|
||||
return method.getBlock() != null && method.getParent() instanceof GrTypeDefinitionBody;
|
||||
return !method.isConstructor() && method.getBlock() != null && method.getParent() instanceof GrTypeDefinitionBody;
|
||||
// return element instanceof GrMethod && ((GrMethod)element).getBlock() != null && element.getParent() instanceof GrTypeDefinitionBody;
|
||||
}
|
||||
}
|
||||
|
||||
+16
-11
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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
|
||||
* 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
|
||||
* 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.
|
||||
* 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.intentions;
|
||||
@@ -63,12 +63,17 @@ public class ConvertMethodToClosureTest extends GrIntentionTestCase {
|
||||
doClosureToMethodTest();
|
||||
}
|
||||
|
||||
public void testConstructorToClosure() { doMethodToClosureTest(false); }
|
||||
|
||||
private void doClosureToMethodTest() {
|
||||
doTest(GroovyIntentionsBundle.message("convert.closure.to.method.intention.name"), true);
|
||||
}
|
||||
|
||||
private void doMethodToClosureTest() {
|
||||
doTest(GroovyIntentionsBundle.message("convert.method.to.closure.intention.name"), true);
|
||||
doMethodToClosureTest(true);
|
||||
}
|
||||
|
||||
private void doMethodToClosureTest(boolean available) {
|
||||
doTest(GroovyIntentionsBundle.message("convert.method.to.closure.intention.name"), available);
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class Aa {
|
||||
A<caret>a(a) {}
|
||||
}
|
||||
Reference in New Issue
Block a user