diff options
Diffstat (limited to 'jack-tests')
12 files changed, 250 insertions, 1 deletions
diff --git a/jack-tests/.classpath b/jack-tests/.classpath index 639ea83..a8a949d 100644 --- a/jack-tests/.classpath +++ b/jack-tests/.classpath @@ -2,7 +2,7 @@ <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry excluding="com/android/jack/classpath/test002/lib1override/|com/android/jack/enums/test003/link/Other.java|com/android/jack/enums/test003/link/Values.java|com/android/jack/error/test001/jack/A.java|com/android/jack/error/test002/jack/A.java|com/android/jack/nopackage/jack/|com/android/jack/java7/switches/|com/android/jack/java7/exceptions/|com/android/jack/java7/trywithresources/|com/android/jack/java7/parser/|com/android/jack/compiletime/" kind="src" path="tests"/> + <classpathentry excluding="com/android/jack/classpath/test002/lib1override/|com/android/jack/compiletime/|com/android/jack/enums/test003/link/Other.java|com/android/jack/enums/test003/link/Values.java|com/android/jack/error/test001/jack/A.java|com/android/jack/error/test002/jack/A.java|com/android/jack/java7/boxing/|com/android/jack/java7/exceptions/|com/android/jack/java7/parser/|com/android/jack/java7/switches/|com/android/jack/java7/trywithresources/|com/android/jack/nopackage/jack/|com/android/jack/lookup/test001/liboverride/" kind="src" path="tests"/> <classpathentry kind="lib" path="libs/junit4.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/jack-tests/Android.mk b/jack-tests/Android.mk index ece3a8a..2255157 100644 --- a/jack-tests/Android.mk +++ b/jack-tests/Android.mk @@ -292,6 +292,7 @@ $(call declare-java7-test-with-name,java7/trywithresources/test001) $(call declare-java7-test-with-name,java7/trywithresources/test002) $(call declare-java7-test-with-name,java7/parser/literals/test001) $(call declare-java7-test-with-name,java7/parser/literals/test002) +$(call declare-java7-test-with-name,java7/boxing/test001) # define global regression test include $(JACK_CLEAR_VARS) diff --git a/jack-tests/tests/com/android/jack/classpath/test003/jack/A.java b/jack-tests/tests/com/android/jack/classpath/test003/jack/A.java new file mode 100644 index 0000000..32109f6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/classpath/test003/jack/A.java @@ -0,0 +1,27 @@ +/* + * 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.classpath.test003.jack; + +import com.android.jack.classpath.test003.lib.HasInnersClasses; + +public class A { + + public static int get() { + return HasInnersClasses.value; + } + +} diff --git a/jack-tests/tests/com/android/jack/classpath/test003/lib/HasInnersClasses.java b/jack-tests/tests/com/android/jack/classpath/test003/lib/HasInnersClasses.java new file mode 100644 index 0000000..bc360c1 --- /dev/null +++ b/jack-tests/tests/com/android/jack/classpath/test003/lib/HasInnersClasses.java @@ -0,0 +1,30 @@ +/* + * 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.classpath.test003.lib; + +public class HasInnersClasses { + + public static class InnerToDelete { + + } + + public static int value; + + static { + value = 3; + } +} diff --git a/jack-tests/tests/com/android/jack/jarjar/test003/jack/Annotated.java b/jack-tests/tests/com/android/jack/jarjar/test003/jack/Annotated.java new file mode 100644 index 0000000..6692254 --- /dev/null +++ b/jack-tests/tests/com/android/jack/jarjar/test003/jack/Annotated.java @@ -0,0 +1,22 @@ +/* + * 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.jarjar.test003.jack; + +@AnnotationWithStringArray("com.android.jack.jarjar.test003.jack.B") +public class Annotated { + +} diff --git a/jack-tests/tests/com/android/jack/jarjar/test003/jack/AnnotationWithStringArray.java b/jack-tests/tests/com/android/jack/jarjar/test003/jack/AnnotationWithStringArray.java new file mode 100644 index 0000000..36944e6 --- /dev/null +++ b/jack-tests/tests/com/android/jack/jarjar/test003/jack/AnnotationWithStringArray.java @@ -0,0 +1,21 @@ +/* + * 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.jarjar.test003.jack; + +public @interface AnnotationWithStringArray { + String[] value() default {}; +} diff --git a/jack-tests/tests/com/android/jack/jarjar/test003/jack/B.java b/jack-tests/tests/com/android/jack/jarjar/test003/jack/B.java index 780bf7f..bdc6e1b 100644 --- a/jack-tests/tests/com/android/jack/jarjar/test003/jack/B.java +++ b/jack-tests/tests/com/android/jack/jarjar/test003/jack/B.java @@ -16,6 +16,7 @@ package com.android.jack.jarjar.test003.jack; +@AnnotationWithStringArray("com.android.jack.jarjar.test003.jack.B") public class B { public B(String arg) { diff --git a/jack-tests/tests/com/android/jack/java7/boxing/test001/dx/Tests.java b/jack-tests/tests/com/android/jack/java7/boxing/test001/dx/Tests.java new file mode 100644 index 0000000..0872bc8 --- /dev/null +++ b/jack-tests/tests/com/android/jack/java7/boxing/test001/dx/Tests.java @@ -0,0 +1,45 @@ +/* + * 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.java7.boxing.test001.dx; + +import com.android.jack.java7.boxing.test001.jack.UnBoxObject; + +import junit.framework.Assert; + +import org.junit.Test; + +public class Tests { + + @Test + public void testInt() { + try { + UnBoxObject.getInt(null); + Assert.fail(); + } catch (NullPointerException e) { + // expected + } + try { + UnBoxObject.getInt(new Object()); + Assert.fail(); + } catch (ClassCastException e) { + // expected + } + + UnBoxObject.getInt(Integer.valueOf(34)); + } + +} diff --git a/jack-tests/tests/com/android/jack/java7/boxing/test001/jack/UnBoxObject.java b/jack-tests/tests/com/android/jack/java7/boxing/test001/jack/UnBoxObject.java new file mode 100644 index 0000000..9615d1d --- /dev/null +++ b/jack-tests/tests/com/android/jack/java7/boxing/test001/jack/UnBoxObject.java @@ -0,0 +1,29 @@ +/* + * 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.java7.boxing.test001.jack; + + +public class UnBoxObject { + + public static Object getObject(Object obj) { + return obj; + } + + public static int getInt(Object obj) { + return (int) getObject(obj); + } +} diff --git a/jack-tests/tests/com/android/jack/lookup/test001/jack/Invoking.java b/jack-tests/tests/com/android/jack/lookup/test001/jack/Invoking.java new file mode 100644 index 0000000..0f5b196 --- /dev/null +++ b/jack-tests/tests/com/android/jack/lookup/test001/jack/Invoking.java @@ -0,0 +1,27 @@ +/* + * 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.lookup.test001.jack; + +import com.android.jack.lookup.test001.lib.I; + +public class Invoking { + + public static void m(I i) { + i.m(); + } + +} diff --git a/jack-tests/tests/com/android/jack/lookup/test001/lib/I.java b/jack-tests/tests/com/android/jack/lookup/test001/lib/I.java new file mode 100644 index 0000000..536f5fe --- /dev/null +++ b/jack-tests/tests/com/android/jack/lookup/test001/lib/I.java @@ -0,0 +1,23 @@ +/* + * 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.lookup.test001.lib; + +public interface I { + + void m(); + +} diff --git a/jack-tests/tests/com/android/jack/lookup/test001/liboverride/I.java b/jack-tests/tests/com/android/jack/lookup/test001/liboverride/I.java new file mode 100644 index 0000000..ff506e4 --- /dev/null +++ b/jack-tests/tests/com/android/jack/lookup/test001/liboverride/I.java @@ -0,0 +1,23 @@ +/* + * 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.lookup.test001.lib; + +public abstract class I { + + public abstract void m(); + +} |