problem with javabean property which is also in constructor #68

Closed
jmvanel opened this Issue Nov 12, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@jmvanel

jmvanel commented Nov 12, 2013

There is a problem when in Java source there is a javabean property "prop" which is also in constructor.

// Java:
class T1 {}
class C {
C( T1 prop ) { setProp(prop); };
void setProp( T1 prop ) { this.prop = prop };
T1 getProp() { return prop; };
}

What SHOULD be produced is this :

class C( @BeanProperty var prop : T1 ) {
}

With current translation, where @BeanProperty declaration is done outside of argument, , Scala compiler says when the property is accessed:

ambiguous reference to overloaded definition, both method setProp in class C of type ( prop: T1)Unit and method setProp in class C of type (x$1: T1)Unit match argument types (T1)

timowest added a commit that referenced this issue Nov 14, 2013

@timowest

This comment has been minimized.

Show comment Hide comment
@timowest

timowest Nov 14, 2013

Owner

The problem here is that the setter usage is not converted

The following should work

C( T1 p ) { prop = p; }

Maybe setter usage in constructors could be replaced with field assignment?

Owner

timowest commented Nov 14, 2013

The problem here is that the setter usage is not converted

The following should work

C( T1 p ) { prop = p; }

Maybe setter usage in constructors could be replaced with field assignment?

timowest added a commit that referenced this issue Nov 14, 2013

@timowest timowest closed this Jan 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment