src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java

Print this page

        

*** 25,34 **** --- 25,35 ---- package jdk.nashorn.internal.runtime; import java.io.Serializable; import java.util.Arrays; + import java.util.LinkedHashMap; import java.util.Map; /** * Class representing a persistent compiled script. */
*** 81,103 **** /** * Returns a map of class names to class bytes. * @return map of class bytes */ public Map<String, byte[]> getClassBytes() { ! return classBytes; } /** * Returns the constants array. * @return constants array */ public Object[] getConstants() { ! return constants; } ! Map<Integer, FunctionInitializer> getInitializers() { ! return initializers; } @Override public int hashCode() { int hash = mainClassName.hashCode(); --- 82,116 ---- /** * Returns a map of class names to class bytes. * @return map of class bytes */ public Map<String, byte[]> getClassBytes() { ! final Map<String, byte[]> clonedMap = new LinkedHashMap<>(); ! for (final Map.Entry<String, byte[]> entry : classBytes.entrySet()) { ! clonedMap.put(entry.getKey(), entry.getValue().clone()); ! } ! return clonedMap; } /** * Returns the constants array. * @return constants array */ public Object[] getConstants() { ! return constants.clone(); } ! /** ! * Returns the function initializers map. ! * @return The initializers map. ! */ ! public Map<Integer, FunctionInitializer> getInitializers() { ! final Map<Integer, FunctionInitializer> clonedMap = new LinkedHashMap<>(); ! for (final Map.Entry<Integer, FunctionInitializer> entry : initializers.entrySet()) { ! clonedMap.put(entry.getKey(), new FunctionInitializer(entry.getValue())); ! } ! return clonedMap; } @Override public int hashCode() { int hash = mainClassName.hashCode();