Add transient to some overrided field (#12570)

This commit is contained in:
Albumen Kevin 2023-06-19 21:29:24 +08:00 committed by GitHub
parent a941985c99
commit 8ad792c287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 10 deletions

View File

@ -21,6 +21,8 @@ import org.apache.dubbo.config.support.Parameter;
import org.apache.dubbo.rpc.model.ModuleModel; import org.apache.dubbo.rpc.model.ModuleModel;
import org.apache.dubbo.rpc.support.ProtocolUtils; import org.apache.dubbo.rpc.support.ProtocolUtils;
import java.beans.Transient;
import static org.apache.dubbo.common.constants.CommonConstants.INVOKER_LISTENER_KEY; import static org.apache.dubbo.common.constants.CommonConstants.INVOKER_LISTENER_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.REFERENCE_FILTER_KEY; import static org.apache.dubbo.common.constants.CommonConstants.REFERENCE_FILTER_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.REFER_ASYNC_KEY; import static org.apache.dubbo.common.constants.CommonConstants.REFER_ASYNC_KEY;
@ -184,6 +186,7 @@ public abstract class AbstractReferenceConfig extends AbstractInterfaceConfig {
} }
@Override @Override
@Transient
protected boolean isNeedCheckMethod() { protected boolean isNeedCheckMethod() {
return StringUtils.isEmpty(getGeneric()); return StringUtils.isEmpty(getGeneric());
} }

View File

@ -22,6 +22,7 @@ import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.rpc.model.ModuleModel; import org.apache.dubbo.rpc.model.ModuleModel;
import org.apache.dubbo.rpc.model.ScopeModel; import org.apache.dubbo.rpc.model.ScopeModel;
import java.beans.Transient;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -135,11 +136,13 @@ public class ModuleConfig extends AbstractConfig {
} }
@Override @Override
@Transient
public ModuleModel getScopeModel() { public ModuleModel getScopeModel() {
return (ModuleModel) super.getScopeModel(); return (ModuleModel) super.getScopeModel();
} }
@Override @Override
@Transient
protected ScopeModel getDefaultModel() { protected ScopeModel getDefaultModel() {
return ApplicationModel.defaultModel().getDefaultModule(); return ApplicationModel.defaultModel().getDefaultModule();
} }

View File

@ -150,6 +150,7 @@ public abstract class ReferenceConfigBase<T> extends AbstractReferenceConfig {
} }
@Override @Override
@Transient
public Map<String, String> getMetaData() { public Map<String, String> getMetaData() {
return getMetaData(null); return getMetaData(null);
} }

View File

@ -180,6 +180,7 @@ public abstract class ServiceConfigBase<T> extends AbstractServiceConfig {
} }
@Override @Override
@Transient
public Map<String, String> getMetaData() { public Map<String, String> getMetaData() {
return getMetaData(null); return getMetaData(null);
} }

View File

@ -17,14 +17,15 @@
package com.alibaba.dubbo.rpc; package com.alibaba.dubbo.rpc;
import org.apache.dubbo.rpc.model.ServiceModel;
import java.beans.Transient;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.apache.dubbo.rpc.model.ServiceModel;
@Deprecated @Deprecated
public interface Invocation extends org.apache.dubbo.rpc.Invocation { public interface Invocation extends org.apache.dubbo.rpc.Invocation {
@ -184,6 +185,7 @@ public interface Invocation extends org.apache.dubbo.rpc.Invocation {
} }
@Override @Override
@Transient
public Invoker<?> getInvoker() { public Invoker<?> getInvoker() {
return new Invoker.CompatibleInvoker(delegate.getInvoker()); return new Invoker.CompatibleInvoker(delegate.getInvoker());
} }

View File

@ -17,6 +17,10 @@
package com.alibaba.dubbo.rpc; package com.alibaba.dubbo.rpc;
import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import java.beans.Transient;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays; import java.util.Arrays;
@ -24,9 +28,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
public class RpcInvocation implements Invocation, Serializable { public class RpcInvocation implements Invocation, Serializable {
private static final long serialVersionUID = -4355285085441097045L; private static final long serialVersionUID = -4355285085441097045L;
@ -101,6 +102,7 @@ public class RpcInvocation implements Invocation, Serializable {
this.invoker = invoker; this.invoker = invoker;
} }
@Transient
public Invoker<?> getInvoker() { public Invoker<?> getInvoker() {
return invoker; return invoker;
} }

View File

@ -103,6 +103,7 @@ public interface ServiceInstance extends Serializable {
void setApplicationModel(ApplicationModel applicationModel); void setApplicationModel(ApplicationModel applicationModel);
@Transient
ApplicationModel getApplicationModel(); ApplicationModel getApplicationModel();
@Transient @Transient

View File

@ -16,16 +16,17 @@
*/ */
package org.apache.dubbo.rpc; package org.apache.dubbo.rpc;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Stream;
import org.apache.dubbo.common.Experimental; import org.apache.dubbo.common.Experimental;
import org.apache.dubbo.rpc.model.ModuleModel; import org.apache.dubbo.rpc.model.ModuleModel;
import org.apache.dubbo.rpc.model.ScopeModelUtil; import org.apache.dubbo.rpc.model.ScopeModelUtil;
import org.apache.dubbo.rpc.model.ServiceModel; import org.apache.dubbo.rpc.model.ServiceModel;
import java.beans.Transient;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Stream;
/** /**
* Invocation. (API, Prototype, NonThreadSafe) * Invocation. (API, Prototype, NonThreadSafe)
* *
@ -148,6 +149,7 @@ public interface Invocation {
* @return invoker. * @return invoker.
* @transient * @transient
*/ */
@Transient
Invoker<?> getInvoker(); Invoker<?> getInvoker();
void setServiceModel(ServiceModel serviceModel); void setServiceModel(ServiceModel serviceModel);