diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/1929-exception-catch-exception/build | 20 | ||||
| -rw-r--r-- | test/992-source-data/expected.txt | 12 | ||||
| -rw-r--r-- | test/992-source-data/source_file.cc | 13 | ||||
| -rw-r--r-- | test/992-source-data/src/art/Test992.java | 21 |
4 files changed, 44 insertions, 22 deletions
diff --git a/test/1929-exception-catch-exception/build b/test/1929-exception-catch-exception/build deleted file mode 100644 index 10ffcc537d..0000000000 --- a/test/1929-exception-catch-exception/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 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. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/992-source-data/expected.txt b/test/992-source-data/expected.txt index 4db8df0ada..7f59682b1d 100644 --- a/test/992-source-data/expected.txt +++ b/test/992-source-data/expected.txt @@ -1,10 +1,22 @@ class art.Test992 is defined in file "Test992.java" +class art.Test992 does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION class art.Test992$Target1 is defined in file "Test992.java" +class art.Test992$Target1 does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION class art.Target2 is defined in file "Target2.java" +class art.Target2 does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION int does not have a known source file because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION +int does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION class java.lang.Integer is defined in file "Integer.java" +class java.lang.Integer does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION class java.lang.Object is defined in file "Object.java" +class java.lang.Object does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION interface java.lang.Runnable is defined in file "Runnable.java" +interface java.lang.Runnable does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION class [Ljava.lang.Object; does not have a known source file because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION +class [Ljava.lang.Object; does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION class [I does not have a known source file because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION +class [I does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION null does not have a known source file because java.lang.RuntimeException: JVMTI_ERROR_INVALID_CLASS +null does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_INVALID_CLASS +Proxy of [interface java.lang.Runnable] does not have a known source file because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION +Proxy of [interface java.lang.Runnable] does not have a known source file extension because java.lang.RuntimeException: JVMTI_ERROR_ABSENT_INFORMATION diff --git a/test/992-source-data/source_file.cc b/test/992-source-data/source_file.cc index 46d197d048..78687ff005 100644 --- a/test/992-source-data/source_file.cc +++ b/test/992-source-data/source_file.cc @@ -49,6 +49,19 @@ jstring JNICALL Java_art_Test992_getSourceFileName(JNIEnv* env, return ret; } +extern "C" JNIEXPORT +jstring JNICALL Java_art_Test992_getSourceDebugExtension(JNIEnv* env, + jclass klass ATTRIBUTE_UNUSED, + jclass target) { + char* ext = nullptr; + if (JvmtiErrorToException(env, jvmti_env, jvmti_env->GetSourceDebugExtension(target, &ext))) { + return nullptr; + } + jstring ret = env->NewStringUTF(ext); + jvmti_env->Deallocate(reinterpret_cast<unsigned char*>(ext)); + return ret; +} + } // namespace Test992SourceFile } // namespace art diff --git a/test/992-source-data/src/art/Test992.java b/test/992-source-data/src/art/Test992.java index d9ab112726..cc4f0c724c 100644 --- a/test/992-source-data/src/art/Test992.java +++ b/test/992-source-data/src/art/Test992.java @@ -16,6 +16,8 @@ package art; +import java.lang.reflect.Proxy; +import java.util.Arrays; import java.util.Base64; public class Test992 { @@ -33,15 +35,30 @@ public class Test992 { doTest(new Object[0].getClass()); doTest(new int[0].getClass()); doTest(null); + doTest(Proxy.getProxyClass(Test992.class.getClassLoader(), Runnable.class)); } + public static String printClass(Class<?> k) { + if (k != null && Proxy.class.isAssignableFrom(k)) { + return String.format("Proxy of %s", Arrays.toString(k.getInterfaces())); + } else { + return String.format("%s", k); + } + } public static void doTest(Class<?> k) { + String pk = printClass(k); + try { + System.out.println(pk + " is defined in file \"" + getSourceFileName(k) + "\""); + } catch (Exception e) { + System.out.println(pk + " does not have a known source file because " + e); + } try { - System.out.println(k + " is defined in file \"" + getSourceFileName(k) + "\""); + System.out.println(pk + " has extension \"" + getSourceDebugExtension(k) + "\""); } catch (Exception e) { - System.out.println(k + " does not have a known source file because " + e); + System.out.println(pk + " does not have a known source file extension because " + e); } } public static native String getSourceFileName(Class<?> k) throws Exception; + public static native String getSourceDebugExtension(Class<?> k) throws Exception; } |