Consider improvements to how bytecode enhancement works

Description

In terms of what we "write into" the bytecode we should consider:

  • defining more granular interfaces representing the specific types of enhancement done (laziness, bi-directionality, dirty-tracking, etc).

  • we could implement a lot of functionality simply as default impls of these methods on the interfaces. This is a Java 8 feature we can use, so we should. It makes manually writing specific bytecode into the classes unnecessary in most (all?) cases. Easier to read, spot bugs, etc -> easier maintenance!

had some good ideas (including the ones above) on the subject. , anything else you'd add?

Environment

None

Activity

Show:
Steve Ebersole
February 2, 2017, 9:57 PM

What do you mean by "a more specialized approach"? Based on our conversations last week, I would assume you mean that as we develop specialized interfaces for each enhancement capability we allow possibility of attaching interceptor per each capability?

Luis Barreiro
February 2, 2017, 11:51 PM

Exactly!

One more idea is to leverage the instrumentation on JVM to enable runtime enhancement.
More details on https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html

Steve Ebersole
February 3, 2017, 11:59 AM

You writing an agent for runtime enhancement in non-EE uses? We discussed that last week. It's an idea we've discussed for a long time. Problem is none of the team has ever been comfortable writing agents I've looked into it and there are a lot of intricacies to it. I'm more than willing to consider this if someone (1) does the work or (2) gives me practical lessons in how to write them.

Also swears this can be done after classes are loaded. , did you find more about that?

Christian Beikov
February 3, 2017, 7:07 PM

Well you can change method bodies of already loaded classes, but e.g. adding or removing fields is not possible.

Steve Ebersole
February 8, 2017, 2:47 PM

Ok, that does not meet our needs as we absolutely need to add fields and methods.

Assignee

Unassigned

Reporter

Steve Ebersole

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure