This is an automated email from the ASF dual-hosted git repository.

nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 862c2a05242 [MINOR] Remove unused SerializableTransient annotation 
(#12267)
862c2a05242 is described below

commit 862c2a05242a9cd538af70dc7588c92e3cf99e1a
Author: Nikolay <[email protected]>
AuthorDate: Wed Aug 13 13:58:46 2025 +0300

    [MINOR] Remove unused SerializableTransient annotation (#12267)
---
 .../optimized/OptimizedClassDescriptor.java        | 86 +---------------------
 .../internal/util/SerializableTransient.java       | 55 --------------
 2 files changed, 2 insertions(+), 139 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedClassDescriptor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedClassDescriptor.java
index ef5d8ba0ae6..1125622a325 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedClassDescriptor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/marshaller/optimized/OptimizedClassDescriptor.java
@@ -43,16 +43,12 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.TreeMap;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentMap;
 
 import org.apache.ignite.internal.binary.GridBinaryMarshaller;
 import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.internal.util.SerializableTransient;
-import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.marshaller.MarshallerContext;
 import org.apache.ignite.marshaller.MarshallerExclusions;
 
@@ -95,8 +91,6 @@ import static 
org.apache.ignite.internal.marshaller.optimized.OptimizedMarshalle
 import static 
org.apache.ignite.internal.marshaller.optimized.OptimizedMarshallerUtils.UUID;
 import static 
org.apache.ignite.internal.marshaller.optimized.OptimizedMarshallerUtils.computeSerialVersionUid;
 import static org.apache.ignite.internal.util.IgniteUtils.isLambda;
-import static org.apache.ignite.marshaller.MarshallerUtils.jobReceiverVersion;
-import static org.apache.ignite.marshaller.MarshallerUtils.jobSenderVersion;
 
 /**
  * Class descriptor.
@@ -174,9 +168,6 @@ class OptimizedClassDescriptor {
     /** Proxy interfaces. */
     private Class<?>[] proxyIntfs;
 
-    /** Method returns serializable transient fields. */
-    private Method serTransMtd;
-
     /**
      * Creates descriptor for class.
      *
@@ -485,26 +476,6 @@ class OptimizedClassDescriptor {
 
                             readObjMtds.add(mtd);
 
-                            final SerializableTransient serTransAn = 
c.getAnnotation(SerializableTransient.class);
-
-                            // Custom serialization policy for transient 
fields.
-                            if (serTransAn != null) {
-                                try {
-                                    serTransMtd = 
c.getDeclaredMethod(serTransAn.methodName(), IgniteProductVersion.class);
-
-                                    int mod = serTransMtd.getModifiers();
-
-                                    if (isStatic(mod) && isPrivate(mod) && 
serTransMtd.getReturnType() == String[].class)
-                                        serTransMtd.setAccessible(true);
-                                    else
-                                        // Set method back to null if it has 
incorrect signature.
-                                        serTransMtd = null;
-                                }
-                                catch (NoSuchMethodException ignored) {
-                                    serTransMtd = null;
-                                }
-                            }
-
                             Field[] clsFields0 = c.getDeclaredFields();
 
                             Map<String, Field> fieldNames = new HashMap<>();
@@ -864,7 +835,7 @@ class OptimizedClassDescriptor {
                 writeTypeData(out);
 
                 out.writeShort(checksum);
-                out.writeSerializable(obj, writeObjMtds, 
fields(obj.getClass(), jobReceiverVersion()));
+                out.writeSerializable(obj, writeObjMtds, fields);
 
                 break;
 
@@ -873,59 +844,6 @@ class OptimizedClassDescriptor {
         }
     }
 
-    /**
-     * Gets list of serializable fields. If {@link #serTransMtd} method
-     * returns list of transient fields, they will be added to other fields.
-     * Transient fields that are not included in that list will be normally
-     * ignored.
-     *
-     * @param cls Class.
-     * @param ver Job sender version.
-     * @return Serializable fields.
-     */
-    @SuppressWarnings("ForLoopReplaceableByForEach")
-    private Fields fields(Class<?> cls, IgniteProductVersion ver) {
-        if (ver == null // No context available.
-            || serTransMtd == null)
-            return fields;
-
-        try {
-            final String[] transFields = serTransMtd == null ? null : 
(String[])serTransMtd.invoke(null, ver);
-
-            if (F.isEmpty(transFields))
-                return fields;
-
-            Map<String, FieldInfo> clsFields = new TreeMap<>();
-
-            for (FieldInfo field : fields.fields.get(0).fields) {
-                clsFields.put(field.fieldName, field);
-            }
-
-            // Add serializable transient fields
-            if (!F.isEmpty(transFields)) {
-                for (int i = 0; i < transFields.length; i++) {
-                    final String fieldName = transFields[i];
-
-                    final Field f = cls.getDeclaredField(fieldName);
-
-                    FieldInfo fieldInfo = new FieldInfo(f, f.getName(),
-                        GridUnsafe.objectFieldOffset(f), 
fieldType(f.getType()));
-
-                    clsFields.put(fieldName, fieldInfo);
-                }
-            }
-
-            List<ClassFields> fields = new ArrayList<>(1);
-
-            fields.add(new ClassFields(new ArrayList<>(clsFields.values())));
-
-            return new Fields(fields);
-        }
-        catch (Exception ignored) {
-            return fields;
-        }
-    }
-
     /**
      * @param out Output stream.
      * @throws IOException In case of error.
@@ -958,7 +876,7 @@ class OptimizedClassDescriptor {
             case SERIALIZABLE:
                 verifyChecksum(in.readShort());
 
-                return in.readSerializable(cls, readObjMtds, readResolveMtd, 
fields(cls, jobSenderVersion()));
+                return in.readSerializable(cls, readObjMtds, readResolveMtd, 
fields);
 
             default:
                 assert false : "Unexpected type: " + type;
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/SerializableTransient.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/util/SerializableTransient.java
deleted file mode 100644
index 9105f44977c..00000000000
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/SerializableTransient.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.ignite.internal.util;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.ignite.lang.IgniteProductVersion;
-
-/**
- * Marks class as it has transient fields that should be serialized.
- * Annotated class must have method that returns list of transient
- * fields that should be serialized.
- * <p>
- *     Works only for jobs. For other messages node version is not available.
- * </p>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface SerializableTransient {
-    /**
-     * Name of the private static method that returns list of transient fields
-     * that should be serialized (String[]), and accepts {@link 
IgniteProductVersion}, e.g.
-     * <pre>
-     *     private static String[] fields(IgniteProductVersion ver){
-     *         return ver.compareTo("1.5.30") > 0 ? SERIALIZABLE_FIELDS : null;
-     *     }
-     * </pre>
-     * <p>
-     *     On serialization version argument <tt>ver</tt> is receiver version 
and sender version on deserialization.
-     * </p>
-     * <p>
-     *     If it returns empty array or null all transient fields will be 
normally ignored.
-     * </p>
-     *
-     * @return Name of the method.
-     */
-    String methodName();
-}

Reply via email to