/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache license, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the license for the specific language governing permissions and
 * limitations under the license.
 */
package org.apache.logging.log4j.core.impl;

import java.io.Serializable;

/**
 * Package data for a StackTraceElement.
 */
public class StackTracePackageElement implements Serializable {

    private static final long serialVersionUID = -2171069569241280505L;

    private final boolean exact;

    private final String location;

    private final String version;

    /**
     * Constructor that takes the location, version, and exact match flag.
     * 
     * @param location The location of the Class.
     * @param version The version of the component.
     * @param exact if true this is an exact package element.
     */
    public StackTracePackageElement(final String location, final String version, final boolean exact) {
        this.location = location;
        this.version = version;
        this.exact = exact;
    }

    /**
     * Returns the indicator of whether this is an exact match.
     * 
     * @return true if the location was determined exactly.
     */
    public boolean getExact() {
        return exact;
    }

    /**
     * Returns the location of the element.
     * 
     * @return The location of the element.
     */
    public String getLocation() {
        return location;
    }

    /**
     * Returns the version of the element.
     * 
     * @return the version of the element.
     */
    public String getVersion() {
        return version;
    }

    @Override
    public String toString() {
        final String exactStr = exact ? "" : "~";
        return exactStr + '[' + location + ':' + version + ']';
    }
}

@@ -1621,32 +1621,779 @@
 = exact;%0A    %7D%0A%0A
+@Override%0Apublic boolean equals(Object obj) %7B%0A    if (this == obj) %7B%0A        return true;%0A    %7D%0A    if (obj == null) %7B%0A        return false;%0A    %7D%0A    if (getClass() != obj.getClass()) %7B%0A        return false;%0A    %7D%0A    StackTracePackageElement other = (StackTracePackageElement) obj;%0A    if (this.exact != other.exact) %7B%0A        return false;%0A    %7D%0A    if (this.location == null) %7B%0A        if (other.location != null) %7B%0A            return false;%0A        %7D%0A    %7D else if (!this.location.equals(other.location)) %7B%0A        return false;%0A    %7D%0A    if (this.version == null) %7B%0A        if (other.version != null) %7B%0A            return false;%0A        %7D%0A    %7D else if (!this.version.equals(other.version)) %7B%0A        return false;%0A    %7D%0A    return true;%0A%7D%0A%0A
     /**%0A     * R
@@ -2933,24 +2933,362 @@
 ion;%0A    %7D%0A%0A
+    @Override%0Apublic int hashCode() %7B%0A    final int prime = 31;%0A    int result = 1;%0A    result = prime * result + (this.exact ? 1231 : 1237);%0A    result = prime * result + ((this.location == null) ? 0 : this.location.hashCode());%0A    result = prime * result + ((this.version == null) ? 0 : this.version.hashCode());%0A    return result;%0A%7D%0A%0A
     @Overrid

Add hashCode() and equals(); needed for JSON and XML IO testing.