diff --git a/java/java-tests/testData/inspection/redundantCast/ArrayAccess/expected.xml b/java/java-tests/testData/inspection/redundantCast/ArrayAccess/expected.xml new file mode 100644 index 000000000000..9ac879d78616 --- /dev/null +++ b/java/java-tests/testData/inspection/redundantCast/ArrayAccess/expected.xml @@ -0,0 +1,3 @@ + + + diff --git a/java/java-tests/testData/inspection/redundantCast/ArrayAccess/src/ArrayAccess.java b/java/java-tests/testData/inspection/redundantCast/ArrayAccess/src/ArrayAccess.java new file mode 100644 index 000000000000..1cbaa08d8bd1 --- /dev/null +++ b/java/java-tests/testData/inspection/redundantCast/ArrayAccess/src/ArrayAccess.java @@ -0,0 +1,24 @@ +import java.util.*; +/* + * Copyright 2000-2012 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. + */ + +class A { + public static void main(String args) { + Map map = new HashMap(); + map.put("a", new int[1]); + ((int[])map.get("a"))[0] += 5; + } +} diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCastTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCastTest.java index 8569b20f9adc..a37dc1d4a802 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCastTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCastTest.java @@ -94,4 +94,5 @@ public class RedundantCastTest extends InspectionTestCase { public void testPrimitiveInsideSynchronized() throws Exception { doTest(); } public void testInConditionalPreserveResolve() throws Exception { doTest();} + public void testArrayAccess() throws Exception { doTest();} }