diff options
author | Brian Carlstrom <bdc@google.com> | 2014-10-03 10:28:47 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-10-03 17:08:50 -0700 |
commit | 01afdbab72f5e8c230f3d73a3a61d630670db9ab (patch) | |
tree | 07173fb5f4f431b4c231e8f0d5e6c1b22683fdf9 /test | |
parent | dfaf4c39809035bca7af85d2c51a8bd2f381e58e (diff) | |
download | art-01afdbab72f5e8c230f3d73a3a61d630670db9ab.tar.gz art-01afdbab72f5e8c230f3d73a3a61d630670db9ab.tar.bz2 art-01afdbab72f5e8c230f3d73a3a61d630670db9ab.zip |
Add test for getDeclaredClasses of with missing class
Bug: 17782530
Change-Id: I399621344c3835226c9df9678217fca62cbd5c92
Diffstat (limited to 'test')
-rw-r--r-- | test/005-annotations/build | 3 | ||||
-rw-r--r-- | test/005-annotations/src/android/test/anno/ClassWithInnerAnnotationClass.java | 8 | ||||
-rw-r--r-- | test/005-annotations/src/android/test/anno/TestAnnotations.java | 22 | ||||
-rwxr-xr-x | test/run-test | 1 |
4 files changed, 21 insertions, 13 deletions
diff --git a/test/005-annotations/build b/test/005-annotations/build index 1690213130..24740554e0 100644 --- a/test/005-annotations/build +++ b/test/005-annotations/build @@ -23,5 +23,6 @@ mkdir classes ${JAVAC} -d classes `find src -name '*.java'` # ...but not at run time. -rm classes/android/test/anno/MissingAnnotation.class +rm 'classes/android/test/anno/MissingAnnotation.class' +rm 'classes/android/test/anno/ClassWithInnerAnnotationClass$MissingInnerAnnotationClass.class' ${DX} -JXmx256m --debug --dex --output=$TEST_NAME.jar classes diff --git a/test/005-annotations/src/android/test/anno/ClassWithInnerAnnotationClass.java b/test/005-annotations/src/android/test/anno/ClassWithInnerAnnotationClass.java new file mode 100644 index 0000000000..c69e01a078 --- /dev/null +++ b/test/005-annotations/src/android/test/anno/ClassWithInnerAnnotationClass.java @@ -0,0 +1,8 @@ +package android.test.anno; + +import java.lang.annotation.*; + +public class ClassWithInnerAnnotationClass { + @Retention(RetentionPolicy.SOURCE) + public @interface MissingInnerAnnotationClass {} +} diff --git a/test/005-annotations/src/android/test/anno/TestAnnotations.java b/test/005-annotations/src/android/test/anno/TestAnnotations.java index 4eabb12b35..1deff33149 100644 --- a/test/005-annotations/src/android/test/anno/TestAnnotations.java +++ b/test/005-annotations/src/android/test/anno/TestAnnotations.java @@ -149,26 +149,24 @@ public class TestAnnotations { testArrays(); testArrayProblem(); - //System.exit(0); System.out.println( "AnnoSimpleField " + AnnoSimpleField.class.isAnnotation() + ", SimplyNoted " + SimplyNoted.class.isAnnotation()); - Class clazz; - clazz = SimplyNoted.class; - printAnnotations(clazz); - clazz = INoted.class; - printAnnotations(clazz); - clazz = SubNoted.class; - printAnnotations(clazz); - clazz = FullyNoted.class; - printAnnotations(clazz); + printAnnotations(SimplyNoted.class); + printAnnotations(INoted.class); + printAnnotations(SubNoted.class); + printAnnotations(FullyNoted.class); - Annotation anno; + try { + ClassWithInnerAnnotationClass.class.getDeclaredClasses(); + throw new AssertionError(); + } catch (NoClassDefFoundError expected) { + } // this is expected to be non-null - anno = SimplyNoted.class.getAnnotation(AnnoSimpleType.class); + Annotation anno = SimplyNoted.class.getAnnotation(AnnoSimpleType.class); System.out.println("SimplyNoted.get(AnnoSimpleType) = " + anno); // this is non-null if the @Inherited tag is present anno = SubNoted.class.getAnnotation(AnnoSimpleType.class); diff --git a/test/run-test b/test/run-test index b140fbf81b..f11580e9fb 100755 --- a/test/run-test +++ b/test/run-test @@ -93,6 +93,7 @@ while true; do elif [ "x$1" = "x--jvm" ]; then target_mode="no" runtime="jvm" + prebuild_mode="no" NEED_DEX="false" shift elif [ "x$1" = "x-O" ]; then |