diff options
Diffstat (limited to 'src/java/com')
-rw-r--r-- | src/java/com/sun/gluegen/JavaEmitter.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java index 240bb55..4cee09c 100644 --- a/src/java/com/sun/gluegen/JavaEmitter.java +++ b/src/java/com/sun/gluegen/JavaEmitter.java @@ -628,7 +628,7 @@ public class JavaEmitter implements GlueEmitter { cWriter(), cfg.implPackageName(), cfg.implClassName(), - true, // NOTE: we always disambiguate with a suffix now, so this is optional + true, // NOTE: we always disambiguate with a suffix now, so this is optional cfg.allStatic(), (binding.needsNIOWrappingOrUnwrapping() || hasPrologueOrEpilogue), !cfg.nioDirectOnly(binding.getName()), @@ -846,6 +846,7 @@ public class JavaEmitter implements GlueEmitter { String structClassPkg = cfg.packageForStruct(name); PrintWriter writer = null; + PrintWriter newWriter = null; try { writer = openFile( cfg.javaOutputDir() + File.separator + @@ -857,9 +858,9 @@ public class JavaEmitter implements GlueEmitter { if (cfg.nativeOutputUsesJavaHierarchy()) { nRoot += File.separator + CodeGenUtils.packageAsPath(cfg.packageName()); } - PrintWriter newCWriter = openFile(nRoot + File.separator + containingTypeName + "_JNI.c"); - CodeGenUtils.emitAutogeneratedWarning(newCWriter, this); - emitCHeader(newCWriter, containingTypeName); + newWriter = openFile(nRoot + File.separator + containingTypeName + "_JNI.c"); + CodeGenUtils.emitAutogeneratedWarning(newWriter, this); + emitCHeader(newWriter, containingTypeName); } } catch(Exception e) { throw new RuntimeException("Unable to open files for emission of struct class", e); @@ -1008,7 +1009,7 @@ public class JavaEmitter implements GlueEmitter { // Emit (private) C entry point for calling this function pointer CMethodBindingEmitter cEmitter = new CMethodBindingEmitter(binding, - cWriter, + newWriter, structClassPkg, containingTypeName, true, // FIXME: this is optional at this point @@ -1163,8 +1164,8 @@ public class JavaEmitter implements GlueEmitter { writer.flush(); writer.close(); if (needsNativeCode) { - cWriter.flush(); - cWriter.close(); + newWriter.flush(); + newWriter.close(); } } public void endStructs() throws Exception {} |