uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roberto Franchini <franch...@celi.it>
Subject TOP default constructor trhows RE
Date Tue, 30 Aug 2011 20:46:35 GMT
hello.
I'm using uimafit and lamdaj to update annotations:

		Iterable<Token> tokens = JCasUtil.select(jCas, Token.class);

		forEach(select(tokens, having(on(Token.class).getNormalForm(),
startsWith("#")))).setKind("HashTag");


This code trhows a runtine excpetion, because TOP has this deafult constructor:

	// This constructor is never called .
	// Have to set "final" values to avoid compile errors
	protected TOP() {
		jcasType = null;
		addr = 0;
		throw new RuntimeException("Internal Error: TOP() constructor should
never be called.");
	}


Lambdaj creates a dinamic proxy via reflection, so it calls TOP()  to
build the proxy for Token:

on(Token.class).


I can do the same thing in different ways, using plain java for each
or google collection/guava.
But lambdaj is very cool :)

Is it possible to avoid to throw the runtime exception?
Cheers,
RF
-- 
Roberto Franchini
L'impossibile รจ inevitabile.
http://www.celi.it
http://www.blogmeter.it
Tel +39.011.562.71.15
jabber:ro.franchini@gmail.com skype:ro.franchini

Mime
View raw message