Skip to content

Instantly share code, notes, and snippets.

@pope
Created October 23, 2008 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pope/19127 to your computer and use it in GitHub Desktop.
Save pope/19127 to your computer and use it in GitHub Desktop.
JRuby Bug
class Component {
private Integer id;
public Integer getID() { return id; }
public void setID(id) { this.id = id; }
}
class Container {
private Integer id;
public Integer getID() { return id; }
public void setID(id) { this.id = id; }
private Integer pieceID;
public Integer getPieceID() { return pieceID; }
public void setPieceID(id) { this.pieceID = id; }
}
component = Component.new
component = componentDao.update(component) # returns a new component, so somewhere in the Java code, the ID is being set
container = Container.new
container.setPieceID(component.getID) # fail on the setter
container.setPieceID(java.lang.Integer.new(component.getID)) # this works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment