void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiClass containingClass = PsiTreeUtil.getParentOfType(element, PsiClass.class); if (containingClass == null) { return; } final String className = containingClass.getQualifiedName(); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); if (myReadObject) { final PsiMethod readObjectMethod = factory.createMethodFromText( "private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {" + " throw new java.io.NotSerializableException(\"" + className + "\");" + "}", containingClass); containingClass.add(readObjectMethod); } if (myWriteObject) { final PsiMethod writeObjectMethod = factory.createMethodFromText( "private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {" + " throw new java.io.NotSerializableException(\"" + className + "\");" + "}", containingClass); containingClass.add(writeObjectMethod); } }