Skip to content

Change Java fields and methods to type attributes instead of instance attributes#386

Merged
bsteffensmeier merged 3 commits into
ninia:dev_4.1from
bsteffensmeier:pyjobject-type-attributes
Apr 22, 2022
Merged

Change Java fields and methods to type attributes instead of instance attributes#386
bsteffensmeier merged 3 commits into
ninia:dev_4.1from
bsteffensmeier:pyjobject-type-attributes

Conversation

@bsteffensmeier

Copy link
Copy Markdown
Member

The relationship between PyJObjects and their types now more closely resembles
the behavior of normal Python types, allowing special methods such as add
and repr to be picked up by Python when they are defined in Java classes.

Since all attributes of PyJObject have moved to the type the attr dict is no
longer necessary. However, every instance of PyJClass still shares a type so it
is not possible to move attributes of PyJClass to the type. Much of the code
for dealing with instance attributes has moved from PyJObject to PyJClass.

… attributes.

The relationship between PyJObjects and their types now more closely resembles
the behavior of normal Python types, allowing special methods such as __add__
and __repr__ to be picked up by Python when they are defined in Java classes.

Since all attributes of PyJObject have moved to the type the attr dict is no
longer necessary. However, every instance of PyJClass still shares a type so it
is not possible to move attributes of PyJClass to the type. Much of the code
for dealing with instance attributes has moved from PyJObject to PyJClass.
Comment thread src/main/c/Jep/pyembed.c
Comment thread src/main/c/Objects/pyjclass.c
Comment thread src/main/c/Objects/pyjclass.c
Comment thread src/main/c/Objects/pyjclass.c
Comment thread src/main/c/Objects/pyjtype.c Outdated
Comment thread src/main/c/Objects/pyjclass.c Outdated
@bsteffensmeier bsteffensmeier merged commit c5d55fb into ninia:dev_4.1 Apr 22, 2022
@bsteffensmeier bsteffensmeier deleted the pyjobject-type-attributes branch May 4, 2022 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants