java-gobject-introspection r159 - trunk/src/org/gnome/gir/compiler
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r159 - trunk/src/org/gnome/gir/compiler
- Date: Fri, 9 Jan 2009 20:48:20 +0000 (UTC)
Author: walters
Date: Fri Jan 9 20:48:20 2009
New Revision: 159
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=159&view=rev
Log:
Use correct superclass construtor for opaque (PointerType) args
Modified:
trunk/src/org/gnome/gir/compiler/CodeFactory.java
Modified: trunk/src/org/gnome/gir/compiler/CodeFactory.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/CodeFactory.java (original)
+++ trunk/src/org/gnome/gir/compiler/CodeFactory.java Fri Jan 9 20:48:20 2009
@@ -1667,21 +1667,40 @@
* callbacks and other situations where a structure instance will be created behind
* the scenes. */
if (!foundNamedNew) {
- /* constructor; public no-args */
- MethodVisitor mv = compilation.writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, Type.getInternalName(GTypeMapper.class), "getInstance", Type
- .getMethodDescriptor(getType(GTypeMapper.class), new Type[] {}));
- mv.visitMethodInsn(INVOKESPECIAL, parentInternalName, "<init>", "(Lcom/sun/jna/TypeMapper;)V");
- mv.visitInsn(RETURN);
- Label l1 = new Label();
- mv.visitLabel(l1);
- mv.visitLocalVariable("this", "L" + compilation.internalName + ";", null, l0, l1, 0);
- mv.visitMaxs(0, 0);
- mv.visitEnd();
+ if (hasFields) {
+ /* Structure/Union constructor; public no-args */
+ MethodVisitor mv = compilation.writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitMethodInsn(INVOKESTATIC, Type.getInternalName(GTypeMapper.class), "getInstance", Type
+ .getMethodDescriptor(getType(GTypeMapper.class), new Type[] {}));
+ mv.visitMethodInsn(INVOKESPECIAL, parentInternalName, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(TypeMapper.class) } ));
+ mv.visitInsn(RETURN);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLocalVariable("this", "L" + compilation.internalName + ";", null, l0, l1, 0);
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+ } else {
+ /* Opaque constructor; public no-args */
+ MethodVisitor mv = compilation.writer.visitMethod(ACC_PUBLIC, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { }), null, null);
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitMethodInsn(INVOKESPECIAL, parentInternalName, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { }));
+ mv.visitInsn(RETURN);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLocalVariable("this", "L" + compilation.internalName + ";", null, l0, l1, 0);
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+ }
}
/* If all fields are primitive types, create a constructor using those. This
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]