Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update springboot 3.2.0 #1266

Merged
merged 12 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<version>3.2.0</version>
</parent>

<groupId>com.alipay.sofa</groupId>
Expand All @@ -37,7 +37,7 @@
<properties>
<revision>4.2.0-SNAPSHOT</revision>
<sofa.boot.version>${revision}</sofa.boot.version>
<spring.boot.version>3.1.5</spring.boot.version>
<spring.boot.version>3.2.0</spring.boot.version>
<!--project-->
<java.version>17</java.version>
<project.encoding>UTF-8</project.encoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.alipay.sofa.runtime.spi.service.BindingConverter;
import com.alipay.sofa.runtime.spi.service.BindingConverterContext;
import com.alipay.sofa.runtime.spi.service.BindingConverterFactory;
import com.alipay.sofa.runtime.spring.bean.LocalVariableTableParameterNameDiscoverer;
import com.alipay.sofa.runtime.spring.bean.SofaBeanNameGenerator;
import com.alipay.sofa.runtime.spring.bean.SofaParameterNameDiscoverer;
import com.alipay.sofa.runtime.spring.factory.ReferenceFactoryBean;
Expand All @@ -60,8 +61,10 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ScannedGenericBeanDefinition;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.NativeDetector;
import org.springframework.core.Ordered;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.PrioritizedParameterNameDiscoverer;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.type.MethodMetadata;
import org.springframework.core.type.StandardMethodMetadata;
Expand Down Expand Up @@ -113,6 +116,11 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
if (parameterNameDiscoverer == null) {
parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
}
// keep compatible for second jars
if (parameterNameDiscoverer instanceof PrioritizedParameterNameDiscoverer prioritizedParameterNameDiscoverer
&& !NativeDetector.inNativeImage()) {
prioritizedParameterNameDiscoverer.addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
}
((AbstractAutowireCapableBeanFactory) beanFactory)
.setParameterNameDiscoverer(new SofaParameterNameDiscoverer(parameterNameDiscoverer, referenceAnnotationWrapper));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
/*
* 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 com.alipay.sofa.runtime.spring.bean;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.asm.ClassReader;
import org.springframework.asm.ClassVisitor;
import org.springframework.asm.Label;
import org.springframework.asm.MethodVisitor;
import org.springframework.asm.Opcodes;
import org.springframework.asm.SpringAsmInfo;
import org.springframework.asm.Type;
import org.springframework.core.BridgeMethodResolver;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
* Deprecate in spring, fork codes for compatible
*/
@Deprecated
public class LocalVariableTableParameterNameDiscoverer implements ParameterNameDiscoverer {

private static final Log logger = LogFactory
.getLog(LocalVariableTableParameterNameDiscoverer.class);

// marker object for classes that do not have any debug info
private static final Map<Executable, String[]> NO_DEBUG_INFO_MAP = Collections
.emptyMap();

// the cache uses a nested index (value is a map) to keep the top level cache relatively small in size
private final Map<Class<?>, Map<Executable, String[]>> parameterNamesCache = new ConcurrentHashMap<>(
32);

@Override
@Nullable
public String[] getParameterNames(Method method) {
Method originalMethod = BridgeMethodResolver.findBridgedMethod(method);
return doGetParameterNames(originalMethod);

Check warning on line 63 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L62-L63

Added lines #L62 - L63 were not covered by tests
}

@Override
@Nullable
public String[] getParameterNames(Constructor<?> ctor) {
return doGetParameterNames(ctor);

Check warning on line 69 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L69

Added line #L69 was not covered by tests
}

@Nullable
private String[] doGetParameterNames(Executable executable) {
Class<?> declaringClass = executable.getDeclaringClass();
Map<Executable, String[]> map = this.parameterNamesCache.computeIfAbsent(declaringClass, this::inspectClass);

Check warning on line 75 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L74-L75

Added lines #L74 - L75 were not covered by tests
return (map != NO_DEBUG_INFO_MAP ? map.get(executable) : null);
}

/**
* Inspects the target class.
* <p>Exceptions will be logged, and a marker map returned to indicate the
* lack of debug information.
*/
private Map<Executable, String[]> inspectClass(Class<?> clazz) {
InputStream is = clazz.getResourceAsStream(ClassUtils.getClassFileName(clazz));

Check warning on line 85 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L85

Added line #L85 was not covered by tests
if (is == null) {
// We couldn't load the class file, which is not fatal as it
// simply means this method of discovering parameter names won't work.
if (logger.isDebugEnabled()) {
logger.debug("Cannot find '.class' file for class [" + clazz

Check warning on line 90 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L90

Added line #L90 was not covered by tests
+ "] - unable to determine constructor/method parameter names");
}
return NO_DEBUG_INFO_MAP;

Check warning on line 93 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L93

Added line #L93 was not covered by tests
}
// We cannot use try-with-resources here for the InputStream, since we have
// custom handling of the close() method in a finally-block.
try {
ClassReader classReader = new ClassReader(is);
Map<Executable, String[]> map = new ConcurrentHashMap<>(32);
classReader.accept(new ParameterNameDiscoveringVisitor(clazz, map), 0);

Check warning on line 100 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L98-L100

Added lines #L98 - L100 were not covered by tests
if (logger.isWarnEnabled()) {
logger
.warn("Using deprecated '-debug' fallback for parameter name resolution. Compile the "

Check warning on line 103 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L102-L103

Added lines #L102 - L103 were not covered by tests
+ "affected code with '-parameters' instead or avoid its introspection: "
+ clazz.getName());

Check warning on line 105 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L105

Added line #L105 was not covered by tests
}
return map;
} catch (IOException ex) {

Check warning on line 108 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L107-L108

Added lines #L107 - L108 were not covered by tests
if (logger.isDebugEnabled()) {
logger.debug("Exception thrown while reading '.class' file for class [" + clazz

Check warning on line 110 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L110

Added line #L110 was not covered by tests
+ "] - unable to determine constructor/method parameter names", ex);
}
} catch (IllegalArgumentException ex) {

Check warning on line 113 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L113

Added line #L113 was not covered by tests
if (logger.isDebugEnabled()) {
logger
.debug(

Check warning on line 116 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L115-L116

Added lines #L115 - L116 were not covered by tests
"ASM ClassReader failed to parse class file ["
+ clazz
+ "], probably due to a new Java class file version that isn't supported yet "
+ "- unable to determine constructor/method parameter names", ex);
}
} finally {
try {
is.close();
} catch (IOException ex) {

Check warning on line 125 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L124-L125

Added lines #L124 - L125 were not covered by tests
// ignore
}

Check warning on line 127 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L127

Added line #L127 was not covered by tests
}
return NO_DEBUG_INFO_MAP;

Check warning on line 129 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L129

Added line #L129 was not covered by tests
}

/**
* Helper class that inspects all methods and constructors and then
* attempts to find the parameter names for the given {@link Executable}.
*/
private static class ParameterNameDiscoveringVisitor extends ClassVisitor {

private static final String STATIC_CLASS_INIT = "<clinit>";

private final Class<?> clazz;

private final Map<Executable, String[]> executableMap;

public ParameterNameDiscoveringVisitor(Class<?> clazz,
Map<Executable, String[]> executableMap) {
super(SpringAsmInfo.ASM_VERSION);
this.clazz = clazz;
this.executableMap = executableMap;
}

Check warning on line 149 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L146-L149

Added lines #L146 - L149 were not covered by tests

@Override
@Nullable
public MethodVisitor visitMethod(int access, String name, String desc, String signature,
String[] exceptions) {
// exclude synthetic + bridged && static class initialization
if (!isSyntheticOrBridged(access) && !STATIC_CLASS_INIT.equals(name)) {
return new LocalVariableTableVisitor(this.clazz, this.executableMap, name, desc,
isStatic(access));

Check warning on line 158 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L157-L158

Added lines #L157 - L158 were not covered by tests
}
return null;

Check warning on line 160 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L160

Added line #L160 was not covered by tests
}

private static boolean isSyntheticOrBridged(int access) {
return (((access & Opcodes.ACC_SYNTHETIC) | (access & Opcodes.ACC_BRIDGE)) > 0);
}

private static boolean isStatic(int access) {
return ((access & Opcodes.ACC_STATIC) > 0);
}
}

private static class LocalVariableTableVisitor extends MethodVisitor {

private static final String CONSTRUCTOR = "<init>";

private final Class<?> clazz;

private final Map<Executable, String[]> executableMap;

private final String name;

private final Type[] args;

private final String[] parameterNames;

private final boolean isStatic;

private boolean hasLvtInfo = false;

Check warning on line 188 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L188

Added line #L188 was not covered by tests

/*
* The nth entry contains the slot index of the LVT table entry holding the
* argument name for the nth parameter.
*/
private final int[] lvtSlotIndex;

public LocalVariableTableVisitor(Class<?> clazz, Map<Executable, String[]> map,
String name, String desc, boolean isStatic) {
super(SpringAsmInfo.ASM_VERSION);
this.clazz = clazz;
this.executableMap = map;
this.name = name;
this.args = Type.getArgumentTypes(desc);
this.parameterNames = new String[this.args.length];
this.isStatic = isStatic;
this.lvtSlotIndex = computeLvtSlotIndices(isStatic, this.args);
}

Check warning on line 206 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L198-L206

Added lines #L198 - L206 were not covered by tests

@Override
public void visitLocalVariable(String name, String description, String signature,
Label start, Label end, int index) {
this.hasLvtInfo = true;

Check warning on line 211 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L211

Added line #L211 was not covered by tests
for (int i = 0; i < this.lvtSlotIndex.length; i++) {
if (this.lvtSlotIndex[i] == index) {
this.parameterNames[i] = name;

Check warning on line 214 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L214

Added line #L214 was not covered by tests
}
}
}

Check warning on line 217 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L217

Added line #L217 was not covered by tests

@Override
public void visitEnd() {
if (this.hasLvtInfo || (this.isStatic && this.parameterNames.length == 0)) {
// visitLocalVariable will never be called for static no args methods
// which doesn't use any local variables.
// This means that hasLvtInfo could be false for that kind of methods
// even if the class has local variable info.
this.executableMap.put(resolveExecutable(), this.parameterNames);

Check warning on line 226 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L226

Added line #L226 was not covered by tests
}
}

Check warning on line 228 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L228

Added line #L228 was not covered by tests

private Executable resolveExecutable() {
ClassLoader loader = this.clazz.getClassLoader();
Class<?>[] argTypes = new Class<?>[this.args.length];

Check warning on line 232 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L231-L232

Added lines #L231 - L232 were not covered by tests
for (int i = 0; i < this.args.length; i++) {
argTypes[i] = ClassUtils.resolveClassName(this.args[i].getClassName(), loader);

Check warning on line 234 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L234

Added line #L234 was not covered by tests
}
try {
if (CONSTRUCTOR.equals(this.name)) {
return this.clazz.getDeclaredConstructor(argTypes);

Check warning on line 238 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L238

Added line #L238 was not covered by tests
}
return this.clazz.getDeclaredMethod(this.name, argTypes);
} catch (NoSuchMethodException ex) {
throw new IllegalStateException(

Check warning on line 242 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L240-L242

Added lines #L240 - L242 were not covered by tests
"Method ["
+ this.name
+ "] was discovered in the .class file but cannot be resolved in the class object",
ex);
}
}

private static int[] computeLvtSlotIndices(boolean isStatic, Type[] paramTypes) {
int[] lvtIndex = new int[paramTypes.length];

Check warning on line 251 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L251

Added line #L251 was not covered by tests
int nextIndex = (isStatic ? 0 : 1);
for (int i = 0; i < paramTypes.length; i++) {
lvtIndex[i] = nextIndex;

Check warning on line 254 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L254

Added line #L254 was not covered by tests
if (isWideType(paramTypes[i])) {
nextIndex += 2;

Check warning on line 256 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L256

Added line #L256 was not covered by tests
} else {
nextIndex++;

Check warning on line 258 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L258

Added line #L258 was not covered by tests
}
}
return lvtIndex;

Check warning on line 261 in sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/bean/LocalVariableTableParameterNameDiscoverer.java#L261

Added line #L261 was not covered by tests
}

private static boolean isWideType(Type aType) {
// float is not a wide type
return (aType == Type.LONG_TYPE || aType == Type.DOUBLE_TYPE);
}
}

}
20 changes: 4 additions & 16 deletions sofa-boot-project/sofaboot-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<maven-java-formatter-plugin.version>0.4</maven-java-formatter-plugin.version>
<maven-pmd-plgun.version>3.19.0</maven-pmd-plgun.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<maven-jacoco-plugin.version>0.8.9</maven-jacoco-plugin.version>
<maven-jacoco-plugin.version>0.8.11</maven-jacoco-plugin.version>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
<!-- sofa stack lib-->
<sofa.registry.version>6.1.8</sofa.registry.version>
Expand All @@ -28,11 +28,11 @@
<sofa.common.tools.version>2.0.1</sofa.common.tools.version>
<sofa.bolt.version>1.6.6</sofa.bolt.version>
<sofa.hessian.version>3.5.1</sofa.hessian.version>
<sofa.ark.version>2.2.3</sofa.ark.version>
<sofa.ark.version>3.0.1-SNAPSHOT</sofa.ark.version>
<sofa.lookout.version>1.6.1</sofa.lookout.version>
<!--3rd lib dependency-->
<spring.cloud.version>2022.0.3</spring.cloud.version>
<asm.version>9.4</asm.version>
<spring.cloud.version>2023.0.0</spring.cloud.version>
<asm.version>9.5</asm.version>
<fastjson.version>1.2.83</fastjson.version>
<javassist.version>3.29.2-GA</javassist.version>
<protobuf.version>3.22.2</protobuf.version>
Expand Down Expand Up @@ -537,18 +537,6 @@
<version>${commons.io.version}</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;

/**
*
* @author yuanxuan
* @version : RpcSofaBootApplication.java, v 0.1 2023年02月03日 15:19 yuanxuan Exp $
*/
@SpringBootApplication
@ComponentScan(excludeFilters = { @ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.alipay.sofa.smoke.tests.rpc.boot.*") })
@SpringBootApplication(scanBasePackages = "none")
public class RpcSofaBootApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>

<dependency>
Expand Down
Loading