diff --git a/platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java b/platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java index 51df6b8ef..be7101645 100644 --- a/platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java +++ b/platform/src/main/java/org/teavm/platform/plugin/ResourceProgramTransformer.java @@ -78,7 +78,11 @@ class ResourceProgramTransformer { private void removeCastToResource(CastInstruction cast) { if (!cast.isWeak() && hierarchy.isSuperType(RESOURCE, cast.getTargetType(), false)) { - cast.setWeak(true); + AssignInstruction assign = new AssignInstruction(); + assign.setReceiver(cast.getReceiver()); + assign.setAssignee(cast.getValue()); + assign.setLocation(cast.getLocation()); + cast.replace(assign); } }