mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-26355: don't produce wildcards in gdsl
This commit is contained in:
@@ -25,6 +25,7 @@ import static standardDsls.Constants.STRING
|
||||
interface Constants {
|
||||
String NUMBER = "java.lang.Number"
|
||||
String STRING = "java.lang.String"
|
||||
String WILDCARD_PREFIX = "? extends "
|
||||
}
|
||||
|
||||
def extractTypeParameter(def typeText) {
|
||||
@@ -32,8 +33,13 @@ def extractTypeParameter(def typeText) {
|
||||
final int end = typeText.lastIndexOf('>')
|
||||
|
||||
if (start < 0) return null
|
||||
if (end < 0) return typeText.substring(start + 1)
|
||||
return typeText.substring(start + 1, end);
|
||||
|
||||
String componentType = end < 0 ? typeText.substring(start + 1) : typeText.substring(start + 1, end)
|
||||
if (componentType.startsWith(Constants.WILDCARD_PREFIX)) {
|
||||
componentType = componentType.substring(Constants.WILDCARD_PREFIX.size())
|
||||
}
|
||||
|
||||
return componentType;
|
||||
}
|
||||
|
||||
def constructElementTypeArg(def psiType) {
|
||||
|
||||
@@ -346,6 +346,10 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest(new GroovyResultOfAssignmentUsedInspection());
|
||||
}
|
||||
|
||||
public void testGdslWildcardTypes() {
|
||||
myFixture.configureByText("a.groovy", "List<? extends String> l = []; l.get(1)");
|
||||
myFixture.checkHighlighting(true, false, false);
|
||||
}
|
||||
|
||||
public void testThisTypeInStaticContext() {
|
||||
doTest(new GroovyAssignabilityCheckInspection());
|
||||
|
||||
Reference in New Issue
Block a user