Skip to content

Commit

Permalink
Issue checkstyle#12681: removes serializable from violation and audit…
Browse files Browse the repository at this point in the history
… event
  • Loading branch information
rnveach committed Feb 19, 2023
1 parent c9190ed commit 6c1242e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
20 changes: 13 additions & 7 deletions src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

package com.puppycrawl.tools.checkstyle.api;

import java.util.EventObject;

/**
* Raw event for audit.
* <p>
Expand All @@ -37,11 +35,10 @@
*
* @see AuditListener
*/
public final class AuditEvent
extends EventObject {
public final class AuditEvent {

/** Record a version. */
private static final long serialVersionUID = -3774725606973812736L;
/** The object on which the Event initially occurred. */
private final Object source;
/** Filename event associated with. **/
private final String fileName;
/** Violation associated with the event. **/
Expand Down Expand Up @@ -74,11 +71,20 @@ public AuditEvent(Object src, String fileName) {
* @param violation the actual violation
*/
public AuditEvent(Object src, String fileName, Violation violation) {
super(src);
source = src;
this.fileName = fileName;
this.violation = violation;
}

/**
* The object on which the Event initially occurred.
*
* @return the object on which the Event initially occurred
*/
public Object getSource() {
return source;
}

/**
* Returns name of file being audited.
*
Expand Down
19 changes: 3 additions & 16 deletions src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package com.puppycrawl.tools.checkstyle.api;

import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Locale;
Expand All @@ -32,16 +31,12 @@
* message.properties files. The underlying implementation uses
* java.text.MessageFormat.
*
* @noinspection SerializableHasSerializationMethods, ClassWithTooManyConstructors
* @noinspectionreason SerializableHasSerializationMethods - we do not serialize this class
* @noinspection ClassWithTooManyConstructors
* @noinspectionreason ClassWithTooManyConstructors - immutable nature of class requires a
* bunch of constructors
*/
public final class Violation
implements Comparable<Violation>, Serializable {

/** A unique serial version identifier. */
private static final long serialVersionUID = 5675176836184862150L;
implements Comparable<Violation> {

/** The default severity level if one is not specified. */
private static final SeverityLevel DEFAULT_SEVERITY = SeverityLevel.ERROR;
Expand All @@ -64,15 +59,7 @@ public final class Violation
/** Key for the violation format. **/
private final String key;

/**
* Arguments for MessageFormat.
*
* @noinspection NonSerializableFieldInSerializableClass
* @noinspectionreason NonSerializableFieldInSerializableClass - usage of
* 'Serializable' for this api class
* is considered as mistake now, but we do not break api without
* good reason
*/
/** Arguments for MessageFormat. */
private final Object[] args;

/** Name of the resource bundle to get violations from. **/
Expand Down

0 comments on commit 6c1242e

Please sign in to comment.