1. public abstract class MyAbstractClass<T>{
2. protected abstract T execute(Job job) throws Exception;
3. }1. class MyConcreteClass extends MyAbstractClass[String]{
2.
3. @throws(classOf[Exception])4. override protected def execute(job: Job[_ <: Serializable]): String = {
5. "test"
6. }
7.
8. }
public class Job<T extends Serializable> implements BreachTask {
...
}
public interface BreachTask extends Serializable {
}
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You should post a minimal self-contained example.
On 11/21/2014 05:26 PM, David wrote:
> Thanks for the replies Clint, but it basically gives the same
> error:
>
> (Note that com.amp.util.Job does not match com.amp.util.Job[_]. To
> implement a raw type, use com.amp.util.Job[_].
>
> On Friday, November 21, 2014 4:54:08 PM UTC-5, Clint Gilbert
> wrote:
>
> Aha, your Java code omits the type param completely. Try this:
>
> override protected def execute(job: Job[_]): String
>
>
>
> On 11/21/2014 04:52 PM, David wrote:
>> |
>
>> override protected def execute(job: Job[_ <: Serializable]):
>> String = {
>
>> |
>
> -- You received this message because you are subscribed to the
> Google Groups "scala-user" group. To unsubscribe from this group
> and stop receiving emails from it, send an email to
> scala-user+...@googlegroups.com
> <mailto:scala-user+unsub...@googlegroups.com>. For more options,
Hi Clint, I've attached a very small jar file containing all the source files.A compile gives the following error:
You weere on the right track but were tripped up be a subtle problem: in the signature of MyScalaConcreteClass#execute you bounded the existential with scala.Serializable, rather than java.io.Serializable
I was able to compile this:
class MyScalaConcreteClass extends MyAbstractClass[String]{
@throws(classOf[Exception])
override protected def execute (job: Job[_ <: java.io.Serializable]):String = {
"test"
}
}
In Scala compilation units, imports of java.lang_, scala._, scala.Predef._ are implied.
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.