Git Product home page Git Product logo

batavia's Introduction

batavia

batavia's People

Contributors

bstansberry avatar dependabot[bot] avatar ehsavoie avatar jamezp avatar jfdenise avatar ropalka avatar scottmarlow avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

batavia's Issues

Make the API not filesystem dependent

Currently, the API uses the java.io.File, making it harder to use for example with a remote JAR without having to persist it on the disk to transform or use as a Java agent.

Would this be possible or there are some major issues with the all in-memory approach?

ASM transformer needs NestHost support

To reproduce from wildfly/dist/target/wildfly-20.0.0.Final-SNAPSHOT/modules/system/layers/base/org/bouncycastle/main:

ee8jar2ee9.sh bcprov-jdk15on-1.65.jar /tmp
inputs:
jarname=bcprov-jdk15on-1.65.jar /tmp
Exception in thread "main" java.lang.UnsupportedOperationException: This feature requires ASM7
        at org.objectweb.asm.ClassVisitor.visitNestHost(ClassVisitor.java:150)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:550)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
        at org.wildfly.transformer.asm.TransformerImpl.transform(TransformerImpl.java:99)
        at org.wildfly.transformer.asm.TransformerImpl.transform(TransformerImpl.java:627)
        at org.wildfly.transformer.tool.api.ToolUtils.transformJarFile(ToolUtils.java:104)
        at org.wildfly.transformer.tool.cli.Main.main(Main.java:45)

Transform SSLInformationAssociationHandler constants to jakarta namespace

servlet/src/main/java/io/undertow/servlet/handlers/security/SSLInformationAssociationHandler.java contains:

"javax.servlet.request.cipher_suite"
"javax.servlet.request.key_size"
"javax.servlet.request.ssl_session_id"
"javax.servlet.request.X509Certificate"

These constants must be transformed to jakarta namespace.

Deal with jaxb context factory properties

JAXB includes a couple properties used to resolve interface implementations whose values have changed:

https://github.com/eclipse-ee4j/jaxb-api/blob/master/jaxb-api/src/main/java/jakarta/xml/bind/JAXBContext.java#L308
https://github.com/eclipse-ee4j/jaxb-api/blob/master/jaxb-api/src/main/java/jakarta/xml/bind/ContextFinder.java#L42

These are used to resolve by checking system properties, which is out of scope for batavia, but also using jaxb.properties files on the classpath, which are in scope.

JSF, AJAX-related request headers not transformed

Two cases that should be handled:

  1. we use the library primefaces and the generated AJAX request still produces headers with javax instead of jakarta
    grafik
  2. our code has a action listener which checks for the source (javax.faces.source) of the AJAX request. Those occurences are also not replaced.
    grafik

No Idea how to fix that properly. Affected files might be java, xhtml, js.

Externalize transformation configuration via an API

Some projects may wish to customize the javax -> jakarta or jakarta -> javax transformation process.
We should provide an API that will allow this and have it configurable via our tools (maven, cmdline).

Ensure that compile time Lambdas are supported in ASM based transformer

Tried to transform test.zip and note that the following line doesn't get transformed:

 #591 invokestatic org/wildfly/extension/elytron/ElytronDefinition.lambda$registerAuthConfigFactory$0:(Ljavax/security/auth/message/config/AuthConfigFactory;)Ljava/lang/Void; 

The above is part of:

InnerClasses:
     static #263; //class org/wildfly/extension/elytron/ElytronDefinition$3
     #181; //class org/wildfly/extension/elytron/ElytronDefinition$2
     #175; //class org/wildfly/extension/elytron/ElytronDefinition$1
     public static final #273= #272 of #610; //AttachmentKey=class org/jboss/as/controller/OperationContext$AttachmentKey of class org/jboss/as/controller/OperationContext
     public static #388= #9 of #265; //Parameters=class org/jboss/as/controller/SimpleResourceDefinition$Parameters of class org/jboss/as/controller/SimpleResourceDefinition
     public static #645= #238 of #643; //Builder=class org/jboss/as/controller/StringListAttributeDefinition$Builder of class org/jboss/as/controller/StringListAttributeDefinition
     public static #645= #257 of #666; //Builder=class org/jboss/as/controller/PropertiesAttributeDefinition$Builder of class org/jboss/as/controller/PropertiesAttributeDefinition
     public static final #825= #586 of #614; //Mode=class org/jboss/msc/service/ServiceController$Mode of class org/jboss/msc/service/ServiceController
     public static abstract #645= #900 of #918; //Builder=class org/jboss/as/controller/ListAttributeDefinition$Builder of class org/jboss/as/controller/ListAttributeDefinition
     public static final #923= #922 of #928; //Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
SourceFile: "ElytronDefinition.java"
BootstrapMethods:
  0: #427 invokestatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
    Method arguments:
      #428 (Ljava/lang/Object;)Ljava/lang/Object;
      #429 invokestatic org/wildfly/extension/elytron/capabilities/_private/SecurityEventListener.from:(Ljava/util/function/Consumer;)Lorg/wildfly/extension/elytron/capabilities/_private/SecurityEventListener;
      #430 (Ljava/util/function/Consumer;)Lorg/wildfly/extension/elytron/capabilities/_private/SecurityEventListener;
  1: #427 invokestatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
    Method arguments:
      #590 ()Ljava/lang/Object;
      #591 invokestatic org/wildfly/extension/elytron/ElytronDefinition.lambda$registerAuthConfigFactory$0:(Ljavax/security/auth/message/config/AuthConfigFactory;)Ljava/lang/Void;
      #592 ()Ljava/lang/Void;

test.zip

JSF converter IDs not transformed (xHTML)

e.g.

<o:converter converterId="javax.faces.Number" [...] />

Got it working with the following changes:

jakarta-txt-master.properties

*.xhtml=xhtml-renames.properties

xhtml-renames.properties (new file)

javax.faces.BigDecimal=jakarta.faces.BigDecimal
javax.faces.BigInteger=jakarta.faces.BigInteger
javax.faces.Boolean=jakarta.faces.Boolean
javax.faces.Byte=jakarta.faces.Byte
javax.faces.Character=jakarta.faces.Character
javax.faces.DateTime=jakarta.faces.DateTime
javax.faces.Double=jakarta.faces.Double
javax.faces.Enum=jakarta.faces.Enum
javax.faces.Float=jakarta.faces.Float
javax.faces.Integer=jakarta.faces.Integer
javax.faces.Long=jakarta.faces.Long
javax.faces.Number=jakarta.faces.Number
javax.faces.Short=jakarta.faces.Short

Most probably there could be a better solution for that? Additionally it does not handle cases when a converter is resolved programmatically in java.

Transformer should generate either warning or failure if input jar is signed

Currently, if the input is signed (e.g. bouncycastle signed jar), the transformer should either generate a warning that the output will not be signed. I don't think it should be considered a cause for failing the transformation but that could be another option (with perhaps a command line option to override the failure, so that the user acknowledges that the output is not going to be signed.

Add the ability to exclude files to the SourceTransformerMojo

Currently it is difficult to transform a source tree but override a few of the transformed files with normal files in src/[main|test]/java in the target maven project. This is because (IIRC) the transformed source ends up being compiled, not the normal source.

Enhancement is to add some kind of exclusion setting to the plugin config such that files that match the configured settings don't get transformed and don't get written to the target dir.

This should be reasonably straightforward as the mojo walks the source tree and transforms files one at a time, so applying a check against the config before doing that should work fine.

Add new "direct" rule for JSF RESOURCE_IDENTIFIER

I have a custom JSF resource handler (ResourceHandlerWrapper) which uses ResourceHandler.RESOURCE_IDENTIFIER. The contents of that constant is currently not updated in die class files in WildFly 24 Beta1.

I've modified the file impl/ecl/src/main/resources/org/wildfly/extras/transformer/eclipse/jakarta-direct.properties and added the following line:

/javax.faces.resource=/jakarta.faces.resource

That fixed it for me.

Also need to transform javax.activation => jakarta.activation

We missed handling:

jar tf jakarta.jakartaee-api-9.0.0-RC1.jar | grep activation
jakarta/activation/
jakarta/activation/DataSource.class
jakarta/activation/DataHandler$1.class
jakarta/activation/DataHandler.class
jakarta/activation/CommandMap.class
jakarta/activation/ActivationDataFlavor.class
jakarta/activation/DataContentHandler.class
jakarta/activation/DataContentHandlerFactory.class
jakarta/activation/CommandInfo$Beans$1.class
jakarta/activation/CommandInfo$Beans.class
jakarta/activation/CommandInfo.class
jakarta/activation/MimeType.class
jakarta/activation/MimeTypeParameterList.class
jakarta/activation/MimeTypeParseException.class
jakarta/activation/UnsupportedDataTypeException.class
jakarta/activation/MailcapCommandMap$1.class
jakarta/activation/MailcapCommandMap.class
jakarta/activation/MimetypesFileTypeMap$1.class
jakarta/activation/MimetypesFileTypeMap.class
jakarta/activation/FileTypeMap.class
jakarta/activation/SecuritySupport$1.class
jakarta/activation/SecuritySupport$2.class
jakarta/activation/SecuritySupport$3.class
jakarta/activation/SecuritySupport$4.class
jakarta/activation/SecuritySupport$5.class
jakarta/activation/SecuritySupport.class
jakarta/activation/URLDataSource.class
jakarta/activation/FileDataSource.class
jakarta/activation/CommandObject.class
jakarta/activation/DataHandlerDataSource.class
jakarta/activation/DataSourceDataContentHandler.class
jakarta/activation/ObjectDataContentHandler.class

Add option to allow over-write of target file

It would be convenient to have overwrite option that deletes the outJarFile if it exists already, previous to call to createNewFile. No need to respond, if you agree we could create an issue for that. When I have used Batava or Eclipse Transformer to run the same script repeatedly, it is a pain to have to ensure the output doesn't exist.

ASM transformer needs to handle visitFrame

Need to also handle transforming the javax.json => jakarta.json in:

mv.visitFrame(Opcodes.F_FULL, 3, new Object[] {"org/jboss/logmanager/formatters/JsonFormatter", "java/io/Writer", "javax/json/stream/JsonGeneratorFactory"}, 0, new Object[] {});

Externalize filtering configuration via an API

It should be possible to configure which packages or classes should be transformed or not.
We should allow this via our API and filtering should support:

  • org.foo.package (transform classes just in this package)
  • org.foo.package.* (transform all classes in this package and its subpackages)
  • org.foo.*.impl (transform all classes in packages that match this wildcard pattern)
  • !org.foo.package (do not transform just this package)
  • !org.foo.package.* (do not transform all classes in this package and its subpackages)
  • !org.foo.*.impl (do not transform all classes in packages that match this wildcard pattern)

No dependencies transformer incorrectly handles renames from longer to shorter package names

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.wildfly.transformer.nodeps.TransformerImpl.applyPatches(TransformerImpl.java:253)
at org.wildfly.transformer.nodeps.TransformerImpl.transform(TransformerImpl.java:191)
at org.wildfly.transformer.nodeps.TransformerImpl.transform(TransformerImpl.java:116)
at org.wildfly.transformer.tool.shared.Common.transformJarFile(Common.java:89)
at org.wildfly.transformer.tool.cmdline.Main.main(Main.java:45)

Generated transformation helper classes handling reflection with wrong package name

Both ASM transformer and No-Dependencies transformer are generating 'reflection' helper classes with wrong package for classes that will be moved to different package (according to transformation rules).

Steps to reproduce:

Run ASM or No-Dependencies transformer against servlet-api-2.3 jar with javax/servlet -> jakarta/servlet rename rule.
There will be javax package in transformed jar and it shouldn't be there.

Transform the legacy JAXB xml namespace to the EE 9 one in classes and schema documents

Jakarta XML Binding 3.0 specifies a new http://jakarta.ee/xml/ns/jaxb namespace to replace the old http://java.sun.com/xml/ns/jaxb one. Use of this ns is tested in the Jakarta XML Binding 3.0 TCK and class files written for EE 8 need to be transformed to use it. Code that's been transformed that way does not understand the old namespace (changing that is a separate issue for other projects) so for existing documents to work we also need to transform that string in .xsd, .xjb and .rng files.

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.