本文整理汇总了Java中com.siyeh.ig.psiutils.SerializationUtils.isProbablySerializable方法的典型用法代码示例。如果您正苦于以下问题:Java SerializationUtils.isProbablySerializable方法的具体用法?Java SerializationUtils.isProbablySerializable怎么用?Java SerializationUtils.isProbablySerializable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.siyeh.ig.psiutils.SerializationUtils
的用法示例。
在下文中一共展示了SerializationUtils.isProbablySerializable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMethodCallExpression
import com.siyeh.ig.psiutils.SerializationUtils; //导入方法依赖的package包/类
@Override
public void visitMethodCallExpression(
PsiMethodCallExpression methodCallExpression) {
super.visitMethodCallExpression(methodCallExpression);
if (!MethodCallUtils.isSimpleCallToMethod(methodCallExpression,
"java.io.ObjectOutputStream", PsiType.VOID, "writeObject",
CommonClassNames.JAVA_LANG_OBJECT)) {
return;
}
final PsiExpressionList argumentList =
methodCallExpression.getArgumentList();
final PsiExpression[] arguments = argumentList.getExpressions();
if (arguments.length != 1) {
return;
}
final PsiExpression argument = arguments[0];
final PsiType argumentType = argument.getType();
if (argumentType == null) {
return;
}
if (SerializationUtils.isProbablySerializable(argumentType)) {
return;
}
registerError(argument);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:NonSerializableObjectPassedToObjectStreamInspection.java
示例2: visitMethodCallExpression
import com.siyeh.ig.psiutils.SerializationUtils; //导入方法依赖的package包/类
@Override
public void visitMethodCallExpression(
PsiMethodCallExpression methodCallExpression) {
super.visitMethodCallExpression(methodCallExpression);
if (!MethodCallUtils.isSimpleCallToMethod(methodCallExpression,
"javax.servlet.http.HttpSession", PsiType.VOID,
"putValue", CommonClassNames.JAVA_LANG_STRING,
CommonClassNames.JAVA_LANG_OBJECT) &&
!MethodCallUtils.isSimpleCallToMethod(methodCallExpression,
"javax.servlet.http.HttpSession", PsiType.VOID,
"setAttribute", CommonClassNames.JAVA_LANG_STRING,
CommonClassNames.JAVA_LANG_OBJECT)) {
return;
}
final PsiExpressionList argumentList =
methodCallExpression.getArgumentList();
final PsiExpression[] arguments = argumentList.getExpressions();
if (arguments.length != 2) {
return;
}
final PsiExpression argument = arguments[1];
final PsiType argumentType = argument.getType();
if (argumentType == null) {
return;
}
if (SerializationUtils.isProbablySerializable(argumentType)) {
return;
}
registerError(argument);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:NonSerializableObjectBoundToHttpSessionInspection.java
示例3: visitField
import com.siyeh.ig.psiutils.SerializationUtils; //导入方法依赖的package包/类
@Override
public void visitField(@NotNull PsiField field) {
if (field.hasModifierProperty(PsiModifier.TRANSIENT) || field.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
final PsiClass aClass = field.getContainingClass();
if (aClass == null) {
return;
}
if (ignoreAnonymousInnerClasses && aClass instanceof PsiAnonymousClass) {
return;
}
if (!SerializationUtils.isSerializable(aClass)) {
return;
}
if (SerializationUtils.isProbablySerializable(field.getType())) {
return;
}
final boolean hasWriteObject = SerializationUtils.hasWriteObject(aClass);
if (hasWriteObject) {
return;
}
if (isIgnoredSubclass(aClass)) {
return;
}
if (AnnotationUtil.isAnnotated(field, ignorableAnnotations)) {
return;
}
registerFieldError(field, field);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:NonSerializableFieldInSerializableClassInspectionBase.java
示例4: visitReferenceExpression
import com.siyeh.ig.psiutils.SerializationUtils; //导入方法依赖的package包/类
@Override
public void visitReferenceExpression(PsiReferenceExpression expression) {
super.visitReferenceExpression(expression);
if (expression.getQualifierExpression() != null) {
return;
}
final PsiType type = expression.getType();
if (SerializationUtils.isProbablySerializable(type)) {
return;
}
final PsiElement target = expression.resolve();
if (!(target instanceof PsiLocalVariable) && !(target instanceof PsiParameter)) {
return;
}
final PsiVariable variable = (PsiVariable)target;
if (!variable.hasModifierProperty(PsiModifier.FINAL)) {
if (!PsiUtil.isLanguageLevel8OrHigher(variable) ||
!HighlightControlFlowUtil.isEffectivelyFinal(variable, myClassOrLambda, expression)) {
// don't warn on uncompilable code.
return;
}
}
if (PsiTreeUtil.isAncestor(myClassOrLambda, variable, true)) {
return;
}
registerError(expression, myClassOrLambda, type);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:SerializableStoresNonSerializableInspection.java