Questions tagged [cglib]

CGLib (Code Generation Library) is a run time code generation library for the Java platform licensed under the Apache 2.0 license.

CGLib (Code Generation Library) is mainly used the generation of class proxies. This is achieved by creating subclasses at run time where method invocations are intercepted by user defined methods. Additionally, cglib offers different extension such as for example bean utilities. cglib is built on top of ASM.

Alternative code generation libraries for the JVM that are still under active development are:

401 questions
0
votes
1 answer

how to find all methods called in a methods including Lamda?

I would like to list all methods called by a method. void create() throws MyException { System.out.println("TEST"); of("String").map(String::valueOf).get(); } In this method i would like to list…
Trind
  • 1,583
  • 4
  • 18
  • 38
0
votes
0 answers

Suppress warning "Unable to proxy interface-implementing method [...] because it is marked as final:" for a specific class only

In a Spring application we have several warnings like this: o.s.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [...] because it is marked as final: Consider using interface-based JDK proxies instead! This question and…
Honza Zidek
  • 9,204
  • 4
  • 72
  • 118
0
votes
2 answers

Does sqoop import/export create java classes? If it does so, what is the location of these classes?

Does sqoop import/export create java classes? If it does so, where can I see these generated classes. What is the location of these class files?
samshers
  • 1
  • 6
  • 37
  • 84
0
votes
1 answer

IllegalArgumentException in Enhancer.setCallbacksHelper() while using .createMock with EasyMock

I encounter a problem during unit testing with EasyMock. When trying to create a mock object, the following Exception is thrown: java.lang.IllegalArgumentException: class ...UnitOfWork$$EnhancerByCGLIB$$3561f3ca is not an enhanced class at…
BloodyMettle
  • 104
  • 8
0
votes
2 answers

CGLIB errors converting a weblogic spring web app to springboot app

I am attempting to convert an existing spring weblogic application to a spring boot embedded tomcat application. There are lots of moving parts so it's hard to show any code, I'm hoping there is some general answer that might clue me in to the…
Johnnie
  • 305
  • 2
  • 16
0
votes
1 answer

got 'VerifyError' when Mock in Spock1.1

when i try to mock a spring service, i got verifyError. i have check spock version and groovy version, it's seens no problem. can somebody point me how to resovle this issue ? Thanks! Spock version: spock-core-1.1-groovy-2.4-rc-3.jar Groovy…
MagiX
  • 1
  • 1
  • 5
0
votes
1 answer

What does CGLib's intercept actually return?

I'm trying to create my own lazy load implementation using CGLib, but i've faced some strange behavior that I cannot explain. Here is what i'm doing. Proxy instance is being created like follows: public static T newInstance(Long sourceId,…
darien
  • 1
  • 1
0
votes
3 answers

How to dynamically generate a Java subclass with generics

I have a class that I want to dynamically generate a subclass from and add the proper generic on-the-fly. For example, here is a base class I'd want to extend. public class Foo { private A attribute; // constructor public Foo(A…
Jason
  • 2,006
  • 3
  • 21
  • 36
0
votes
1 answer

Change field value using cglib

Suppose we have object field of class java.lang.reflect.Field. It is possible to change value of that field of object o1 to the value of o2`s field by field.set(o1, o2). I am wondering whether it can be done faster with the help of some library, for…
0
votes
1 answer

Easymock with @TestSubject enhanced with CGLIB

Is there a way to make EasyMock's @TestSubject annottation to work when the test subject object is enhanced with CGLIB? Scenario: the @TestSubject object is a Spring bean which was enhanced with CGLIB in order to apply some aspect (assuming that…
jgslima
  • 83
  • 6
0
votes
1 answer

Mockito-core 2.7.19 and CGLIB

I am running a test that uses google's catch-exception. I am using mockito-core version 2.7.19, catch-exception version 1.2.0 and junit 4.12. When I use the following statement in a test: @RunWith(org.mockito.junit.MockitoJunnitRunner.class)…
Marcelo Ribeiro
  • 113
  • 1
  • 11
0
votes
2 answers

How to add cglib to a OSGI manifest of RCP client?

I want to use cglib in an RCP client. The RCP client is build using maven and the tycho plugin. We are useing a manifest first strategy. This is my MANIFEST.MF: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: INFO+ RCP Common UI…
BetaRide
  • 16,207
  • 29
  • 99
  • 177
0
votes
2 answers

What is the meaning of the return Object in CGLib method intercept or JDK method invoke?

in the method intercept of CGLib proxy: public Object intercept(Object arg0, Method arg1, Object[] arg2, MethodProxy arg3) throws Throwable { // TODO Auto-generated method stub Performance performance = new Performance(); …
Lydoo
  • 15
  • 3
0
votes
1 answer

Cannot start WicketTester

I want to use WicketTester. But the very first line already throws an exception: WicketTester tester = new WicketTester(); The exception is: java.lang.IncompatibleClassChangeError: class net.sf.cglib.core.DebuggingClassWriter has interface…
Jemolah
  • 1,962
  • 3
  • 24
  • 41
0
votes
1 answer

cglib: Java dynamic proxy for class without constructor (HttpUrlConnection)

I'm unable to create dynamic proxy for HttpURLConnection class, since it don't have public constructor to create Enhancer. Coming to requirement, I want to create a dynamic proxy to get details of current connection at run time. I tried using this…
Jyothi Babu Araja
  • 10,076
  • 3
  • 31
  • 38