diff options
Diffstat (limited to 'plugins/InspectionGadgets/test/com/siyeh/igtest/style')
3 files changed, 81 insertions, 34 deletions
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/CStyleArrayDeclarationInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/CStyleArrayDeclarationInspection.java deleted file mode 100644 index 00d3e0ec97d4..000000000000 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/CStyleArrayDeclarationInspection.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.siyeh.igtest.style; - -public class CStyleArrayDeclarationInspection -{ - private int[] m_foo; - private int m_bar[]; - - public CStyleArrayDeclarationInspection(int[] bar, int[] foo) - { - m_bar = bar; - m_foo = foo; - for(int i = 0; i < bar.length; i++) - { - m_foo[i] = m_bar[i]; - } - - } - - public void foo() - { - final int foo[] = new int[3]; - final int[] bar = new int[3]; - - for(int i = 0; i < bar.length; i++) - { - foo[i] = bar[i]; - } - } - - public void bar(int foo[], int[] bar) - { - - } -} diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/cstyle_array_declaration/CStyleArrayDeclaration.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/cstyle_array_declaration/CStyleArrayDeclaration.java new file mode 100644 index 000000000000..8a01835a2106 --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/cstyle_array_declaration/CStyleArrayDeclaration.java @@ -0,0 +1,38 @@ +package com.siyeh.igtest.style; + +public class CStyleArrayDeclaration +{ + private int[] m_foo; + private int <warning descr="C-style array declaration of field 'm_bar'">m_bar</warning>[]; + + public CStyleArrayDeclaration(int[] bar, int[] foo) + { + m_bar = bar; + m_foo = foo; + for(int i = 0; i < bar.length; i++) + { + m_foo[i] = m_bar[i]; + } + + } + + public void foo() + { + final int <warning descr="C-style array declaration of local variable 'foo'">foo</warning>[] = new int[3]; + final int[] bar = new int[3]; + + for(int i = 0; i < bar.length; i++) + { + foo[i] = bar[i]; + } + } + + public void bar(int <warning descr="C-style array declaration of parameter 'foo'">foo</warning>[], int[] bar) + { + + } + + String <warning descr="C-style array declaration of the return type of method 'ohGod()'">ohGod</warning>(String[] a)[] { + return a; + } +} diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/nested_method_call/NestedMethodCall.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/nested_method_call/NestedMethodCall.java new file mode 100644 index 000000000000..2548443e805b --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/nested_method_call/NestedMethodCall.java @@ -0,0 +1,43 @@ + +import java.util.ArrayList; + +public class NestedMethodCall extends ArrayList{ + private int baz = bar(foo()); + + public NestedMethodCall(int initialCapacity) { + super(Math.abs(initialCapacity)); + } + + public NestedMethodCall() { + this(Math.abs(3)); + } + + public int foo() + { + return 3; + } + public int bar(int val) + { + return 3+val; + } + + public int baz() + { + bar(Math.abs(3)); + return bar(<warning descr="Nested method call 'foo()'">foo</warning>()); + } + + public int barangus() + { + return bar(<warning descr="Nested method call 'foo()'">foo</warning>()+3); + } + + private int value = 1; + public int getValue() { + return value; + } + + public int apex() { + return bar(getValue()); + } +} |