Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

util/FieldInfo.java 里 getInheritGenericType() 可疑的空指针解引用 #1614

@viennadd

Description

@viennadd

Hi,

我们的代码检查器 Pinpoint 报告了一处可疑的空指针解引用,

if (gd instanceof Class) {
class_gd = (Class<?>) tv.getGenericDeclaration();
}
Type[] arguments = null;
if (class_gd == clazz) {
if (type instanceof ParameterizedType) {
ParameterizedType ptype = (ParameterizedType) type;
arguments = ptype.getActualTypeArguments();
}
} else {
for (Class<?> c = clazz; c != null && c != Object.class && c != class_gd; c = c.getSuperclass()) {
Type superType = c.getGenericSuperclass();
if (superType instanceof ParameterizedType) {
ParameterizedType p_superType = (ParameterizedType) superType;
Type[] p_superType_args = p_superType.getActualTypeArguments();
getArgument(p_superType_args, c.getTypeParameters(), arguments);
arguments = p_superType_args;
}
}
}
if (arguments == null) {
return null;
}
Type actualType = null;
TypeVariable<?>[] typeVariables = class_gd.getTypeParameters();
for (int j = 0; j < typeVariables.length; ++j) {

349 行是否可能返回 false,导致 377 行使用 class_gd 时触发空指针解引用?

祝好,
Sourcebrella Inc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions