Title: Strange getSOmething and setSOmething methods processing
Type: behaviour Severity: normal
Components: Core Versions: 2.5.1
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: pjenvey, shamanzc
Priority: Keywords:

Created on 2010-03-23.15:22:22 by shamanzc, last changed 2010-04-04.18:15:21 by pjenvey.

msg5587 (view) Author: Yuriy Kryvosheiev (shamanzc) Date: 2010-03-23.15:22:20
This is bug or non-documented feature?
  When importing some java class that have methods in following form:
public void getABsomething();
public void setABsomething(int a);
  in other words the method name begins from "get" or "set", than two capital letters and no parameters for "get" and one parameter for "set",  it creates "ABsomething" in class "directory".
Java source:
    public void setPTT(boolean keyUp) {
        eventListener.putEvent(new EventSetPTT(keyUp));

    public void getFFnothingelsematters() {

print dir(ClassName) output:
['CallState', 'FFnothingelsematters', 'PTT', 'PTTState', 'PttState', 'RadioCallType', '__class__', '__delattr__', '__doc__', '__eq__', '__getattribute__', '__hash__', '__init__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'addActivityListener', 'addCallListener', 'addMessageListener', 'addPTTListener', 'addPingListener', 'addRegistrationListener', 'callType', 'class', 'clearGroupCallGroupID', 'destroy', 'equals', 'forcePTT', 'getCallType', 'getClass', 'getFFnothingelsematters', 'getPTTState', 'getRadio', 'hashCode', 'makeGroupCall', 'makePrivateCall', 'makeRadioAlert', 'notify', 'notifyAll', 'pingRadio', 'radio', 'removeActivityListener', 'removeCallListener', 'removeMessageListener', 'removePTTListener', 'removePingListener', 'removeRegistrationListener', 'run', 'setPTT', 'toString', 'wait']
  Pay attention to "getFFnothingelsematters" and "FFnothingelsematters", the same as "setPTT" and "PTT".
  Ofcource "PTT" and "FFnothingelsematters" was surelly not defined in java code (nor was found in compiled .class file).
msg5588 (view) Author: Yuriy Kryvosheiev (shamanzc) Date: 2010-03-23.16:00:14
Probably this part of code guilty:

// Now check if it's a bean property accessor
String name = null;
boolean get = true;
if (methname.startsWith("get") && methname.length() > 3 && n == 0) {
name = methname.substring(3);
} else if (methname.startsWith("is") && methname.length() > 2 && n 0
&& meth.getReturnType() Boolean.TYPE) {
name = methname.substring(2);
} else if (methname.startsWith("set") && methname.length() > 3 && n == 1) {
name = methname.substring(3);
get = false;
msg5626 (view) Author: Philip Jenvey (pjenvey) Date: 2010-04-04.18:15:21
It's a feature, it's documented in the user guide in the "JavaBean Properties" section
Date User Action Args
2010-04-04 18:15:21pjenveysetstatus: open -> closed
resolution: invalid
messages: + msg5626
nosy: + pjenvey
2010-03-23 16:00:14shamanzcsetmessages: + msg5588
2010-03-23 15:22:22shamanzccreate