mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
add LinkedHashMap to mockJdk7
This commit is contained in:
@@ -2252,6 +2252,47 @@
|
||||
<item name='java.util.IdentityHashMap.Values java.util.Iterator<V> iterator()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap LinkedHashMap(java.util.Map<? extends K,? extends V>) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap V get(java.lang.Object)'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap boolean containsValue(java.lang.Object) 0'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap boolean removeEldestEntry(java.util.Map.Entry<K,V>)'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
<val name="value" val=""!null->false;null->false""/>
|
||||
<val name="pure" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap boolean removeEldestEntry(java.util.Map.Entry<K,V>) 0'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap java.util.Iterator<K> newKeyIterator()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap java.util.Iterator<V> newValueIterator()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap java.util.Iterator<java.util.Map.Entry<K,V>> newEntryIterator()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap.Entry void addBefore(java.util.LinkedHashMap.Entry<K,V>) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap.Entry void recordAccess(java.util.HashMap<K,V>) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap.Entry void recordRemoval(java.util.HashMap<K,V>) 0'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
</item>
|
||||
<item name='java.util.LinkedHashMap.LinkedHashIterator boolean hasNext()'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
<val name="pure" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.Locale Locale(java.lang.String) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
|
||||
Binary file not shown.
@@ -102,19 +102,6 @@ public class HashSet<E>
|
||||
''')
|
||||
}
|
||||
|
||||
protected final void addLinkedHashMap() {
|
||||
myFixture.addClass """\
|
||||
package java.util;
|
||||
|
||||
public class LinkedHashMap<K,V> extends HashMap<K,V> implements Map<K,V> {
|
||||
public LinkedHashMap(int initialCapacity, float loadFactor) {}
|
||||
public LinkedHashMap(int initialCapacity) {}
|
||||
public LinkedHashMap() {}
|
||||
public LinkedHashMap(Map<? extends K, ? extends V> m) {}
|
||||
public LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder) {}
|
||||
}"""
|
||||
}
|
||||
|
||||
protected final void addAnnotationCollector() {
|
||||
myFixture.addClass '''\
|
||||
package groovy.transform;
|
||||
|
||||
@@ -398,7 +398,7 @@ println(new CccMap(foo: [:]))
|
||||
println(new CccList(foo: []))
|
||||
|
||||
println(new CccMap(foo: <warning descr="Type of argument 'foo' can not be 'ArrayList'">[]</warning>))
|
||||
println(new CccList(foo: <warning descr="Type of argument 'foo' can not be 'Map'">[:]</warning>))
|
||||
println(new CccList(foo: <warning descr="Type of argument 'foo' can not be 'LinkedHashMap'">[:]</warning>))
|
||||
"""
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ class LiteralConstructorUsagesTest extends LightGroovyTestCase {
|
||||
}
|
||||
|
||||
void testLiteralConstructorWithNamedArgs() {
|
||||
addLinkedHashMap()
|
||||
myFixture.addFileToProject "a.groovy", """\
|
||||
import groovy.transform.Immutable
|
||||
|
||||
|
||||
@@ -493,7 +493,6 @@ static bar(String s) {
|
||||
}
|
||||
|
||||
void testLiteralConstructorWithNamedArgs() {
|
||||
addLinkedHashMap()
|
||||
testHighlighting('''\
|
||||
import groovy.transform.Immutable
|
||||
|
||||
|
||||
@@ -303,7 +303,6 @@ public @interface DelegatesTo {
|
||||
}
|
||||
|
||||
void testNamedArgs() {
|
||||
addLinkedHashMap()
|
||||
assertScript '''
|
||||
def with(@DelegatesTo.Target Object target, @DelegatesTo(strategy = Closure.DELEGATE_FIRST) Closure arg) {
|
||||
for (Closure a : arg) {
|
||||
@@ -321,12 +320,10 @@ def test() {
|
||||
}
|
||||
|
||||
test()
|
||||
''', 'HashMap'
|
||||
''', 'LinkedHashMap'
|
||||
}
|
||||
|
||||
void testEllipsisArgs() {
|
||||
addLinkedHashMap()
|
||||
|
||||
assertScript '''
|
||||
def with(@DelegatesTo.Target Object target, @DelegatesTo(strategy = Closure.DELEGATE_FIRST) Closure... arg) {
|
||||
for (Closure a : arg) {
|
||||
@@ -347,7 +344,7 @@ def test() {
|
||||
|
||||
test()
|
||||
|
||||
''', 'HashMap'
|
||||
''', 'LinkedHashMap'
|
||||
}
|
||||
void testShouldChooseMethodFromOwnerInJava() {
|
||||
myFixture.configureByText("Abc.java", '''\
|
||||
@@ -567,7 +564,6 @@ class Abc {
|
||||
}
|
||||
''')
|
||||
|
||||
addLinkedHashMap()
|
||||
assertScript '''
|
||||
@CompileStatic
|
||||
def test() {
|
||||
@@ -577,7 +573,7 @@ def test() {
|
||||
}
|
||||
|
||||
test()
|
||||
''', 'HashMap'
|
||||
''', 'LinkedHashMap'
|
||||
}
|
||||
|
||||
void testEllipsisArgsInJava() {
|
||||
@@ -596,8 +592,6 @@ class Abc {
|
||||
}
|
||||
''')
|
||||
|
||||
addLinkedHashMap()
|
||||
|
||||
assertScript '''
|
||||
@CompileStatic
|
||||
def test() {
|
||||
@@ -610,7 +604,7 @@ def test() {
|
||||
|
||||
test()
|
||||
|
||||
''', 'HashMap'
|
||||
''', 'LinkedHashMap'
|
||||
}
|
||||
|
||||
void testTarget() {
|
||||
@@ -634,7 +628,6 @@ foo(4) {
|
||||
}
|
||||
|
||||
void testGenericTypeIndex() {
|
||||
addLinkedHashMap()
|
||||
assertScript('''\
|
||||
public <K, V> void foo(@DelegatesTo.Target Map<K, V> map, @DelegatesTo(genericTypeIndex = 1) Closure c) {}
|
||||
|
||||
@@ -645,7 +638,6 @@ foo([1:'ab', 2:'cde']) {
|
||||
}
|
||||
|
||||
void testGenericTypeIndex1() {
|
||||
addLinkedHashMap()
|
||||
assertScript('''\
|
||||
public <K, V> void foo(@DelegatesTo.Target Map<K, V> map, @DelegatesTo(genericTypeIndex = 0) Closure c) {}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ List<Integer> l2
|
||||
}
|
||||
|
||||
void testIndexPropertyInLHS() {
|
||||
assertTypeEquals("java.util.Map", 'a.groovy')
|
||||
assertTypeEquals("java.util.LinkedHashMap", 'a.groovy')
|
||||
}
|
||||
|
||||
void testEmptyMapTypeArgs() {
|
||||
@@ -300,7 +300,7 @@ X<String, Integer> x = [:]
|
||||
''')
|
||||
|
||||
def type = ((myFixture.file as GroovyFile).statements[0] as GrVariableDeclaration).variables[0].initializerGroovy.type
|
||||
assertEquals("java.util.Map<java.lang.String,java.lang.Integer>", type.canonicalText)
|
||||
assertEquals("java.util.LinkedHashMap<java.lang.String,java.lang.Integer>", type.canonicalText)
|
||||
}
|
||||
|
||||
void testRawCollectionsInCasts() {
|
||||
@@ -411,7 +411,7 @@ print lis<caret>t
|
||||
doTest('''\
|
||||
def map = cond ? [1:'a', 2:'a', 3:'a'] : [:]
|
||||
print ma<caret>p
|
||||
''', "$JAVA_UTIL_MAP<$JAVA_LANG_STRING, $JAVA_LANG_STRING>")
|
||||
''', "java.util.LinkedHashMap<$JAVA_LANG_STRING, $JAVA_LANG_STRING>")
|
||||
}
|
||||
|
||||
void testEmptyMapOrMapWithGenerics2() {
|
||||
@@ -702,7 +702,7 @@ def foo(Map map) {
|
||||
while(true)
|
||||
ma<caret>p = [a:map]
|
||||
}
|
||||
''', 'java.util.Map<java.lang.String, java.util.Map>')
|
||||
''', 'java.util.LinkedHashMap<java.lang.String, java.util.Map>')
|
||||
}
|
||||
|
||||
void testRecursionWithLists() {
|
||||
|
||||
@@ -27,8 +27,6 @@ class FileGenerationTest extends LightGroovyTestCase {
|
||||
final String basePath = TestUtils.testDataPath + 'refactoring/convertGroovyToJava/file'
|
||||
|
||||
private void doTest() {
|
||||
addLinkedHashMap()
|
||||
|
||||
final String testName = getTestName(true)
|
||||
final PsiFile file = myFixture.configureByFile("${testName}.groovy");
|
||||
assertInstanceOf file, GroovyFile
|
||||
|
||||
@@ -106,7 +106,7 @@ class FooSpec extends spock.lang.Specification {
|
||||
}
|
||||
|
||||
public void testShlSimple() {
|
||||
doTest(CommonClassNames.JAVA_UTIL_MAP, """
|
||||
doTest(AbstractMap.name, """
|
||||
class FooSpec extends spock.lang.Specification {
|
||||
def "foo test"() {
|
||||
expect:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
java.util.Map map = new java.util.Map();
|
||||
java.util.LinkedHashMap map = new java.util.LinkedHashMap();
|
||||
print(map.get(1));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
java.util.Map<java.lang.String, java.lang.Integer> map1 = new java.util.Map<java.lang.String, java.lang.Integer>(1);
|
||||
java.util.LinkedHashMap<java.lang.String, java.lang.Integer> map1 = new java.util.LinkedHashMap<java.lang.String, java.lang.Integer>(1);
|
||||
map1.put("1", 2);
|
||||
java.util.Map<java.lang.String, java.lang.Integer> map = map1;
|
||||
java.util.LinkedHashMap<java.lang.String, java.lang.Integer> map = map1;
|
||||
print(map.get("1"));
|
||||
|
||||
Reference in New Issue
Block a user