Skip to content

Commit

Permalink
Merge pull request #8318 from stuartwdouglas/8301
Browse files Browse the repository at this point in the history
Don't remove classes from the resettable elements
  • Loading branch information
mkouba authored Apr 1, 2020
2 parents a327a4b + c1416ef commit e931b13
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

Expand All @@ -22,7 +23,21 @@ public MemoryClassPathElement(Map<String, byte[]> resources) {
}

public void reset(Map<String, byte[]> resources) {
this.resources = resources;
Map<String, byte[]> newResources = new HashMap<>(resources);
//we can't delete .class files from the loader
//gizmo may not generate the same function names on restart
//so if we delete them already loaded classes may have problems, as functions they reference
//may have been removed
//see https://github.com/quarkusio/quarkus/issues/8301
for (Map.Entry<String, byte[]> e : this.resources.entrySet()) {
if (newResources.containsKey(e.getKey())) {
continue;
}
if (e.getKey().endsWith(".class")) {
newResources.put(e.getKey(), e.getValue());
}
}
this.resources = newResources;
}

@Override
Expand Down

0 comments on commit e931b13

Please sign in to comment.