diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy index 4245e37df048..79c84eb85700 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 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. @@ -32,6 +32,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrRe import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyMethodResult import org.jetbrains.plugins.groovy.lang.psi.impl.statements.typedef.members.GrMethodImpl import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrGdkMethodImpl +import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrTraitMethod import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass import org.jetbrains.plugins.groovy.util.NotNullCachedComputableWrapper @@ -2292,4 +2293,34 @@ BigDecimal b = 1 fixture.enableInspections GroovyAssignabilityCheckInspection fixture.checkHighlighting() } + + void 'test resolve AutoImplement'() { + myFixture.addClass("package groovy.transform; public @interface AutoImplement {}") + def method = resolveByText ''' +import groovy.transform.AutoImplement + +@AutoImplement +class SomeClass extends List { +} + +new SomeClass().size() +''', GrLightMethodBuilder + assert (method as GrLightMethodBuilder).originInfo.contains("@AutoImplement") + } + + void 'test resolve AutoImplement implemented'() { + myFixture.addClass("package groovy.transform; public @interface AutoImplement {}") + resolveByText ''' +import groovy.transform.AutoImplement + +@AutoImplement +class SomeClass extends List { + @Override + public int size() {return 0} +} + +new SomeClass().size() +''', GrMethodImpl + + } } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/transformations/autoimplement/AutoImplementTransformationTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/transformations/autoimplement/AutoImplementTransformationTest.groovy new file mode 100644 index 000000000000..0d62cd7b6f25 --- /dev/null +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/transformations/autoimplement/AutoImplementTransformationTest.groovy @@ -0,0 +1,65 @@ +/* + * 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 + * + * 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.transformations.autoimplement + +import org.jetbrains.plugins.groovy.LightGroovyTestCase + +class AutoImplementTransformationTest extends LightGroovyTestCase { + + @Override + void setUp() throws Exception { + super.setUp() + myFixture.addClass("package groovy.transform; public @interface AutoImplement {}") + myFixture.addClass("public abstract class StringList implements List {}") + } + + void 'test highlighting'() { + fixture.configureByText '_.groovy', ''' +import groovy.transform.AutoImplement + +@AutoImplement +class SomeClass implements Runnable { +} +''' + fixture.checkHighlighting() + } + + void 'test highlighting generics'() { + fixture.configureByText '_.groovy', ''' +import groovy.transform.AutoImplement + +@AutoImplement +class SomeClass implements List { +} +''' + fixture.checkHighlighting() + } + + void 'test highlighting generics inherited'() { + + fixture.configureByText '_.groovy', ''' +import groovy.transform.AutoImplement + +@AutoImplement +class SomeClass extends StringList { +} +''' + fixture.checkHighlighting() + } +}