Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Adding a method to the Object Class(intertype declarations)
Adding a method to the Object Class [message #824470] Mon, 19 March 2012 14:01 Go to next message
Adeyemi Adeseye is currently offline Adeyemi Adeseye
Messages: 2
Registered: March 2012
Junior Member
I have a method that I want to add to the Object class as follows:
boolean Object.olderThan(Object value){
		//System.out.println(val+"OLDER");
		return val;
	}

but I am getting the error message typeNotExposedtoWeaver runtime error. Can anyone provide a detailed tip on how to successfully add a method to the Object class ?
Re: Adding a method to the Object Class [message #825211 is a reply to message #824470] Tue, 20 March 2012 11:59 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 368
Registered: July 2009
Senior Member
You are trying to weave into the JDK. In general, this is not possible using LTW. The reason is that the weaver itself is written in Java and the weaver must be loaded before weaving can start. In order to be loaded, some portion of the JDK must be loaded as well. These classes that are loaded before the weaver is cannot be woven.

You must use compile time weaving and weave into your tools.jar to create a new one that contains the new byte code.
Re: Adding a method to the Object Class [message #826701 is a reply to message #825211] Thu, 22 March 2012 07:54 Go to previous message
Adeyemi Adeseye is currently offline Adeyemi Adeseye
Messages: 2
Registered: March 2012
Junior Member
please can you throw more light on how to do this.
Previous Topic:Circular advice precedence - how to?
Next Topic:Error plugin
Goto Forum:
  


Current Time: Fri Jul 25 21:09:26 EDT 2014

Powered by FUDForum. Page generated in 0.03697 seconds