IDEA-CR-29223 Support creating fields and constants from Java to Groovy (IDEA-186327)

This commit is contained in:
alexey.afanasiev
2018-02-26 17:03:18 +03:00
parent ea3520e4df
commit c036551137
9 changed files with 7 additions and 17 deletions
@@ -41,9 +41,9 @@ internal fun JvmModifier.toPsiModifier(): String = when (this) {
}
/**
* Compiled classes, type parameters are not considered classes.
* Compiled classes, type parameters, light classes(except GroovyScriptClass) are not considered classes.
*
* @return Java PsiClass or `null` if the receiver is not a Java PsiClass
* @return GrTypeDefinition or `null` if the receiver is not a Groovy type definition.
*/
internal fun JvmClass.toGroovyClassOrNull(): GrTypeDefinition? {
if (this !is GrTypeDefinition) return null
@@ -1,5 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.fixes
import com.intellij.psi.impl.source.PostprocessReformattingAspect
@@ -46,9 +45,7 @@ class CreateConstantFromJavaUsageTest extends GrHighlightingTestBase {
doTest()
}
void testSuperInterfaceInheritor() {
doTest( "Create constant field 'bar' in 'I'", 0)
void testUppercaseInSuperInterface() {
doTest( "Create constant field 'BAR' in 'I'", 0)
}
}
}
@@ -1,5 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.fixes
import com.intellij.psi.impl.source.PostprocessReformattingAspect
@@ -41,7 +40,7 @@ class CreateFieldFromJavaUsageTest extends GrHighlightingTestBase {
doTest()
}
void testConstant() {
void testUppercaseField() {
doTest()
}
@@ -73,7 +72,6 @@ class CreateFieldFromJavaUsageTest extends GrHighlightingTestBase {
doTest()
}
void testParametricMethod() {
doTest()
}
@@ -1,5 +0,0 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
class Generic<T> {
public List<String>[] foo
}