Hi!

> This lets you selectively forbid certain methods 


The problem is that the methods used are perfectly fine. The API methods used 
in our program do exist even in Java6. But they get coerced to different 
methods when compiling with Java8. And those new methods do not exist in Java7 
and older -> Boom.


> Out of curiosity, why do you want to get exactly the same bytecode? 

> Does the code compiled with java8 not work under java7?


Exactly that is the case! It just blows up at runtime as the rt.jar from Java7 
does not contain those new methods/interfaces.



The best solution I could come up so far would be to implement some logic in 
maven-compiler-plugin trying to pick up the right version of the toolchain and 
only if it cannot find it fallback to the default jdk.


LieGrue,
strub




> On Friday, 28 November 2014, 8:44, Dawid Weiss <dawid.we...@gmail.com> wrote:
> >T here is also a very cool tool from the Lucene land, written by Uwe 
> >Schindler --
> 
> https://code.google.com/p/forbidden-apis/
> 
> This lets you selectively forbid certain methods from your codebase
> (and the default list of forbidden methods has a strong rationale to
> be discouraged -- locale-sensitive methods, etc.).
> 
> Dawid
> 
> 
> 
> On Fri, Nov 28, 2014 at 1:09 AM, Stephen Connolly
> <stephen.alan.conno...@gmail.com> wrote:
>>  On Thursday, 27 November 2014, Mark Derricutt <m...@talios.com> 
> wrote:
>> 
>>>  On 28 Nov 2014, at 10:32, Igor Fedorenko wrote:
>>> 
>>>  > Out of curiosity, why do you want to get exactly the same 
> bytecode? Does
>>>  > the code compiled with java8 not work under java7?
>>> 
>>>  Mostly - it's due to method signature resolution.  For instance in 
> the JDK
>>>  5 -> 6 change, some functions that used to take `String` were 
> changed to
>>>  take `CharSequence` - when compiling against the JDK6 classes the byte 
> code
>>>  binds against `CharSequence`, thus when running under JDK5 you get
>>>  method-not-found exceptions.
>>> 
>>> 
>>  I hope animal-sniffer has your back for those cases though?
>> 
>> 
>>> 
>>>  --
>>>  Mark Derricutt
>>>  http://www.theoryinpractice.net
>>>  http://plus.google.com/+MarkDerricutt
>>>  http://twitter.com/talios
>>>  http://facebook.com/mderricutt
>>> 
>> 
>> 
>>  --
>>  Sent from my phone
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to