java-gobject-introspection r121 - in trunk: src/org/gnome/gir/compiler stub-examples
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r121 - in trunk: src/org/gnome/gir/compiler stub-examples
- Date: Sun, 16 Nov 2008 00:24:30 +0000 (UTC)
Author: walters
Date: Sun Nov 16 00:24:30 2008
New Revision: 121
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=121&view=rev
Log:
Generate constants using pool directly rather than <clinit>
Modified:
trunk/src/org/gnome/gir/compiler/CodeFactory.java
trunk/stub-examples/Test.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 Sun Nov 16 00:24:30 2008
@@ -1581,16 +1581,10 @@
return;
}
String fieldName = NameMap.fixIdentifier("n", info.getName());
+ Object value = info.getValue();
FieldVisitor fv = compilation.writer.visitField(ACC_PUBLIC + ACC_STATIC + ACC_FINAL,
- fieldName, type.getDescriptor(), null, null);
+ fieldName, type.getDescriptor(), null, value);
fv.visitEnd();
-
- Object value = info.getValue();
-
- MethodVisitor clinit = compilation.getClinit();
-
- clinit.visitLdcInsn(value);
- clinit.visitFieldInsn(PUTSTATIC, compilation.internalName, fieldName, type.getDescriptor());
}
private void writeJnaCallbackTypeMapper(ClassCompilation compilation) {
Modified: trunk/stub-examples/Test.java
==============================================================================
--- trunk/stub-examples/Test.java (original)
+++ trunk/stub-examples/Test.java Sun Nov 16 00:24:30 2008
@@ -23,6 +23,20 @@
public class Test extends GObject implements TestIface {
+
+ public static final int Foo = 10;
+ public static final int Bar = 20;
+
+ public static void main(int x) {
+
+ switch (x) {
+ case Foo:
+ break;
+ case Bar:
+ break;
+ }
+ }
+
@Deprecated
public String getFoo() {
return (String) get("foo");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]