Questions tagged [javassist]

Javassist is a class library for editing bytecode in java.

Javassist is one of several tools that exist for manipulation of Java Bytecode but, it includes a simple Java Compiler for processing source text. It receives source text written in Java and compiles it into Java bytecode, which will be inlined into a method body.

This feature allows first comers to start modifying class' bytecode to some extent without deep knowledge regarding the class format or actual bytecode instruction set and OP Codes.

611 questions
0
votes
2 answers

Java Newbie: How to use Java Agent From the Command Line for Instrumentation

I am attempting to load a java agent to use java.lang.instrument.Instrumentation to measure the size of an object. Here is my Java: package com.example.memory.usage; import java.lang.instrument.Instrumentation; import java.util.*; public class…
David Williams
  • 8,388
  • 23
  • 83
  • 171
0
votes
3 answers

Create Pojo at runtime and save it on Disk?

With reference to the following link, I have created the classes at run time, http://blog.javaforge.net/post/31913732423/howto-create-java-pojo-at-runtime-with-javassist. Now I need to view the created class that means Where will it create the class…
Vinod
  • 2,263
  • 9
  • 55
  • 104
0
votes
1 answer

Is it possible to modify the android button with javassist

I want to append some mark When the developer calls some method, like preformClick, but I get a exception:javassist.NotFoundException: C:\Users\xyz\AppData\Local\Android\android-sdk\platforms\android-21\android.jar. Here is my code, I use…
Xu Neal
  • 21
  • 3
0
votes
1 answer

Javassist overwriting existing annotations

Already existed annotations present at the top of class are removing and whatever i added using Javassist are adding but not taking any effect. suppose @Entity class Master { //variables //getters and setters } What i need is to…
CaliCo
  • 39
  • 10
0
votes
1 answer

JVM crashes with EXCEPTION_ACCESS_VIOLATION when using Instrumentation API

I am trying to use a ClassFileTransformer with the Instrumentation API. However, my JVM crashes before my premain method finishes. I am using javassist to manipulate the byte-code of loaded classes. My ClassFileTransformer looks like this: import…
0
votes
1 answer

Hibernate JPA conflict in Grails 2.4.4

I've been upgrading a Grails 1.3.7 application to 2.4.4, using Hibernate 3 due to Spring Security being incompatible with the hibernate4 plugin, and have run into issues with this kind of stacktrace at runtime: java.lang.ClassCastException:…
DavidN
  • 51
  • 7
0
votes
0 answers

Error generating java method using javaassist

I am having some trouble with javaassist. I'm attempting to generate a class on the fly and I'm getting an error that says: no such class: Foo during the compilation step in the generateFooMethod step below. Can anyone help me? try { …
Amir Afghani
  • 37,814
  • 16
  • 84
  • 124
0
votes
1 answer

Parse classes from jar using javassist

I'm noob in javassist. Anyone can give the sample how to load classes from jar and save them using javassist? jar = new JarFile(fileName); Enumeration entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry =…
MG_REX
  • 119
  • 1
  • 8
0
votes
1 answer

How to inspect runtime annotations with javassist

When attempting to inspect code at runtime using Javassist I need to look at the annotations. As a simple example: ClassPool pool = ClassPool.getDefault(); CtClass clazz = pool.getCtClass("org.junit.Test"); boolean found = false; for (Object…
user1995422
  • 220
  • 1
  • 3
  • 13
0
votes
2 answers

Write java class object to java source file

I've created a pojo object in runtime using javassist. I want to write it to a java file. I don't want to write a lot of code for this job. Is there any utility for doing this? for example the output should be something like this…
Pooya
  • 4,385
  • 6
  • 45
  • 73
0
votes
1 answer

Invoking injected method

Whenever I create a new method with Javassist using this method public static void addMethod(CtClass targetClass, String code) throws Exception { CtNewMethod.make(code, targetClass); targetClass.toClass(); logger.info("Method…
0
votes
0 answers

Make an object read only in Java

I have a cache with objects which were read from the database (regular beans). When I return them I want to make them read only so users of the cache can't damage the cache objects. I'm looking for an efficient way since objects can be requested…
Avner Levy
  • 6,601
  • 9
  • 53
  • 92
0
votes
1 answer

"VerifyError: Expecting a stackmap frame" using Play Framework and Google App Engine

I have a Google App Engine webapp running with Play Framework 1.2.X. After Google changed their requirement to the webapp being built with Java 7 I have been struggling with a few different instances of VerifyError in the code. I've been able to…
Roy Solberg
  • 18,133
  • 12
  • 49
  • 76
0
votes
1 answer

Can't apply event in an element created by innerHTML

Hello guys I'm having problem with my page at the moment. I have a function that will add row and cells in a table on every click of a button. CODE: