Merge pull request #694 from redmitry/master

issue-673 fix
diff --git a/src/main/java/org/eclipse/yasson/internal/deserializer/YassonParser.java b/src/main/java/org/eclipse/yasson/internal/deserializer/YassonParser.java
index c17f6ff..36bc251 100644
--- a/src/main/java/org/eclipse/yasson/internal/deserializer/YassonParser.java
+++ b/src/main/java/org/eclipse/yasson/internal/deserializer/YassonParser.java
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
- *
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
+ * 
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0 which is available at
  * http://www.eclipse.org/legal/epl-2.0,
@@ -87,6 +88,11 @@
     }
 
     @Override
+    public Event currentEvent() {
+        return context.getLastValueEvent();
+    }
+    
+    @Override
     public String getString() {
         return delegate.getString();
     }
diff --git a/src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonStructureToParserAdapter.java b/src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonStructureToParserAdapter.java
index dfa9d64..f44999b 100644
--- a/src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonStructureToParserAdapter.java
+++ b/src/main/java/org/eclipse/yasson/internal/jsonstructure/JsonStructureToParserAdapter.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -79,6 +80,11 @@
     }
 
     @Override
+    public Event currentEvent() {
+        return iterators.peek().getValueEvent(getValue());
+    }
+    
+    @Override
     public String getString() {
         return iterators.peek().getString();
     }
@@ -104,6 +110,11 @@
     }
 
     @Override
+    public JsonValue getValue() {
+        return iterators.peek().getValue();
+    }
+
+    @Override
     public JsonObject getObject() {
         JsonStructureIterator current = iterators.peek();
         if (current instanceof JsonObjectIterator) {
@@ -115,6 +126,17 @@
         }
     }
 
+    @Override
+    public JsonArray getArray() {
+        JsonStructureIterator current = iterators.peek();
+        if (current instanceof JsonArrayIterator) {
+            iterators.pop();
+            return getValue().asJsonArray();
+        } else {
+            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, "Outside of array context"));
+        }
+    }
+    
     private JsonNumber getJsonNumberValue() {
         JsonStructureIterator iterator = iterators.peek();
         JsonValue value = iterator.getValue();
@@ -123,7 +145,7 @@
         }
         return (JsonNumber) value;
     }
-
+    
     @Override
     public JsonLocation getLocation() {
         throw new JsonbException("Operation not supported");
diff --git a/src/test/java/org/eclipse/yasson/jsonstructure/Issue673.java b/src/test/java/org/eclipse/yasson/jsonstructure/Issue673.java
new file mode 100644
index 0000000..7aeca3a
--- /dev/null
+++ b/src/test/java/org/eclipse/yasson/jsonstructure/Issue673.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0,
+ * or the Eclipse Distribution License v. 1.0 which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+ */
+
+package org.eclipse.yasson.jsonstructure;
+
+import jakarta.json.Json;
+import jakarta.json.JsonArray;
+import jakarta.json.JsonObject;
+import jakarta.json.JsonString;
+import jakarta.json.JsonValue;
+import jakarta.json.bind.annotation.JsonbSubtype;
+import jakarta.json.bind.annotation.JsonbTypeDeserializer;
+import jakarta.json.bind.annotation.JsonbTypeInfo;
+import jakarta.json.bind.serializer.DeserializationContext;
+import jakarta.json.bind.serializer.JsonbDeserializer;
+import jakarta.json.stream.JsonParser;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.stream.Collectors;
+
+public class Issue673 {
+    
+    public static interface Referenceable {
+
+    }
+
+    public static class Reference implements Referenceable {
+
+        private String description;
+
+        public String getDescription() {
+            return description;
+        }
+
+        public void setDescription(String description) {
+            this.description = description;
+        }
+    }
+
+    public static class IRIReference implements Referenceable {
+
+        private String value;
+
+        public IRIReference() {}
+
+        public IRIReference(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public void setValue(String value) {
+            this.value = value;
+        }
+    }
+
+    @JsonbTypeInfo(key = "type", value = {
+        @JsonbSubtype(alias = Location.TYPE, 
+                      type = Location.class)
+    })
+    public static interface LocationInterface {
+
+    }
+
+    public static class Location implements LocationInterface {
+
+        public final static String TYPE = "Location";
+
+        private String tags;
+        private Referenceable referenceable;
+
+        @JsonbTypeDeserializer(TagsDeserializer.class)
+        public String getTags() {
+            return tags;
+        }
+
+        public void setTags(String tags) {
+            this.tags = tags;
+        }
+        
+        @JsonbTypeDeserializer(ReferenceableDeserializer.class)
+        public Referenceable getReference() {
+            return referenceable;
+        }
+
+        public void setReference(Referenceable referenceable) {
+            this.referenceable = referenceable;
+        }
+    }
+
+    public static class TagsDeserializer implements JsonbDeserializer<String> {
+        @Override
+        public String deserialize(JsonParser jp, DeserializationContext dc, Type type) {
+            final JsonValue v = jp.getArray();
+            if (v instanceof JsonArray arr) {
+                return arr.stream()
+                        .filter(JsonString.class::isInstance)
+                        .map(JsonString.class::cast)
+                        .map(JsonString::getString)
+                        .collect(Collectors.joining(", "));
+            }
+            return null;
+        }
+
+    }
+    
+    public static class ReferenceableDeserializer implements JsonbDeserializer<Referenceable> {
+
+        @Override
+        public Referenceable deserialize(JsonParser jp, DeserializationContext dc, Type type) {
+            final JsonValue v = jp.getValue();
+            if (v instanceof JsonString str) {
+                return new IRIReference(str.getString());
+            }
+            if (v instanceof JsonObject obj) {
+                return dc.deserialize(Reference.class,
+                        Json.createParserFactory(Collections.EMPTY_MAP)
+                                .createParser(obj));
+            }
+            return null;
+        }
+    }
+
+}
diff --git a/src/test/java/org/eclipse/yasson/jsonstructure/JsonStructureToParserAdapterTest.java b/src/test/java/org/eclipse/yasson/jsonstructure/JsonStructureToParserAdapterTest.java
index f6d042a..d76984e 100644
--- a/src/test/java/org/eclipse/yasson/jsonstructure/JsonStructureToParserAdapterTest.java
+++ b/src/test/java/org/eclipse/yasson/jsonstructure/JsonStructureToParserAdapterTest.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -23,6 +24,7 @@
 import jakarta.json.JsonArrayBuilder;
 import jakarta.json.JsonObject;
 import jakarta.json.JsonObjectBuilder;
+import jakarta.json.bind.Jsonb;
 import jakarta.json.bind.JsonbBuilder;
 import jakarta.json.bind.JsonbConfig;
 import jakarta.json.spi.JsonProvider;
@@ -270,4 +272,54 @@
         assertEquals("String value 1", result.getInner().getInnerFirst());
         assertEquals("String value 2", result.getInner().getInnerSecond());
     }
+    
+    @Test
+    public void testGetValue() {
+        final String json = 
+        """
+        {
+            "type": "Location",
+            "reference": "dummy reference"
+        }
+        """;
+        
+        Jsonb jsonb = JsonbBuilder.create();
+        Issue673.LocationInterface result = jsonb.fromJson(json, Issue673.LocationInterface.class);
+	        
+        assertNotNull(result);
+        assertTrue(result instanceof Issue673.Location);
+        Issue673.Location location = (Issue673.Location) result;
+
+        Issue673.Referenceable refAble = location.getReference();
+        assertNotNull(refAble);
+        assertFalse(refAble instanceof Issue673.Reference);
+        assertTrue(refAble instanceof Issue673.IRIReference);
+        Issue673.IRIReference ref = (Issue673.IRIReference) refAble;
+
+        assertEquals("dummy reference", ref.getValue());
+    }
+    
+    @Test
+    public void testGetArray() {
+        final String json = 
+        """
+        {
+            "type": "Location",
+            "tags": ["test1", "test2"]
+        }
+        """;
+        
+        Jsonb jsonb = JsonbBuilder.create();
+        Issue673.LocationInterface result = jsonb.fromJson(json, Issue673.LocationInterface.class);
+        
+        assertNotNull(result);
+        assertTrue(result instanceof Issue673.Location);
+        Issue673.Location location = (Issue673.Location) result;
+        
+        String tags = location.getTags();
+        assertNotNull(tags);
+
+        assertEquals("test1, test2", tags);
+    }
+
 }