Commit f9715d73 authored by Vít Kabele's avatar Vít Kabele

Removed ASM dependency from DiSL server package

parent 52e25cca
......@@ -35,17 +35,20 @@
<ant antfile="../build.xml" target="compile-util" usenativebasedir="true" />
</target>
<target name="compile-disl">
<ant antfile="../build.xml" target="compile-disl" usenativebasedir="true" />
</target>
<target name="build-disl-bypass">
<ant antfile="../build.xml" target="build-disl-bypass" usenativebasedir="true" />
</target>
<!-- DiSL Server -->
<target name="compile" depends="compile-util,init">
<target name="compile" depends="compile-util,init, compile-disl">
<javac destdir="${build.disl-server}" debug="true" srcdir="src/">
<classpath>
<path path="../${src.disl.prefix}/${build.disl}" />
<path refid="util.classpath"/>
<path refid="asm.classpath"/>
<path refid="protobuf.classpath"/>
</classpath>
</javac>
......
......@@ -9,7 +9,6 @@ import ch.usi.dag.dislserver.Protocol.InstrumentClassResponse;
import ch.usi.dag.util.Strings;
import ch.usi.dag.util.logging.Logger;
import com.google.protobuf.ByteString;
import org.objectweb.asm.ClassReader;
import java.io.IOException;
import java.io.OutputStream;
......@@ -112,13 +111,6 @@ final class RequestProcessor {
}
/**
* TODO VK: Consider not using the {@link ClassReader} class, as this only usage makes dependency
* on the ASM package.
* @param nameBytes
* @param classBytes
* @return
*/
private static String __getClassName (
final byte [] nameBytes, final byte [] classBytes
) {
......@@ -128,7 +120,7 @@ final class RequestProcessor {
}
if (result.isEmpty ()) {
result = new ClassReader (classBytes).getClassName ();
result = JavaNames.getClassNameFromBytes (classBytes);
if (result == null || result.isEmpty ()) {
result = UUID.randomUUID ().toString ();
}
......
package ch.usi.dag.disl;
import org.objectweb.asm.ClassReader;
/**
* Utility class providing methods for working with Java-specific class and
......@@ -27,8 +29,9 @@ public final class JavaNames {
public static final boolean isInitializerName (final String name) {
return __INITIALIZER_NAME__.equals (name);
}
//
public static String getClassNameFromBytes(final byte[] bytes){
return (new ClassReader (bytes)).getClassName ();
}
private static final char __TYPE_NAME_PKG_SEPARATOR_CHAR__ = '.';
private static final char __INTERNAL_NAME_PKG_SEPARATOR_CHAR__ = '/';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment