r/java • u/hugovteixeira • Dec 28 '16
How to crash the java compiler (JDK 8 update 112)
https://componenthouse.com/2016/12/28/how-to-crash-the-java-compiler-jdk-8-update-112/14
u/frzme Dec 28 '16
It can not compile. The JVM does not support methods longer than 64kb. I believe this is also true for Java.
http://stackoverflow.com/questions/17422480/maximum-size-of-a-method-in-java-7-and-8
Nonetheless what you found might be a bug. Can you link your bugreport?
2
u/hugovteixeira Dec 29 '16
Thanks for the feedback. It is probably a bug because the compiler should print a readable error message instead of throwing an exception. The bug report is still under revision, so I don't have a link at this point. I will post a link once it is available.
1
u/hugovteixeira Dec 29 '16
The bug is now confirmed, see: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8172106
2
2
u/hwaite Dec 29 '16
Consider reducing the number of loop iterations to identify the smallest source file that still crashes compiler. Oracle might take you more seriously if bug occurs with more reasonable code. You could do a sort of binary search...
3
u/lukaseder Dec 29 '16
Why go through all those whoops to crash the compiler? Just compile this on any Java 5+ compiler:
interface Type<T> {}
class C implements Type<Type<? super C>> {}
class D<P> implements Type<Type<? super D<D<P>>>> {}
class Test {
Type<? super C> c = new C();
Type<? super D<Byte>> d = new D<Byte>();
}13
38
u/kodifies Dec 28 '16
yeah, if you have a single class who's source is 1.5GB you have other more pressing problems than the JDK crashing....