--- old/src/java.desktop/share/classes/javax/sound/midi/Track.java 2016-08-12 17:03:14.000000000 +0300 +++ new/src/java.desktop/share/classes/javax/sound/midi/Track.java 2016-08-12 17:03:14.000000000 +0300 @@ -65,12 +65,12 @@ // TODO: use arrays for faster access // the list containing the events - private ArrayList eventsList = new ArrayList<>(); + private final ArrayList eventsList = new ArrayList<>(); // use a hashset to detect duplicate events in add(MidiEvent) - private HashSet set = new HashSet<>(); + private final HashSet set = new HashSet<>(); - private MidiEvent eotEvent; + private final MidiEvent eotEvent; /** * Package-private constructor. Constructs a new, empty Track object, which @@ -264,6 +264,7 @@ data[2] = 0; } + @Override public void setMessage(int type, byte[] data, int length) throws InvalidMidiDataException { throw new InvalidMidiDataException("cannot modify end of track message"); }