Fixed opening file and not closing it.

This led to impossibility to delete file during incremental compilation.
This commit is contained in:
Evgeny Gerashchenko
2014-09-24 15:03:41 +04:00
parent b435904d7f
commit f9b33c4137
3 changed files with 3 additions and 3 deletions
@@ -79,7 +79,7 @@ public class AnonymousObjectTransformer {
if (file == null) { if (file == null) {
throw new RuntimeException("Couldn't find virtual file for " + objectInternalName); throw new RuntimeException("Couldn't find virtual file for " + objectInternalName);
} }
reader = new ClassReader(file.getInputStream()); reader = new ClassReader(file.contentsToByteArray());
} }
} }
catch (IOException e) { catch (IOException e) {
@@ -154,7 +154,7 @@ public class InlineCodegen implements CallGenerator {
MethodNode node; MethodNode node;
if (functionDescriptor instanceof DeserializedSimpleFunctionDescriptor) { if (functionDescriptor instanceof DeserializedSimpleFunctionDescriptor) {
VirtualFile file = InlineCodegenUtil.getVirtualFileForCallable((DeserializedSimpleFunctionDescriptor) functionDescriptor, state); VirtualFile file = InlineCodegenUtil.getVirtualFileForCallable((DeserializedSimpleFunctionDescriptor) functionDescriptor, state);
node = InlineCodegenUtil.getMethodNode(file.getInputStream(), asmMethod.getName(), asmMethod.getDescriptor()); node = InlineCodegenUtil.getMethodNode(file.contentsToByteArray(), asmMethod.getName(), asmMethod.getDescriptor());
if (node == null) { if (node == null) {
throw new RuntimeException("Couldn't obtain compiled function body for " + descriptorName(functionDescriptor)); throw new RuntimeException("Couldn't obtain compiled function body for " + descriptorName(functionDescriptor));
@@ -75,7 +75,7 @@ public class InlineCodegenUtil {
@Nullable @Nullable
public static MethodNode getMethodNode( public static MethodNode getMethodNode(
InputStream classData, byte[] classData,
final String methodName, final String methodName,
final String methodDescriptor final String methodDescriptor
) throws ClassNotFoundException, IOException { ) throws ClassNotFoundException, IOException {