diff options
Diffstat (limited to 'agent/src/main/java/com/code_intelligence/jazzer/generated/JavaNoThrowMethods.kt')
-rw-r--r-- | agent/src/main/java/com/code_intelligence/jazzer/generated/JavaNoThrowMethods.kt | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/agent/src/main/java/com/code_intelligence/jazzer/generated/JavaNoThrowMethods.kt b/agent/src/main/java/com/code_intelligence/jazzer/generated/JavaNoThrowMethods.kt deleted file mode 100644 index b727ae39..00000000 --- a/agent/src/main/java/com/code_intelligence/jazzer/generated/JavaNoThrowMethods.kt +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2021 Code Intelligence GmbH -// -// 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.code_intelligence.jazzer.generated - -private object JavaNoThrowMethods { - val dataFilePath: String = JavaNoThrowMethods.javaClass.`package`.name.replace('.', '/') - const val dataFileName = "java_no_throw_methods_list.dat" - - fun readJavaNoThrowMethods(): Set<String> { - // If we successfully appended the agent JAR to the bootstrap class loader path in Agent, the classLoader - // property of JavaNoThrowMethods returns null and we have to use the system class loader instead. - val ownClassLoader = JavaNoThrowMethods::class.java.classLoader ?: ClassLoader.getSystemClassLoader() - val resource = ownClassLoader.getResource("$dataFilePath/$dataFileName")!! - return resource.openStream().bufferedReader().useLines { line -> line.toSet() }.also { - println("INFO: Loaded ${it.size} no-throw method signatures") - } - } -} - -/** - * A list of Java standard library methods that are known not to throw any exceptions (including - * [java.lang.RuntimeException], but ignoring [java.lang.VirtualMachineError]). - * - * Note: Since methods only declare their thrown exceptions that are not subclasses of [java.lang.RuntimeException], - * this list cannot be generated purely based on information available via reflection. - */ -val JAVA_NO_THROW_METHODS = JavaNoThrowMethods.readJavaNoThrowMethods() |