package io.netty.util;

import java.io.Serializable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public final class AttributeKey<T> implements Serializable, Comparable<AttributeKey<T>> {

    private static final long serialVersionUID = 2783354860083517323L;

    private static final ConcurrentMap<String, Boolean> names = new ConcurrentHashMap<String, Boolean>();

    private final String name;
    private final Class<T> valueType;

    public AttributeKey(String name, Class<T> valueType) {
        if (name == null) {
            throw new NullPointerException("name");
        }
        if (valueType == null) {
            throw new NullPointerException("valueType");
        }

        if (names.putIfAbsent(name, Boolean.TRUE) != null) {
            throw new IllegalArgumentException("key name already in use: " + name);
        }

        this.name = name;
        this.valueType = valueType;
    }

    public String name() {
        return name;
    }

    public Class<T> valueType() {
        return valueType;
    }

    @Override
    public int hashCode() {
        return System.identityHashCode(this);
    }

    @Override
    public boolean equals(Object o) {
        return this == o;
    }

    @Override
    public int compareTo(AttributeKey<T> o) {
        return name().compareTo(o.name());
    }

    @Override
    public String toString() {
        return name();
    }
}

@@ -475,16 +475,49 @@
 lueType;
+%0A    private final String strVal;
 %0A%0A    pu
@@ -970,32 +970,95 @@
 pe = valueType;%0A
+        strVal = name + '%5B' + valueType.getSimpleName() + '%5D';%0A
     %7D%0A%0A    publi
@@ -1174,188 +1174,8 @@
  %7D%0A%0A
-    @Override%0A    public int hashCode() %7B%0A        return System.identityHashCode(this);%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object o) %7B%0A        return this == o;%0A    %7D%0A%0A
     
@@ -1340,22 +1340,22 @@
  return 
-name()
+strVal
 ;%0A    %7D%0A

Improve AttributeKey.toString()