On Wed, 2008-05-21 at 15:22 +0200, Sebastiaan van Erk wrote:

> Does this always work nicely though, because you need to do a capture 
> which means that the compiler must be able to infer the type... I've had 
> problems before in these kind of situations that for me it seems 
> obvious, but the compiler gives me an error and says it doesn't know 
> what the type should be...

Well, the type inferencer we got with Java 5 is not very smart. For
instance these work:
     
    class MyComp extends Component {
        public MyComp() {
            IModel<Map<Integer, List<String>>> model = getModel();
        }
        
        protected IModel<String> foo() {
            return getModel();
        }
    }

But this isn't:

    class MyComp extends Component {
        public MyComp() {
            bar(getModel());
        }
        
        public void bar(IModel<String> model) {            
        }
    }

In that case you must extract a local variable...

Joni


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to