This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inconvertible types found : int required: java.lang.Short

 
Alan Christen
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
]Fixed: changed Short to short. Compiled without errors.
Hello,

I was given this source code and asked to compile it: it fails with the error " inconvertible types found : int required: java.lang.Short".

The code does a bitwise shift to convert some hashed (I think) values to integer. The compiler fails when encountering this statement "s >>>= 5;"


The original author of the code swears up and down that it used to compile but cannot help me.

Note that I removed the SQL query from this code snippet due to its size...Any idea what could be the problem?
 
Henry Wong
author
Marshal
Pie
Posts: 21115
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alan Christen wrote:
The original author of the code swears up and down that it used to compile but cannot help me.

Note that I removed the SQL query from this code snippet due to its size...Any idea what could be the problem?


What version of Java you are using, versus what version of Java the original author is using? I am guessing that the difference has to do with autoboxing.

Henry
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic