M
Marc van Dongen
Dear all,
I've recently started programming in Java and I'm having a problem
with the following class, which is not supposed to be particularly
meaningful as I've made it minimal to highlight the problem:
============================== START ================================
import java.util.Iterator;
public final class Error<T>
{
public final class Error<T>
{
private final T t;
public Error( final T t ) { this.t = t; }
private class ErrorIterator<T> implements Iterator<T>
{
public ErrorIterator( ) { }
public boolean hasNext( ) { return true; }
public T next( ) { return t; }
public void remove( ) { }
}
}
=============================== END =================================
When I try to compile this example I get the following error:
============================== START ================================
Error.java:11: incompatible types
found : T
required: T
public T next( ) { return t; }
=============================== END =================================
I'm using javac 1.6.0_0-internal.
Is this a known error? If so, is there a bug-fix I could download
somewhere?
Thanks in advance for your help.
Regards,
Marc van Dongen
I've recently started programming in Java and I'm having a problem
with the following class, which is not supposed to be particularly
meaningful as I've made it minimal to highlight the problem:
============================== START ================================
import java.util.Iterator;
public final class Error<T>
{
public final class Error<T>
{
private final T t;
public Error( final T t ) { this.t = t; }
private class ErrorIterator<T> implements Iterator<T>
{
public ErrorIterator( ) { }
public boolean hasNext( ) { return true; }
public T next( ) { return t; }
public void remove( ) { }
}
}
=============================== END =================================
When I try to compile this example I get the following error:
============================== START ================================
Error.java:11: incompatible types
found : T
required: T
public T next( ) { return t; }
=============================== END =================================
I'm using javac 1.6.0_0-internal.
Is this a known error? If so, is there a bug-fix I could download
somewhere?
Thanks in advance for your help.
Regards,
Marc van Dongen