diff options
author | mikaelpeltier <mikaelpeltier@google.com> | 2014-09-15 10:53:54 +0200 |
---|---|---|
committer | mikaelpeltier <mikaelpeltier@google.com> | 2014-09-15 11:00:21 +0200 |
commit | fb97d18ee3fc038e40c167611be8884e40803d31 (patch) | |
tree | 633edfefe05c84d3c2e7a9ce7789a39cd2b2071e /jack-tests/tests/com/android | |
parent | 63f38a100ed9b9c14788a87b8788ee95c564fd04 (diff) | |
download | toolchain_jack-fb97d18ee3fc038e40c167611be8884e40803d31.zip toolchain_jack-fb97d18ee3fc038e40c167611be8884e40803d31.tar.gz toolchain_jack-fb97d18ee3fc038e40c167611be8884e40803d31.tar.bz2 |
Create used variable even if they are defined into dead code
Bug: 7398661
Change-Id: I3b4f965608ea438d3a0c97718533fc6e52b77253
Diffstat (limited to 'jack-tests/tests/com/android')
3 files changed, 70 insertions, 1 deletions
diff --git a/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java b/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java index 60e0aee..cc12486 100644 --- a/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java +++ b/jack-tests/tests/com/android/jack/switchstatement/test006/dx/Tests.java @@ -19,7 +19,6 @@ package com.android.jack.switchstatement.test006.dx; import com.android.jack.switchstatement.test006.jack.Switch; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; /** diff --git a/jack-tests/tests/com/android/jack/switchstatement/test010/dx/Tests.java b/jack-tests/tests/com/android/jack/switchstatement/test010/dx/Tests.java new file mode 100644 index 0000000..091b01b --- /dev/null +++ b/jack-tests/tests/com/android/jack/switchstatement/test010/dx/Tests.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * 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. + */ + +package com.android.jack.switchstatement.test010.dx; + +import com.android.jack.switchstatement.test010.jack.Switch010; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests about switches. + */ +public class Tests { + + @Test + public void test1() { + Assert.assertEquals(0, Switch010.test(1, true)); + Assert.assertEquals(2, Switch010.test(2, false)); + Assert.assertEquals(3, Switch010.test(3, false)); + } +} diff --git a/jack-tests/tests/com/android/jack/switchstatement/test010/jack/Switch010.java b/jack-tests/tests/com/android/jack/switchstatement/test010/jack/Switch010.java new file mode 100644 index 0000000..1d46b14 --- /dev/null +++ b/jack-tests/tests/com/android/jack/switchstatement/test010/jack/Switch010.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * 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. + */ + +package com.android.jack.switchstatement.test010.jack; + + +public class Switch010 { + + public static int test(int value, boolean b) { + switch (value) { + case 1: + if (b || true) { + return 0; + } + @SuppressWarnings("unused") + int i = value; + default: + i = value; + return i; + } + } +} |