本文整理汇总了Java中com.siyeh.ig.psiutils.SerializationUtils类的典型用法代码示例。如果您正苦于以下问题:Java SerializationUtils类的具体用法?Java SerializationUtils怎么用?Java SerializationUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerializationUtils类属于com.siyeh.ig.psiutils包,在下文中一共展示了SerializationUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMethod
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// no call to super, so it doesn't drill down
final PsiClass aClass = method.getContainingClass();
if (aClass == null) {
return;
}
if (aClass.isInterface() || aClass.isAnnotationType()) {
return;
}
if (method.hasModifierProperty(PsiModifier.PROTECTED)) {
return;
}
if (aClass.hasModifierProperty(PsiModifier.FINAL) &&
method.hasModifierProperty(PsiModifier.PRIVATE)) {
return;
}
if (!SerializationUtils.isReadResolve(method) &&
!SerializationUtils.isWriteReplace(method)) {
return;
}
if (!SerializationUtils.isSerializable(aClass)) {
return;
}
registerMethodError(method);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ReadResolveAndWriteReplaceProtectedInspection.java
示例2: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
// no call to super, so it doesn't drill down
if (aClass.isInterface() || aClass.isAnnotationType()) {
return;
}
final PsiField field =
aClass.findFieldByName(
HardcodedMethodConstants.SERIAL_VERSION_UID, false);
if (field == null) {
return;
}
final PsiType type = field.getType();
final boolean wrongType = !PsiType.LONG.equals(type);
if (field.hasModifierProperty(PsiModifier.STATIC) &&
field.hasModifierProperty(PsiModifier.PRIVATE) &&
field.hasModifierProperty(PsiModifier.FINAL) &&
!wrongType) {
return;
}
if (!SerializationUtils.isSerializable(aClass)) {
return;
}
registerFieldError(field, Boolean.valueOf(wrongType));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SerialVersionUIDNotStaticFinalInspection.java
示例3: visitField
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitField(PsiField field) {
super.visitField(field);
if (!field.hasModifierProperty(PsiModifier.TRANSIENT)) {
return;
}
final PsiClass containingClass = field.getContainingClass();
if (!SerializationUtils.isSerializable(containingClass)) {
return;
}
final PsiExpression initializer = field.getInitializer();
if (initializer == null &&
!isInitializedInInitializer(field, containingClass) &&
!isInitializedInConstructors(field, containingClass)) {
return;
}
if (SerializationUtils.hasReadObject(containingClass)) {
return;
}
registerFieldError(field);
}
示例4: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
return;
}
if (aClass instanceof PsiTypeParameter || aClass instanceof PsiEnumConstantInitializer) {
return;
}
if (ignoreAnonymousInnerClasses && aClass instanceof PsiAnonymousClass) {
return;
}
final PsiField serialVersionUIDField = aClass.findFieldByName(HardcodedMethodConstants.SERIAL_VERSION_UID, false);
if (serialVersionUIDField != null) {
return;
}
if (!SerializationUtils.isSerializable(aClass)) {
return;
}
if (SerializationUtils.hasWriteReplace(aClass)) {
return;
}
if (isIgnoredSubclass(aClass)) {
return;
}
registerClassError(aClass);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SerializableHasSerialVersionUIDFieldInspectionBase.java
示例5: 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
示例6: visitMethod
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// no call to super, so it doesn't drill down
final PsiClass aClass = method.getContainingClass();
if (aClass == null) {
return;
}
if (aClass.isInterface() || aClass.isAnnotationType()) {
return;
}
if (method.hasModifierProperty(PsiModifier.PRIVATE)) {
return;
}
if (!SerializationUtils.isReadObject(method) &&
!SerializationUtils.isWriteObject(method)) {
return;
}
if (!SerializationUtils.isSerializable(aClass)) {
return;
}
registerMethodError(method);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ReadObjectAndWriteObjectPrivateInspection.java
示例7: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
if (aClass.isInterface() || aClass.isEnum() || aClass.isAnnotationType() || aClass instanceof PsiTypeParameter) {
return;
}
if (aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
return;
}
if (!isExternalizable(aClass)) {
return;
}
final PsiMethod constructor = getNoArgConstructor(aClass);
if (constructor == null) {
if (aClass.hasModifierProperty(PsiModifier.PUBLIC)) {
return;
}
} else {
if (constructor.hasModifierProperty(PsiModifier.PUBLIC)) {
return;
}
}
if (SerializationUtils.hasWriteReplace(aClass)) {
return;
}
registerClassError(aClass, aClass, constructor);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ExternalizableWithoutPublicNoArgConstructorInspectionBase.java
示例8: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
if (aClass.isInterface() || aClass.isAnnotationType()) {
return;
}
if (!SerializationUtils.isSerializable(aClass) || SerializationUtils.hasWriteReplace(aClass)) {
return;
}
PsiClass ancestor = aClass.getSuperClass();
final Set<PsiClass> visitedClasses = new HashSet<PsiClass>(8);
while (ancestor != null && SerializationUtils.isSerializable(ancestor)) {
if (SerializationUtils.hasWriteReplace(ancestor)) {
return;
}
ancestor = ancestor.getSuperClass();
if (!visitedClasses.add(ancestor)) {
return;
}
}
if (ancestor == null || classHasNoArgConstructor(ancestor)) {
return;
}
registerClassError(aClass, ancestor);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SerializableWithUnconstructableAncestorInspection.java
示例9: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
// no call to super, so it doesn't drill down
if (aClass.isInterface() || aClass.isAnnotationType()) {
return;
}
if (!SerializationUtils.isExternalizable(aClass)) {
return;
}
final boolean hasReadObject =
SerializationUtils.hasReadObject(aClass);
final boolean hasWriteObject =
SerializationUtils.hasWriteObject(aClass);
if (!hasWriteObject && !hasReadObject) {
return;
}
registerClassError(aClass, Boolean.valueOf(hasReadObject),
Boolean.valueOf(hasWriteObject));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ExternalizableWithSerializationMethodsInspection.java
示例10: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
return;
}
if (aClass instanceof PsiTypeParameter || !SerializationUtils.isSerializable(aClass)) {
return;
}
final PsiMethod[] methods = aClass.getMethods();
for (final PsiMethod method : methods) {
if (!SerializationUtils.isReadObject(method)) {
continue;
}
if (ControlFlowUtils.methodAlwaysThrowsException(method)) {
return;
}
else {
break;
}
}
if (ignoreThrowable && InheritanceUtil.isInheritor(aClass, false, "java.lang.Throwable")) {
return;
}
registerClassError(aClass);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DeserializableClassInSecureContextInspection.java
示例11: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
if (aClass.isInterface() || aClass.isAnnotationType() || aClass.isEnum()) {
return;
}
if (aClass instanceof PsiTypeParameter || !SerializationUtils.isSerializable(aClass)) {
return;
}
final PsiMethod[] methods = aClass.findMethodsByName("writeObject", true);
for (final PsiMethod method : methods) {
if (!SerializationUtils.isWriteObject(method)) {
continue;
}
if (ControlFlowUtils.methodAlwaysThrowsException((PsiMethod)method.getNavigationElement())) {
return;
}
else {
break;
}
}
if (ignoreThrowable && InheritanceUtil.isInheritor(aClass, false, "java.lang.Throwable")) {
return;
}
registerClassError(aClass);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SerializableClassInSecureContextInspection.java
示例12: visitMethod
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!method.isConstructor()) {
return;
}
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
return;
}
final PsiClass aClass = method.getContainingClass();
if (aClass == null || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
return;
}
if (SerializationUtils.isExternalizable(aClass)) {
final PsiParameterList parameterList = method.getParameterList();
if (parameterList.getParametersCount() == 0) {
return;
}
}
registerMethodError(method, Boolean.FALSE);
}
示例13: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(PsiClass aClass) {
super.visitClass(aClass);
if (aClass.isInterface() || aClass.isEnum()) {
return;
}
if (!aClass.hasModifierProperty(PsiModifier.PUBLIC) || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
return;
}
final PsiMethod[] constructors = aClass.getConstructors();
if (constructors.length > 0) {
return;
}
if (SerializationUtils.isExternalizable(aClass)) {
return;
}
registerClassError(aClass, Boolean.TRUE);
}
示例14: visitMethod
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
//no call to super, so we don't drill into anonymous classes
if (!method.isConstructor()) {
return;
}
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
return;
}
final PsiClass containingClass = method.getContainingClass();
if (containingClass == null) {
return;
}
if (containingClass.hasModifierProperty(PsiModifier.PUBLIC) ||
containingClass.hasModifierProperty(PsiModifier.PROTECTED)) {
return;
}
if (SerializationUtils.isExternalizable(containingClass)) {
final PsiParameterList parameterList = method.getParameterList();
if (parameterList.getParametersCount() == 0) {
return;
}
}
registerModifierError(PsiModifier.PUBLIC, method, method);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PublicConstructorInNonPublicClassInspection.java
示例15: visitClass
import com.siyeh.ig.psiutils.SerializationUtils; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
// no call to super, so it doesn't drill down
if (aClass.isInterface() || aClass.isAnnotationType()) {
return;
}
final boolean hasReadObject =
SerializationUtils.hasReadObject(aClass);
final boolean hasWriteObject =
SerializationUtils.hasWriteObject(aClass);
if (!hasWriteObject && !hasReadObject) {
return;
}
if (SerializationUtils.isSerializable(aClass)) {
return;
}
registerClassError(aClass, Boolean.valueOf(hasReadObject),
Boolean.valueOf(hasWriteObject), aClass);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:NonSerializableWithSerializationMethodsInspection.java