lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: [JENKINS] Lucene-Solr-tests-only-3.x - Build # 12908 - Failure
Date Thu, 29 Mar 2012 20:37:57 GMT
I know. The VM specification does not even need to know the Exception type. If you trick the
Java compiler by generics to think the method cannot throw the exception it will simply compile
the code. If the Exception that is thrown is checked that does not matter, the VM will bubble
up until someone catches.

The only known other sneaky way is this:

static void sneakyThrow(Throwable t) {
  Thread.currentThread().stop(t);
}

But less cool, I agree. The third way is our all fried sun.misc.Unsafe:

Unsafe.theUnsafe.throwException(...)

(needs reflections, as always). Much more uncool.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: dawid.weiss@gmail.com [mailto:dawid.weiss@gmail.com] On Behalf Of
> Dawid Weiss
> Sent: Thursday, March 29, 2012 9:21 PM
> To: dev@lucene.apache.org
> Subject: Re: [JENKINS] Lucene-Solr-tests-only-3.x - Build # 12908 - Failure
> 
> bq. Exploits a weakness in the runtime to throw an arbitrary throwable without
> the traditional declaration.
> 
> This is hardly a weakness; it's part of the JVM spec (or rather: the distinction of
> checked/ unchecked is part of the Java specification not the JVM specification).
> 
> > But it's in my opinion a generics bug in combination with
> > suppresswarnings
> 
> It's an exploit of how generics are (under)specified. Many people think checked
> exceptions are actually a stupid invention, I think it's debatable, some of them
> are really annoying...
> 
> Dawid
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> commands, e-mail: dev-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message