GP-1678: Create experimental object-based recorder and opinion

This commit is contained in:
Dan
2022-04-28 15:13:01 -04:00
parent 20706efea3
commit 032ae36005
109 changed files with 3184 additions and 481 deletions
@@ -597,15 +597,21 @@ public class DBCachedObjectStoreFactory {
.stream()
.collect(Collectors.toMap(c -> c.getValueClass(), c -> c));
@SuppressWarnings("unchecked")
static <T> PrimitiveCodec<T> getCodec(Class<T> cls) {
return (PrimitiveCodec<T>) Objects.requireNonNull(CODECS_BY_CLASS.get(cls),
"No variant codec for class " + cls);
@SuppressWarnings("unchecked")
PrimitiveCodec<T> obj = (PrimitiveCodec<T>) CODECS_BY_CLASS.get(cls);
if (obj == null) {
throw new IllegalArgumentException("No variant codec for class " + cls);
}
return obj;
}
static PrimitiveCodec<?> getCodec(byte sel) {
return Objects.requireNonNull(CODECS_BY_SELECTOR.get(sel),
"No variant codec with selector " + sel);
PrimitiveCodec<?> obj = CODECS_BY_SELECTOR.get(sel);
if (obj == null) {
throw new IllegalArgumentException("No variant codec with selector " + sel);
}
return obj;
}
}
@@ -17,9 +17,11 @@ package utilities.util;
public class IDHashed<T> {
public final T obj;
public final int hashCode;
public IDHashed(T obj) {
this.obj = obj;
this.hashCode = System.identityHashCode(obj);
}
@Override
@@ -29,7 +31,7 @@ public class IDHashed<T> {
@Override
public int hashCode() {
return System.identityHashCode(obj);
return hashCode;
}
@Override
@@ -0,0 +1,31 @@
/* ###
* IP: GHIDRA
*
* Licensed 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 utilities.util;
public class IDKeyed<T> extends IDHashed<T> {
public IDKeyed(T obj) {
super(obj);
}
@Override
public boolean equals(Object o) {
if (!(o instanceof IDHashed<?>)) {
return false;
}
IDHashed<?> that = (IDHashed<?>) o;
return this.obj == that.obj;
}
}