Skip to content

Commit 8ee7ce4

Browse files
committed
Do not make private class/record member getters/setters private
BridJ does not count the fields this way, which alters the size of the enclosing struct type as seen by BridJ. This causes problems with nested structures, which is used extensively by GStreamer. (The nested structure is believed by BridJ to be shorter than it actually is, therefore potentially breaking offset calculation for other fields.) Since the getters/setters are prefixed with the class name, no inheritance-related name conflicts should occur, therefore it is safe to make them public again.
1 parent 343fbd7 commit 8ee7ce4

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/gir2java/GirParser.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -746,17 +746,11 @@ private void parseRecordField(Element root, ParsingContext context) {
746746
String bridjType = convType.bridjMethodifyTypeName();
747747
JType fieldType = convType.getJType();
748748

749-
String privateAttribute = root.getAttributeValue("private");
750-
int modifier = JMod.PUBLIC;
751-
if ("1".equals(privateAttribute)) {
752-
modifier = JMod.PRIVATE;
753-
}
754-
755-
JMethod getter = record.method(modifier, fieldType, name);
749+
JMethod getter = record.method(JMod.PUBLIC, fieldType, name);
756750
getter.annotate(Field.class).param("value", fieldIdx);
757751
getter.body().directStatement("return this.io.get" + bridjType + "Field(this, " + fieldIdx + ");");
758752

759-
JMethod setter = record.method(modifier, record, name);
753+
JMethod setter = record.method(JMod.PUBLIC, record, name);
760754
setter.annotate(Field.class).param("value", fieldIdx);
761755
setter.param(fieldType, name);
762756
setter.body().directStatement("this.io.set" + bridjType + "Field(this, " + fieldIdx + ", " + name + ");");

0 commit comments

Comments
 (0)