Skip to content

Event variables should be final #4

Description

@melwil

Variables in events should be final, since the same reference is distributed to all plugins, we should prevent plugins from rewriting information in the Event capsules.

Example:

public class ErrorEvent extends Event {

    private final String message;

    public ErrorEvent(IRCEventPacket packet, Network network) {
        super(network, packet.getRawline(), EventType.ERROR);
        message = packet.getParameter(0);
    }

    public String getMessage() {
        return message;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions