Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Include the ASM library and add an example

  • Loading branch information...
commit 96d1842cc11b085d47e377e01432213b6cba0398 1 parent 314cfc7
@Dinduks authored
View
8 src/main/scala/Main.scala
@@ -1,8 +0,0 @@
-package mireille
-
-object Main {
-
- def main (args: Array[String]): Unit = {
- }
-
-}
View
8 src/main/scala/com/dindane/mireille/Main.scala
@@ -0,0 +1,8 @@
+package com.dindane.mireille
+
+object Main {
+
+ def main (args: Array[String]) {
+ }
+
+}
View
41 src/main/scala/com/dindane/mireille/samples/ClassPrinter.scala
@@ -0,0 +1,41 @@
+package com.dindane.mireille.samples
+
+import org.objectweb.asm._
+
+class ClassPrinter extends ClassVisitor(Opcodes.ASM4) {
+
+ override def visit(version: Int, access: Int, name: String, signature: String, superName: String, interfaces: Array[String]) {
+ println(name + " extends " + superName + " {")
+ }
+
+ override def visitSource(source: String, debug: String) {
+ }
+
+ override def visitOuterClass(owner: String, name: String, desc: String) {
+ }
+
+ override def visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor = {
+ return null
+ }
+
+ override def visitAttribute(attr: Attribute) {
+ }
+
+ override def visitInnerClass(name: String, outerName: String, innerName: String, access: Int) {
+ }
+
+ override def visitField(access: Int, name: String, desc: String, signature: String, value: Any): FieldVisitor = {
+ println(" " + desc + " " + name)
+ return null
+ }
+
+ override def visitMethod(access: Int, name: String, desc: String, signature: String, exceptions: Array[String]): MethodVisitor = {
+ println(" " + name + desc)
+ return null
+ }
+
+ override def visitEnd {
+ println("}")
+ }
+
+}
View
13 src/main/scala/com/dindane/mireille/samples/Samples.scala
@@ -0,0 +1,13 @@
+package com.dindane.mireille.samples
+
+import org.objectweb.asm.ClassReader
+
+object Samples {
+
+ def basicParsingExample() {
+ val classPrinter: ClassPrinter = new ClassPrinter
+ val classReader: ClassReader = new ClassReader("java.lang.Runnable");
+ classReader.accept(classPrinter, 0);
+ }
+
+}

0 comments on commit 96d1842

Please sign in to comment.
Something went wrong with that request. Please try again.