From 5b255c81a894a3dc32e279442d3478db02981585 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Wed, 5 Sep 2018 10:12:48 +0100 Subject: [PATCH] ENT-1906: Trivial tweaks to DJVM code. (#3890) * Trivial tweaks to DJVM code. - Use ASM Type.getInternalName() - Use @JvmDefault annotation - Declare test base class as abstract - Ensure test Log4J configuration has precedence - Replace assert() with require() - Replace simple lambdas with function references * Publish corda-djvm artifact. * Migrate Utilities class into the CLI tool. * Configure unit tests for console logging. --- build.gradle | 1 + djvm/build.gradle | 22 ++-- .../net/corda/djvm/tools/cli/BuildCommand.kt | 3 - .../net/corda/djvm/tools/cli/ClassCommand.kt | 3 - .../corda/djvm/tools/cli/InspectionCommand.kt | 1 - .../net/corda/djvm/tools/cli/NewCommand.kt | 4 - .../net/corda/djvm/tools/cli/TreeCommand.kt | 1 - .../net/corda/djvm/tools/cli/Utilities.kt | 104 ++++++++++++++++ .../kotlin/net/corda/djvm/code/Emitter.kt | 1 + .../djvm/references/MemberInformation.kt | 1 + .../net/corda/djvm/rewiring/LoadedClass.kt | 4 +- .../corda/djvm/rewiring/SandboxClassWriter.kt | 3 +- .../corda/djvm/source/SourceClassLoader.kt | 2 +- .../kotlin/net/corda/djvm/tools/Utilities.kt | 114 ------------------ .../net/corda/djvm/utilities/Discovery.kt | 3 +- .../kotlin/foo/bar/sandbox/StrictFloat.kt | 2 +- .../test/kotlin/net/corda/djvm/TestBase.kt | 8 +- .../djvm/execution/SandboxExecutorTest.kt | 2 +- .../corda/djvm/references/MemberModuleTest.kt | 3 +- .../djvm/rules/ReferenceExtractorTest.kt | 5 +- djvm/src/test/resources/log4j2-test.xml | 17 +++ djvm/src/test/resources/log4j2.xml | 39 ------ 22 files changed, 158 insertions(+), 185 deletions(-) create mode 100644 djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/Utilities.kt delete mode 100644 djvm/src/main/kotlin/net/corda/djvm/tools/Utilities.kt create mode 100644 djvm/src/test/resources/log4j2-test.xml delete mode 100644 djvm/src/test/resources/log4j2.xml diff --git a/build.gradle b/build.gradle index b5e034bfaf..c7a1428814 100644 --- a/build.gradle +++ b/build.gradle @@ -331,6 +331,7 @@ bintrayConfig { 'corda-rpc', 'corda-core', 'corda-core-deterministic', + 'corda-djvm', 'corda', 'corda-finance', 'corda-node', diff --git a/djvm/build.gradle b/djvm/build.gradle index 270bfc2375..642601f0e4 100644 --- a/djvm/build.gradle +++ b/djvm/build.gradle @@ -1,6 +1,10 @@ plugins { id 'com.github.johnrengelman.shadow' version '2.0.4' } +apply plugin: 'net.corda.plugins.publish-utils' +apply plugin: 'com.jfrog.artifactory' + +description 'Corda deterministic JVM sandbox' ext { // Shaded version of ASM to avoid conflict with root project. @@ -30,8 +34,8 @@ dependencies { jar.enabled = false shadowJar { - baseName = "djvm" - classifier = "" + baseName 'corda-djvm' + classifier '' dependencies { exclude(dependency('com.jcabi:.*:.*')) exclude(dependency('org.apache.*:.*:.*')) @@ -40,10 +44,14 @@ shadowJar { exclude(dependency('io.github.lukehutch:.*:.*')) } relocate 'org.objectweb.asm', 'djvm.org.objectweb.asm' - artifacts { - shadow(tasks.shadowJar.archivePath) { - builtBy shadowJar - } - } } assemble.dependsOn shadowJar + +artifacts { + publish shadowJar +} + +publish { + disableDefaultJar true + name shadowJar.baseName +} diff --git a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/BuildCommand.kt b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/BuildCommand.kt index 298ebcb1ce..7fafd5d743 100644 --- a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/BuildCommand.kt +++ b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/BuildCommand.kt @@ -1,8 +1,5 @@ package net.corda.djvm.tools.cli -import net.corda.djvm.tools.Utilities.createCodePath -import net.corda.djvm.tools.Utilities.getFileNames -import net.corda.djvm.tools.Utilities.jarPath import picocli.CommandLine.Command import picocli.CommandLine.Parameters import java.nio.file.Path diff --git a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/ClassCommand.kt b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/ClassCommand.kt index e3538535d0..8f5f1cb911 100644 --- a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/ClassCommand.kt +++ b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/ClassCommand.kt @@ -7,9 +7,6 @@ import net.corda.djvm.execution.* import net.corda.djvm.references.ClassModule import net.corda.djvm.source.ClassSource import net.corda.djvm.source.SourceClassLoader -import net.corda.djvm.tools.Utilities.find -import net.corda.djvm.tools.Utilities.onEmpty -import net.corda.djvm.tools.Utilities.userClassPath import net.corda.djvm.utilities.Discovery import djvm.org.objectweb.asm.ClassReader import picocli.CommandLine.Option diff --git a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/InspectionCommand.kt b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/InspectionCommand.kt index f6d779ceb2..32ce08ec6e 100644 --- a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/InspectionCommand.kt +++ b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/InspectionCommand.kt @@ -1,7 +1,6 @@ package net.corda.djvm.tools.cli import net.corda.djvm.source.ClassSource -import net.corda.djvm.tools.Utilities.createCodePath import picocli.CommandLine.Command import picocli.CommandLine.Parameters import java.nio.file.Files diff --git a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/NewCommand.kt b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/NewCommand.kt index e2df2f4d0f..8e6302de4e 100644 --- a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/NewCommand.kt +++ b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/NewCommand.kt @@ -1,9 +1,5 @@ package net.corda.djvm.tools.cli -import net.corda.djvm.tools.Utilities.baseName -import net.corda.djvm.tools.Utilities.createCodePath -import net.corda.djvm.tools.Utilities.getFiles -import net.corda.djvm.tools.Utilities.openOptions import picocli.CommandLine.* import java.nio.file.Files import java.nio.file.Path diff --git a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/TreeCommand.kt b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/TreeCommand.kt index 47b24ffa44..26b5dbc7d8 100644 --- a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/TreeCommand.kt +++ b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/TreeCommand.kt @@ -1,6 +1,5 @@ package net.corda.djvm.tools.cli -import net.corda.djvm.tools.Utilities.workingDirectory import picocli.CommandLine.Command import java.nio.file.Files diff --git a/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/Utilities.kt b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/Utilities.kt new file mode 100644 index 0000000000..66d5d4d918 --- /dev/null +++ b/djvm/cli/src/main/kotlin/net/corda/djvm/tools/cli/Utilities.kt @@ -0,0 +1,104 @@ +@file:JvmName("Utilities") +package net.corda.djvm.tools.cli + +import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner +import java.lang.reflect.Modifier +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths +import java.nio.file.StandardOpenOption + +/** + * Get the expanded file name of each path in the provided array. + */ +fun Array?.getFiles(map: (Path) -> Path = { it }) = (this ?: emptyArray()).map { + val pathString = it.toString() + val path = map(it) + when { + '/' in pathString || '\\' in pathString -> + throw Exception("Please provide a pathless file name") + pathString.endsWith(".java", true) -> path + else -> Paths.get("$path.java") + } +} + +/** + * Get the string representation of each expanded file name in the provided array. + */ +fun Array?.getFileNames(map: (Path) -> Path = { it }) = this.getFiles(map).map { + it.toString() +}.toTypedArray() + +/** + * Execute inlined action if the collection is empty. + */ +inline fun List.onEmpty(action: () -> Unit): List { + if (!this.any()) { + action() + } + return this +} + +/** + * Execute inlined action if the array is empty. + */ +inline fun Array?.onEmpty(action: () -> Unit): Array { + return (this ?: emptyArray()).toList().onEmpty(action).toTypedArray() +} + +/** + * Derive the set of [StandardOpenOption]'s to use for a file operation. + */ +fun openOptions(force: Boolean) = if (force) { + arrayOf(StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING) +} else { + arrayOf(StandardOpenOption.CREATE_NEW) +} + +/** + * Get the path of where any generated code will be placed. Create the directory if it does not exist. + */ +fun createCodePath(): Path { + return Paths.get("tmp", "net", "corda", "djvm").let { + Files.createDirectories(it) + } +} + +/** + * Return the base name of a file (i.e., its name without extension) + */ +val Path.baseName: String + get() = this.fileName.toString() + .replaceAfterLast('.', "") + .removeSuffix(".") + +/** + * The path of the executing JAR. + */ +val jarPath: String = object {}.javaClass.protectionDomain.codeSource.location.toURI().path + + +/** + * The path of the current working directory. + */ +val workingDirectory: Path = Paths.get(System.getProperty("user.dir")) + +/** + * The class path for the current execution context. + */ +val userClassPath: String = System.getProperty("java.class.path") + +/** + * Get a reference of each concrete class that implements interface or class [T]. + */ +inline fun find(scanSpec: String = "net/corda/djvm"): List> { + val references = mutableListOf>() + FastClasspathScanner(scanSpec) + .matchClassesImplementing(T::class.java) { clazz -> + if (!Modifier.isAbstract(clazz.modifiers) && !Modifier.isStatic(clazz.modifiers)) { + references.add(clazz) + } + } + .scan() + return references +} diff --git a/djvm/src/main/kotlin/net/corda/djvm/code/Emitter.kt b/djvm/src/main/kotlin/net/corda/djvm/code/Emitter.kt index 7d953a28e1..f904d276b7 100644 --- a/djvm/src/main/kotlin/net/corda/djvm/code/Emitter.kt +++ b/djvm/src/main/kotlin/net/corda/djvm/code/Emitter.kt @@ -20,6 +20,7 @@ interface Emitter { /** * Indication of whether or not the emitter performs instrumentation for tracing inside the sandbox. */ + @JvmDefault val isTracer: Boolean get() = false diff --git a/djvm/src/main/kotlin/net/corda/djvm/references/MemberInformation.kt b/djvm/src/main/kotlin/net/corda/djvm/references/MemberInformation.kt index f890fe7c89..09ccb21836 100644 --- a/djvm/src/main/kotlin/net/corda/djvm/references/MemberInformation.kt +++ b/djvm/src/main/kotlin/net/corda/djvm/references/MemberInformation.kt @@ -12,5 +12,6 @@ interface MemberInformation { val className: String val memberName: String val signature: String + @JvmDefault val reference: String get() = "$className.$memberName:$signature" } diff --git a/djvm/src/main/kotlin/net/corda/djvm/rewiring/LoadedClass.kt b/djvm/src/main/kotlin/net/corda/djvm/rewiring/LoadedClass.kt index 8db11e85d1..fdbeed7161 100644 --- a/djvm/src/main/kotlin/net/corda/djvm/rewiring/LoadedClass.kt +++ b/djvm/src/main/kotlin/net/corda/djvm/rewiring/LoadedClass.kt @@ -1,5 +1,7 @@ package net.corda.djvm.rewiring +import org.objectweb.asm.Type + /** * A class or interface running in a Java application, together with its raw byte code representation and all references * made from within the type. @@ -16,7 +18,7 @@ class LoadedClass( * The name of the loaded type. */ val name: String - get() = type.name.replace('.', '/') + get() = Type.getInternalName(type) override fun toString(): String { return "Class(type=$name, size=${byteCode.bytes.size}, isModified=${byteCode.isModified})" diff --git a/djvm/src/main/kotlin/net/corda/djvm/rewiring/SandboxClassWriter.kt b/djvm/src/main/kotlin/net/corda/djvm/rewiring/SandboxClassWriter.kt index 9704421cd5..55f7cde501 100644 --- a/djvm/src/main/kotlin/net/corda/djvm/rewiring/SandboxClassWriter.kt +++ b/djvm/src/main/kotlin/net/corda/djvm/rewiring/SandboxClassWriter.kt @@ -4,6 +4,7 @@ import org.objectweb.asm.ClassReader import org.objectweb.asm.ClassWriter import org.objectweb.asm.ClassWriter.COMPUTE_FRAMES import org.objectweb.asm.ClassWriter.COMPUTE_MAXS +import org.objectweb.asm.Type /** * Class writer for sandbox execution, with configurable a [classLoader] to ensure correct deduction of the used class @@ -52,7 +53,7 @@ open class SandboxClassWriter( do { clazz = clazz.superclass } while (!clazz.isAssignableFrom(class2)) - clazz.name.replace('.', '/') + Type.getInternalName(clazz) } } } diff --git a/djvm/src/main/kotlin/net/corda/djvm/source/SourceClassLoader.kt b/djvm/src/main/kotlin/net/corda/djvm/source/SourceClassLoader.kt index 47d0544bcd..60c43ada43 100644 --- a/djvm/src/main/kotlin/net/corda/djvm/source/SourceClassLoader.kt +++ b/djvm/src/main/kotlin/net/corda/djvm/source/SourceClassLoader.kt @@ -80,7 +80,7 @@ open class SourceClassLoader( when { !Files.exists(it) -> throw FileNotFoundException("File not found; $it") Files.isDirectory(it) -> { - listOf(it.toURL()) + Files.list(it).filter { isJarFile(it) }.map { it.toURL() }.toList() + listOf(it.toURL()) + Files.list(it).filter(::isJarFile).map { it.toURL() }.toList() } Files.isReadable(it) && isJarFile(it) -> listOf(it.toURL()) else -> throw IllegalArgumentException("Expected JAR or class file, but found $it") diff --git a/djvm/src/main/kotlin/net/corda/djvm/tools/Utilities.kt b/djvm/src/main/kotlin/net/corda/djvm/tools/Utilities.kt deleted file mode 100644 index f66b14d1cd..0000000000 --- a/djvm/src/main/kotlin/net/corda/djvm/tools/Utilities.kt +++ /dev/null @@ -1,114 +0,0 @@ -package net.corda.djvm.tools - -import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner -import java.lang.reflect.Modifier -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths -import java.nio.file.StandardOpenOption - -/** - * Various utility functions. - */ -@Suppress("unused") -object Utilities { - - /** - * Get the expanded file name of each path in the provided array. - */ - fun Array?.getFiles(map: (Path) -> Path = { it }) = (this ?: emptyArray()).map { - val pathString = it.toString() - val path = map(it) - when { - '/' in pathString || '\\' in pathString -> - throw Exception("Please provide a pathless file name") - pathString.endsWith(".java", true) -> path - else -> Paths.get("$path.java") - } - } - - /** - * Get the string representation of each expanded file name in the provided array. - */ - fun Array?.getFileNames(map: (Path) -> Path = { it }) = this.getFiles(map).map { - it.toString() - }.toTypedArray() - - /** - * Execute inlined action if the collection is empty. - */ - inline fun List.onEmpty(action: () -> Unit): List { - if (!this.any()) { - action() - } - return this - } - - /** - * Execute inlined action if the array is empty. - */ - inline fun Array?.onEmpty(action: () -> Unit): Array { - return (this ?: emptyArray()).toList().onEmpty(action).toTypedArray() - } - - /** - * Derive the set of [StandardOpenOption]'s to use for a file operation. - */ - fun openOptions(force: Boolean) = if (force) { - arrayOf(StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING) - } else { - arrayOf(StandardOpenOption.CREATE_NEW) - } - - /** - * Get the path of where any generated code will be placed. Create the directory if it does not exist. - */ - fun createCodePath(): Path { - val root = Paths.get("tmp") - .resolve("net") - .resolve("corda") - .resolve("djvm") - Files.createDirectories(root) - return root - } - - /** - * Return the base name of a file (i.e., its name without extension) - */ - val Path.baseName: String - get() = this.fileName.toString() - .replaceAfterLast('.', "") - .removeSuffix(".") - - /** - * The path of the executing JAR. - */ - val jarPath: String = Utilities::class.java.protectionDomain.codeSource.location.toURI().path - - - /** - * The path of the current working directory. - */ - val workingDirectory: Path = Paths.get(System.getProperty("user.dir")) - - /** - * The class path for the current execution context. - */ - val userClassPath: String = System.getProperty("java.class.path") - - /** - * Get a reference of each concrete class that implements interface or class [T]. - */ - inline fun find(scanSpec: String = "net/corda/djvm"): List> { - val references = mutableListOf>() - FastClasspathScanner(scanSpec) - .matchClassesImplementing(T::class.java) { clazz -> - if (!Modifier.isAbstract(clazz.modifiers) && !Modifier.isStatic(clazz.modifiers)) { - references.add(clazz) - } - } - .scan() - return references - } - -} \ No newline at end of file diff --git a/djvm/src/main/kotlin/net/corda/djvm/utilities/Discovery.kt b/djvm/src/main/kotlin/net/corda/djvm/utilities/Discovery.kt index 8deadf7d0b..9092e5c044 100644 --- a/djvm/src/main/kotlin/net/corda/djvm/utilities/Discovery.kt +++ b/djvm/src/main/kotlin/net/corda/djvm/utilities/Discovery.kt @@ -7,6 +7,7 @@ import java.lang.reflect.Modifier * Find and instantiate types that implement a certain interface. */ object Discovery { + const val FORBIDDEN_CLASS_MASK = (Modifier.STATIC or Modifier.ABSTRACT) /** * Get an instance of each concrete class that implements interface or class [T]. @@ -15,7 +16,7 @@ object Discovery { val instances = mutableListOf() FastClasspathScanner("net/corda/djvm") .matchClassesImplementing(T::class.java) { clazz -> - if (!Modifier.isAbstract(clazz.modifiers) && !Modifier.isStatic(clazz.modifiers)) { + if (clazz.modifiers and FORBIDDEN_CLASS_MASK == 0) { try { instances.add(clazz.newInstance()) } catch (exception: Throwable) { diff --git a/djvm/src/test/kotlin/foo/bar/sandbox/StrictFloat.kt b/djvm/src/test/kotlin/foo/bar/sandbox/StrictFloat.kt index 0d30565a98..82f721ab9a 100644 --- a/djvm/src/test/kotlin/foo/bar/sandbox/StrictFloat.kt +++ b/djvm/src/test/kotlin/foo/bar/sandbox/StrictFloat.kt @@ -4,7 +4,7 @@ class StrictFloat : Callable { override fun call() { val d = java.lang.Double.MIN_VALUE val x = d / 2 * 2 - assert(x.toString() == "0.0") + require(x.toString() == "0.0") } } diff --git a/djvm/src/test/kotlin/net/corda/djvm/TestBase.kt b/djvm/src/test/kotlin/net/corda/djvm/TestBase.kt index 333516c06a..dfe50ea07c 100644 --- a/djvm/src/test/kotlin/net/corda/djvm/TestBase.kt +++ b/djvm/src/test/kotlin/net/corda/djvm/TestBase.kt @@ -18,9 +18,10 @@ import net.corda.djvm.utilities.Discovery import net.corda.djvm.validation.RuleValidator import org.objectweb.asm.ClassReader import org.objectweb.asm.ClassVisitor +import org.objectweb.asm.Type import java.lang.reflect.InvocationTargetException -open class TestBase { +abstract class TestBase { companion object { @@ -38,8 +39,7 @@ open class TestBase { /** * Get the full name of type [T]. */ - inline fun nameOf(prefix: String = "") = - "$prefix${T::class.java.name.replace('.', '/')}" + inline fun nameOf(prefix: String = "") = "$prefix${Type.getInternalName(T::class.java)}" } @@ -115,7 +115,7 @@ open class TestBase { var thrownException: Throwable? = null Thread { try { - val pinnedTestClasses = pinnedClasses.map { it.name.replace('.', '/') }.toSet() + val pinnedTestClasses = pinnedClasses.map(Type::getInternalName).toSet() val analysisConfiguration = AnalysisConfiguration( whitelist = whitelist, additionalPinnedClasses = pinnedTestClasses, diff --git a/djvm/src/test/kotlin/net/corda/djvm/execution/SandboxExecutorTest.kt b/djvm/src/test/kotlin/net/corda/djvm/execution/SandboxExecutorTest.kt index a677b4fd35..2b2b8e7290 100644 --- a/djvm/src/test/kotlin/net/corda/djvm/execution/SandboxExecutorTest.kt +++ b/djvm/src/test/kotlin/net/corda/djvm/execution/SandboxExecutorTest.kt @@ -63,7 +63,7 @@ class SandboxExecutorTest : TestBase() { val obj = Object() val hash1 = obj.hashCode() val hash2 = obj.hashCode() - assert(hash1 == hash2) + require(hash1 == hash2) return Object().hashCode() } } diff --git a/djvm/src/test/kotlin/net/corda/djvm/references/MemberModuleTest.kt b/djvm/src/test/kotlin/net/corda/djvm/references/MemberModuleTest.kt index 616a7ca7b6..71cd99cbf7 100644 --- a/djvm/src/test/kotlin/net/corda/djvm/references/MemberModuleTest.kt +++ b/djvm/src/test/kotlin/net/corda/djvm/references/MemberModuleTest.kt @@ -4,6 +4,7 @@ import net.corda.djvm.annotations.NonDeterministic import org.assertj.core.api.Assertions.assertThat import org.jetbrains.annotations.NotNull import org.junit.Test +import org.objectweb.asm.Type class MemberModuleTest { @@ -132,7 +133,7 @@ class MemberModuleTest { } private val java.lang.Class<*>.descriptor: String - get() = "L${name.replace('.', '/')};" + get() = Type.getDescriptor(this) private fun member(member: String) = MemberReference("", member, "") diff --git a/djvm/src/test/kotlin/net/corda/djvm/rules/ReferenceExtractorTest.kt b/djvm/src/test/kotlin/net/corda/djvm/rules/ReferenceExtractorTest.kt index 3ea655c24f..bf4485caf5 100644 --- a/djvm/src/test/kotlin/net/corda/djvm/rules/ReferenceExtractorTest.kt +++ b/djvm/src/test/kotlin/net/corda/djvm/rules/ReferenceExtractorTest.kt @@ -4,6 +4,7 @@ import foo.bar.sandbox.Callable import net.corda.djvm.TestBase import net.corda.djvm.assertions.AssertionExtensions.assertThat import org.junit.Test +import org.objectweb.asm.Type import java.util.* class ReferenceExtractorTest : TestBase() { @@ -32,7 +33,7 @@ class ReferenceExtractorTest : TestBase() { @Test fun `can find field references`() = validate { context -> assertThat(context.references) - .hasMember(B::class.java.name.replace('.', '/'), "foo", "Ljava/lang/String;") + .hasMember(Type.getInternalName(B::class.java), "foo", "Ljava/lang/String;") } class B { @@ -47,7 +48,7 @@ class ReferenceExtractorTest : TestBase() { @Test fun `can find class references`() = validate { context -> assertThat(context.references) - .hasClass(A::class.java.name.replace('.', '/')) + .hasClass(Type.getInternalName(A::class.java)) } class C { diff --git a/djvm/src/test/resources/log4j2-test.xml b/djvm/src/test/resources/log4j2-test.xml new file mode 100644 index 0000000000..b12cea5b2d --- /dev/null +++ b/djvm/src/test/resources/log4j2-test.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/djvm/src/test/resources/log4j2.xml b/djvm/src/test/resources/log4j2.xml deleted file mode 100644 index 93e84b6252..0000000000 --- a/djvm/src/test/resources/log4j2.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file