This is indeed wrong. When passing a String argument to a MethodDescriptor you have to pass it in JVM notation.
MethodDescriptor("([Ljava/lang/String;)V")
However, I would not recommend doing this because it's rather error-prone. You should use the other apply methods MethodDescriptor offers. Here are two examples:
MethodDescriptor(ArrayType(ObjectType.String), VoidType) // first parameter represents the parameter list, the second the return type
MethodDescriptor(RefArray(LongType,ByteType,ObjectType.String), BooleanType) // a method with (long, byte, String): boolean
libraryClassFilesAreInterfacesOnly
actually doesn’t change how the classes are loaded - it basically reflects how the classes are expected to be loaded. That is, it might be possible that the “discarding" loader was used but libraryClassFilesAreInterfacesOnly is still false.
val x = Set(..); x.filter(…).map(..).toList
creates two intermediate sets before the list is finally created. Rewriting such code to avoid the creation of intermediate collections (e.g., by using foldLeft and withFilter) can lead to very significant performance improvements. But, this is only a wild guess given that I don’t know your code at all...
def analyze(method: DeclaredMethod): PropertyComputationResult = {
if (!method.hasSingleDefinedMethod)
return Result(method, MethodWithAllocations);
if (method.definedMethod.isNative)
return Result(method, MethodWithAllocations);
return Result(method, MethodWithAllocations);
}
44,45c44,45
< allocationFreeMethods.map(_.e).mkString("allocation free: ", "\nallocation free: ", "\n")+
< methodsWithAllocations.map(_.e).mkString("with allocations: ", "\nwith allocations: ", "\n")+
---
> // allocationFreeMethods.map(_.e).mkString("allocation free: ", "\nallocation free: ", "\n")+
> // methodsWithAllocations.map(_.e).mkString("with allocations: ", "\nwith allocations: ", "\n")+
65c65
< ???
---
> return Result(method, MethodWithAllocations);