Comments (11)
I don't think this is an issue we need to worry about.
The string constant is a default value for an annotation element. For example:
This is addressed in the Jakarta Validation API:
Such default values don't appear in classes using the annotation. Just in the annotation class itself.
While one can use Transformer to try and convert the Jakarta API from "javax" to "jakarta", the is more properly done in the source code for the Jakarta API as above.
So in this case, I don't think there is an issue we need to address.
from transformer.
User code can define annotations with defaults. In the case of Bean Validation, the API only works by users defining their own annotations that other developers can use. Those user defined bean validation annotations can legally reference any class.
CDI is an API that also encourages users to create annotations to represent qualifiers, stereotypes, scopes, etc. We can't really guarantee that those annotations don't have defaults that may reference javax classes or have strings that need to be replaced. If users of the annotation didn't explicitly set the value and relied on the default, in that scenario all their code would break.
from transformer.
I understand that String defaults in annotation defining classes may need transformation. That should fall under the general heading of String constant transformation rather then something special for annotation defaults.
I was referring to the example cited above which is itself already handled by Jakarta source code changes.
from transformer.
Sorry, didn't mean to close. Was reading #43 attempting to get a better understanding as they seem like the same issue.
from transformer.
For my benefit as I don't really know the code yet, from a purely user perspective are we saying that if a user references a javax class in a string in a method block or field, we will update that string automatically if the class referenced by the string was renamed. But if the string that references the renamed class is in an annotation or annotation default, they need to handle that themselves and configure it in their string transformations?
Not a challenge, just trying to understand.
from transformer.
And amen to your comment on #43 "This is unfortunately very hard since strings can be anything while class names can only be class names."
I'm still not clear on what our capabilities are with updating strings; if it is all mapped by the user or if there are some things done automatically and where the line is.
from transformer.
The code processes the Constant Pool which hold String constants. It looks for String constant values that are binary type (/
separated), descriptors ((Lclass;)V
) and also direct string replacement (for such configured rules).
But this does not cover .
separated types (which are not used by the JVM) but are commonly written by users. The String constant in the initial comment here is not even a type name. It is a string which contains something resembling a .
separated type name. So absent a direct string rule, it would be unprocessed.
#44 suggests that we probably need more fine grained control over the rules for direct string replacement. This is probably true. We may also want to support more complex string replacements rules including regex to handle certain cases.
from transformer.
That's super clear. Thanks so much. More complex string replacements would be awesome. If I can think of any clever design ideas, I'll raise another issue.
Appreciate the patience :)
from transformer.
Hi, is this still an issue?
from transformer.
Thanks for the nudge. I suspect its ok, but I'll check on our side and update.
from transformer.
Closing since no feedback that the issue still exists.
from transformer.
Related Issues (20)
- Transformed WAR with signed jars won't deploy. HOT 3
- Transformed orm.xml has wrong version number
- TransformerCLI does not update any source code HOT 2
- Is there a way to define custom manifest Entries within the jar goal HOT 5
- Transformer not moving individual classes when modifying bytecode HOT 4
- Filter out inner jar/files HOT 2
- Multithreaded approach HOT 3
- Add timings for high level actions HOT 1
- Add CLI option to set showDateTime with a pattern to the logger
- Wrong transformation of JSR 305 annotations HOT 6
- Very slow transformation of WAR files HOT 1
- Ability to switch to another SignatureRule implementation HOT 2
- Java 21-ea issue HOT 7
- Transform only .java files from javax to jakarta
- Unable to run Eclipse Transformer on Java 21 using the Maven plugin HOT 4
- Parameter 'extensions' is unknown for plugin 'transformer-maven-plugin:0.5.0:jar HOT 1
- java.lang.SecurityException: SHA-256 digest error for com/ibm/as400/access/TunnelProxyServer.class HOT 3
- no main manifest attribute HOT 5
- Transformation of org.eclipse.jetty.servlets.DoSFilter$DoSAsyncListener fails with NPE HOT 2
- Optimized code ManifestActionImpl HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transformer.