diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2024-06-18 15:37:32 +0200 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2024-06-18 15:37:32 +0200 |
commit | f27a600db14d745cb7f13f8dc839863078b7f1c7 (patch) | |
tree | 188418280d46e1e8b4abd7f36269c475140e7c34 /src/main/java/org/uic/barcode/asn1/uper | |
parent | fix test for dynamic content in years with feb29. (diff) | |
download | UIC-barcode-f27a600db14d745cb7f13f8dc839863078b7f1c7.tar UIC-barcode-f27a600db14d745cb7f13f8dc839863078b7f1c7.tar.gz UIC-barcode-f27a600db14d745cb7f13f8dc839863078b7f1c7.tar.bz2 UIC-barcode-f27a600db14d745cb7f13f8dc839863078b7f1c7.tar.lz UIC-barcode-f27a600db14d745cb7f13f8dc839863078b7f1c7.tar.xz UIC-barcode-f27a600db14d745cb7f13f8dc839863078b7f1c7.tar.zst UIC-barcode-f27a600db14d745cb7f13f8dc839863078b7f1c7.zip |
Diffstat (limited to '')
4 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java b/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java index 6f435c4..0b6c9bd 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/BitStringCoder.java @@ -36,7 +36,8 @@ class BitStringCoder implements Decoder, Encoder { throw new AssertionError("Field should be a list of booleans!"); } - List<Boolean> list = (List<Boolean>)obj; + @SuppressWarnings("unchecked") + List<Boolean> list = (List<Boolean>)obj; if (list.size() != size.value()) { throw new AssertionError( "Declared size (" + size.value() + diff --git a/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java b/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java index 892f851..9f88e37 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/BooleanCoder.java @@ -23,7 +23,7 @@ class BooleanCoder implements Decoder, Encoder { @Override public <T> T decode(BitBuffer bitbuffer, Class<T> classOfT, Field field, Annotation[] extraAnnotations, AsnExtractor extractor) { - Boolean result = new Boolean(bitbuffer.get()); + Boolean result = Boolean.valueOf(bitbuffer.get()); UperEncoder.logger.debug(String.format("BOOL: decoded as %s",result)); return (T) result; } diff --git a/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java b/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java index 5ecb925..4d722de 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/ByteCoder.java @@ -23,7 +23,7 @@ class ByteCoder implements Decoder, Encoder { Class<T> classOfT, Field field, Annotation[] extraAnnotations, AsnExtractor extractor) { UperEncoder.logger.debug("BYTE"); - return (T) new Byte((byte) UperEncoder.decodeConstrainedInt(bitbuffer, UperEncoder.newRange(0, 255, false))); + return (T) Byte.valueOf((byte) UperEncoder.decodeConstrainedInt(bitbuffer, UperEncoder.newRange(0, 255, false))); } @Override diff --git a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java index c256b4f..647a550 100644 --- a/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java +++ b/src/main/java/org/uic/barcode/asn1/uper/UperEncoder.java @@ -334,7 +334,7 @@ public final class UperEncoder { parameterTypes[i] = parameters[i].getClass(); } Constructor<T> constructor = findConsturctor(classOfT, parameters); - boolean constructorIsAccessible = constructor.isAccessible(); + //boolean constructorIsAccessible = constructor.isAccessible(); constructor.setAccessible(true); T result; try { @@ -342,7 +342,7 @@ public final class UperEncoder { } catch (IllegalArgumentException | InvocationTargetException | InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Can't instantiate " + classOfT.getName(), e); } - constructor.setAccessible(constructorIsAccessible); + //constructor.setAccessible(constructorIsAccessible); return result; } @@ -441,7 +441,7 @@ public final class UperEncoder { List<Field> optionalOrdinaryFields = new ArrayList<>(); List<Field> allFields = new ArrayList<>(); // Excluding test instrumentation. - Map<Field, Boolean> originalAccess = new HashMap<>(); + //Map<Field, Boolean> originalAccess = new HashMap<>(); Asn1ContainerFieldSorter(Class<?> type) { @@ -472,7 +472,7 @@ public final class UperEncoder { if (isTestInstrumentation(f) || isNonAsn1Field(f) ) { continue; } - originalAccess.put(f, f.isAccessible()); + //originalAccess.put(f, f.isAccessible()); f.setAccessible(true); if (isExtension(f)) { extensionFields.add(f); @@ -496,10 +496,13 @@ public final class UperEncoder { } } + public void revertAccess() { + /* for (Entry<Field, Boolean> entry : originalAccess.entrySet()) { entry.getKey().setAccessible(entry.getValue()); } + */ } } |