Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

problem with javabean property which is also in constructor #68

Closed
jmvanel opened this Issue · 1 comment

2 participants

@jmvanel

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 timowest referenced this issue from a commit
@timowest timowest Add test #68 29dbcc1
@timowest

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 timowest referenced this issue from a commit
@timowest timowest Extend test #68 8f3d920
@timowest timowest closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.