Update specific annotation values that reference javax
diff --git a/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/AnnotationTransformer.java b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/AnnotationTransformer.java
index 5269b93..c9ba8c4 100644
--- a/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/AnnotationTransformer.java
+++ b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/AnnotationTransformer.java
@@ -34,4 +34,20 @@
return new AnnotationTransformer(this.api, super.visitArray(name));
}
+ @Override
+ public void visit(final String name, final Object value) {
+ if (!(value instanceof String)) {
+ super.visit(name, value);
+ return;
+ }
+
+ final String updated = new Replace((String) value)
+ .prefix("{javax.validation.", "{jakarta.validation.")
+ .prefix("javax.persistence.", "jakarta.persistence.")
+ .prefix("javax.xml.ws.", "jakarta.xml.ws.")
+ .get();
+
+ super.visit(name, updated);
+ }
+
}
diff --git a/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/Replace.java b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/Replace.java
new file mode 100644
index 0000000..352190d
--- /dev/null
+++ b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/Replace.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.patch.core;
+
+public class Replace {
+ private String text;
+
+ public Replace(final String text) {
+ this.text = text;
+ }
+
+ public Replace prefix(final String from, final String to) {
+ if (text.startsWith(from)) {
+ text = text.replace(from, to);
+ }
+ return this;
+ }
+
+ public String get() {
+ return text;
+ }
+}