Aladdin - Scala Bugtracking
[#579] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Martin fixed 2006-04-27 15:26:48.0
subject BeanProperty does not change signature (was: [creates repetitive...])
code
package my.webapp.bean.stuff;

import scala.reflect.BeanProperty

class MyBean {
  [BeanProperty]
  var frombulizer: String = _;
}

object Test extends Application {
  
  val x = new MyBean;

  x.frombulizer = "hello" // ok 
  x.setFrombulizer ("hola") 
  val z:String = x.frombulizer // ok
  val zz:String = x.getFrombulizer  
  
}
what happened
test/pending/pos/bug579.scala:15 error: value setFrombulizer is not a member of my.webapp.bean.stuff.MyBean
  x.setFrombulizer ("hola")
   ^
test/pending/pos/bug579.scala:19 error: value getFrombulizer is not a member of my.webapp.bean.stuff.MyBean
  val zz:String = x.getFrombulizer
                   ^
two errors found
compile, then run
[emir@lamppc31 /tmp]$ scala -cp classes my.webapp.bean.stuff.Test
Exception in thread "main" java.lang.ClassFormatError: Repetitive method name/signature in class file my/webapp/\
bean/stuff/MyBean
javap gives what is below. indeed "setFrombulizer" is double, and additionally we have "setfrombulizer" and "get\ frombulizer" methods that are useless IMHO.
[emir@lamppc31 /tmp]$ javap -classpath classes my.webapp.bean.stuff.MyBean
Compiled from "beanTest.scala"
public class my.webapp.bean.stuff.MyBean extends java.lang.Object implements scala.ScalaObject{
    public my.webapp.bean.stuff.MyBean();
    public void setFrombulizer(java.lang.String);
    public java.lang.String getFrombulizer();
    public void setFrombulizer(java.lang.String);
    public java.lang.String getFrombulizer();
    public void setfrombulizer(java.lang.String);
    public java.lang.String getfrombulizer();
    public int $tag();
}
what expected

no type error

[back to overview]
Changes of this bug report
Martin  edited on  2006-04-27 18:34:09.0
Burak  edited on  2006-10-09 14:57:51.0
This bug report use to be related to repetitive signature.
I change it, because the new bug is clearly related to the implementation of the BeanProperty feature.
More precisely, the "SyntethicMethods" phase seems to add implementations but the signature is not changed early enough.
This bug will therefore only affect Scala programs, the Java frameworks depend on the setter/getter methods do work fine.
Martin  edited on  2007-03-08 11:35:58.0
I changed the spec of beanProperty so that this behavior is now the expected case.