java-gobject-introspection r56 - in trunk: src/org/gnome/gir/compiler src/org/gnome/gir/repository stub-examples
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r56 - in trunk: src/org/gnome/gir/compiler src/org/gnome/gir/repository stub-examples
- Date: Sun, 14 Sep 2008 23:14:43 +0000 (UTC)
Author: walters
Date: Sun Sep 14 23:14:43 2008
New Revision: 56
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=56&view=rev
Log:
Write out @Deprecated annotation for deprecated functions
Modified:
trunk/src/org/gnome/gir/compiler/CodeFactory.java
trunk/src/org/gnome/gir/repository/BaseInfo.java
trunk/src/org/gnome/gir/repository/GIntrospectionAPI.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 Sep 14 23:14:43 2008
@@ -3,6 +3,7 @@
import static org.objectweb.asm.Opcodes.AALOAD;
import static org.objectweb.asm.Opcodes.AASTORE;
import static org.objectweb.asm.Opcodes.ACC_ABSTRACT;
+import static org.objectweb.asm.Opcodes.ACC_DEPRECATED;
import static org.objectweb.asm.Opcodes.ACC_ENUM;
import static org.objectweb.asm.Opcodes.ACC_FINAL;
import static org.objectweb.asm.Opcodes.ACC_INTERFACE;
@@ -96,6 +97,7 @@
import org.gnome.gir.repository.TypeTag;
import org.gnome.gir.repository.UnionInfo;
import org.gnome.gir.repository.ValueInfo;
+import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
@@ -1333,8 +1335,16 @@
if (ctx.throwsGError) {
exceptions = new String[] { "org/gnome/gir/gobject/GErrorException" };
}
+
+ if (fi.isDeprecated()) {
+ accessFlags += ACC_DEPRECATED;
+ }
MethodVisitor mv = compilation.writer.visitMethod(accessFlags,
name, descriptor, null, exceptions);
+ if (fi.isDeprecated()) {
+ AnnotationVisitor av = mv.visitAnnotation(Type.getType(Deprecated.class).getDescriptor(), true);
+ av.visitEnd();
+ }
String globalInternalsName = getInternals(fi);
boolean includeThis = (fi.getFlags() & FunctionInfoFlags.IS_METHOD) > 0;
Modified: trunk/src/org/gnome/gir/repository/BaseInfo.java
==============================================================================
--- trunk/src/org/gnome/gir/repository/BaseInfo.java (original)
+++ trunk/src/org/gnome/gir/repository/BaseInfo.java Sun Sep 14 23:14:43 2008
@@ -68,4 +68,8 @@
public String toString() {
return "<" + getClass().getSimpleName() + " ns=" + getNamespace() + " name=" + getName() + ">";
}
+
+ public boolean isDeprecated() {
+ return GIntrospectionAPI.gi.g_base_info_is_deprecated(this);
+ }
}
Modified: trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java (original)
+++ trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java Sun Sep 14 23:14:43 2008
@@ -60,6 +60,7 @@
void g_base_info_ref(BaseInfo info);
void g_base_info_unref(BaseInfo info);
int g_base_info_get_type(Pointer info);
+ boolean g_base_info_is_deprecated(BaseInfo info);
String g_base_info_get_name(Pointer info);
String g_base_info_get_namespace(Pointer info);
String g_base_info_get_annotation(BaseInfo info, String anno);
Modified: trunk/stub-examples/Test.java
==============================================================================
--- trunk/stub-examples/Test.java (original)
+++ trunk/stub-examples/Test.java Sun Sep 14 23:14:43 2008
@@ -21,6 +21,7 @@
public class Test extends GObject implements TestIface {
+ @Deprecated
public String getFoo() {
return (String) get("foo");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]