Jump to content

Recommended Posts

Posted

Coremodding, and bytecode instrumentation in general, are said to leads to compatibility issues with other instrumenters. This I agree with and try to avoid it as much as possible.

However, one could argue that, if they follow the principle above, no modder should ever tinker with my own code. That would mean that I am free to tinker with it without any compatibility issues.

Uses that come into mind are dynamically generated register/init methods, custom run-time methods for debugging purposes, late removal of debug statements, and a few more.

Some of these can be accomplished with other safer, albeit slower, techniques (eg. reflection), so my question is: Is the efficiency worth it?

Posted

I do/did something similar:

https://github.com/Draco18s/ReasonableRealism/blob/master/build.gradle#L49

Scroll all the way to the right, that line is a list of find-replace pairs: the last one is a comment called "uncomment" that when removed enables a section of code.  I had to do this with Reika's API because it would crash Eclipse because it wasn't properly set up to be in the dev environment.  But it compiled and ran in live code just fine.  You could do the same thing with your debug statements, only in reverse.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Oh yeah, that thing. Used it for replacing stuff in my Reference class, didn't think about introducing/removing comments with it. The only issue is that I limit the scope with replaceIn() so that it doesn't go wild on other classes, and I have no idea if two replace scopes are possible with that functionality.

Posted

Just have to make sure the thing you're find/replacing isn't generic. "{uncomment}" isn't something that would ever appear anywhere else in my code,

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Sorry for reviving an old thread.

 

But isn't this what aspect-oriented programming (AspectJ in Java) is all about? And it looks useful, from what I've read about it, and quite well maintainable.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.