Coder Social home page Coder Social logo

bjhargrave / transformer-poc Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 9.0 215 KB

Class file and Jar/War file Transformer usable for Jakarta EE package renaming. Now at Eclipse Transformer.

Home Page: https://github.com/eclipse/transformer

License: Apache License 2.0

Java 100.00%
jakarta-ee transformer war war-files renames jar

transformer-poc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

transformer-poc's Issues

Intercept Class.forName and similar calls to perform package renaming dynamically

The transformer can be made to handle renaming all static references, but references to types in a String, which can be assembled at runtime, will need to be handles at runtime.

The tool can mutate the call sites to methods like Class.forName, ClassLoader.loadClass, etc. to call a supplied interceptor method which can inspect the assembled string and perform any renames before calling the method from the original call site.

Handle JPMS module metadata

Package and type names exiting in module-info.class. This metadata should be mutated as necessary for the renamed packages.

Handle OSGi metadata

If the Jar contains OSGi metadata, package and type references in the metadata should be renamed.

OSGi metadata can include the jar manifest as well as other resources like DS component descriptions, etc.

javax.transaction split package handling

In jakarta-rules.properties we currently have this:

	javax/servlet/jsp/jstl/tlv=jakarta/servlet/jsp/jstl/tlv,\
	javax/servlet/jsp/tagext=jakarta/servlet/jsp/tagext,\
	javax/transaction=jakarta/transaction,\
	javax/validation=jakarta/validation,\
	javax/validation/bootstrap=jakarta/validation/bootstrap,\

I don't have the full details on which classes are involved, but I roughly recall the javax.transaction package is now split as some of the classes ship with the JVM and some do not. Transforming everything at runtime will definitely work as, correct or not, all the code will consistently be changed. But any static change will have to agree with other code that compiled against the valid JVM javax.transaction classes.

@nmcl IIRC you lead the JSR that handled the split, do you happen to have the class list handy?
@bjhargrave does the transformer have the ability to target specific classes of a package, leaving others alone?

Define rules for String constant mutation

The constant pool contains String constants among many other constants. These constants may also need renaming if, for example, they refer to a property name which has been renamed.

So the tool should be extended to defines rules, possibly using REGEX, to support renaming String constants.

Handle Nest attributes

JDK 11 introduced NestHost and NestMembers attributes which both hold type names. These attribute need to be mutated if any referenced type is in a renamed package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.