mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] methods with default parameters are not abstract in traits even if code method is abstract
This commit is contained in:
+1
-1
@@ -95,7 +95,7 @@ public class GrReflectedMethodImpl extends LightMethodBuilder implements GrRefle
|
||||
final GrLightModifierList myModifierList = ((GrLightModifierList)getModifierList());
|
||||
|
||||
for (String modifier : GrModifier.GROOVY_MODIFIERS) {
|
||||
if (baseMethod.hasModifierProperty(modifier)) {
|
||||
if (baseMethod.getModifierList().hasExplicitModifier(modifier)) {
|
||||
myModifierList.addModifier(modifier);
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.lang.highlighting
|
||||
|
||||
import com.intellij.codeInsight.generation.OverrideImplementExploreUtil
|
||||
import com.intellij.codeInspection.InspectionProfileEntry
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import org.jetbrains.annotations.NotNull
|
||||
@@ -136,5 +137,26 @@ trait T {
|
||||
}
|
||||
}
|
||||
|
||||
void 'test trait with method with default parameters'() {
|
||||
testHighlighting '''\
|
||||
trait A {
|
||||
def foo(a, b = null, c = null) {}
|
||||
}
|
||||
class B implements A {}
|
||||
'''
|
||||
}
|
||||
|
||||
void 'test trait with abstract method with default parameters'() {
|
||||
testHighlighting '''
|
||||
trait A {
|
||||
abstract foo(a, b = null, c = null)
|
||||
}
|
||||
<error descr="Method 'foo' is not implemented">class B implements A</error> {}
|
||||
'''
|
||||
def definition = fixture.findClass('B') as GrTypeDefinition
|
||||
def map = OverrideImplementExploreUtil.getMapToOverrideImplement(definition, true)
|
||||
assert map.size() == 1 // need to implement only foo(a, b, c)
|
||||
}
|
||||
|
||||
final InspectionProfileEntry[] customInspections = [new GroovyAssignabilityCheckInspection(), new GrUnresolvedAccessInspection()]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user