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
-1
votes
1 answer

Package name is corrupted while copying the class

I defined Point class like below. package com.sample.app.model; public class Point { public int x; public int y; } When I try to construct other class with Point class data, I seen package name is corrupted. CtClass pointClass =…
Hari Krishna
  • 3,658
  • 1
  • 36
  • 57
-1
votes
1 answer

Javassist ; Caused by: compile error: no such class: logger

I am trying to instrument one of my class and it works fine if I added System.out.println(somevariable) but it throws Caused by: compile error: no such class: logger when adding logger.debug(somevariable); Here is the code with logger: public…
NaiveCoder
  • 957
  • 3
  • 14
  • 34
-1
votes
1 answer

Java - Modify toString() of Object class in JVM

In JVM, I want to change the behaviour of toString method of Object class to return getClass().getName(); instead of getClass().getName() + "@" + Integer.toHexString(hashCode()); I tried Javassist's Hotswapper, but it requires a debug port to be…
-1
votes
1 answer

where does exactly Hibernate uses HttpURLConnection

I have been searching everywhere, but could not find where exactly hibernate uses HttpURLConnection. Theoretically I think it uses for its back end connectivity. My issue is I have a java agent which instruments HttpURLConnection to set a header…
-1
votes
1 answer

Javassist "syntax error" on valid method

Javassist gives me this error: Caused by: javassist.compiler.SyntaxError: syntax error near "oolean do() { Obje" at javassist.compiler.Parser.parseMember1(Parser.java:55) ~[?:?] at javassist.compiler.Javac.compile(Javac.java:90)…
-1
votes
1 answer

cglib vs javaassit vs java refelection

I heard that cglib takes less time as compare to java reflection for runtime object creation but when I checked, it is taking 100 times more time than java reflection. Following is the result of my research Creating 10000 objects CGLIB:191…
zubair
  • 185
  • 3
  • 15
-1
votes
1 answer

A java Agent to inspect all JVM running classes?

I am trying do an academic project on BCI and JavaAssist. I would be glad if anyone could help me with these: Is it possible to build a java agent which can inspect/control all classes running currently in the JVM? Is it possible to build a java…
-1
votes
1 answer

Java Write Log to Text

Currently I'm instrumenting methods with loggers to trace some information but I have problem extracting the log output into the text file. What I am doing is instrumenting every single method with logger.info but it doesn't work when you want to…
James Riden
  • 101
  • 1
  • 9
-2
votes
1 answer

Javassist constant pool

Question 1: How would I change the signatures of entries within the ConstPool? For example, lets say I had a methodref to a method with a signature "()Ljava.util.Collection;". How can I change that to say, "()I"? I want to do this because when a…
user2982130
-2
votes
1 answer

Opcode for identifying switch case in javassist

How to find the op-code for identifying switch case in a java class using javassist or asm. I used the Below Snippet List methods = lClassFile.getMethods(); for (Object m : methods) { MethodInfo lMethodInfo = (MethodInfo) m; …
-4
votes
1 answer

How to print no methods Found if none is found

i have this code i need to print no methods found if no methods are found how to do it. public class MethodFinder { public static void main(String[] args) throws Throwable { ClassPool cp = ClassPool.getDefault(); CtClass ctClass =…
1 2 3
40
41