title: Why does Groovy compiler reject the dependency JSR308 Type Annotations Compiler?
body: <p>I have been struggling to understand why groovyc does not want to compile my code for awhile and I finally narrowed it down to it disliking the dependency <a href="https://mvnrepository.com/artifact/edu.washington.cs.types.jsr308/jsr308-compiler/1.7.1" rel="nofollow noreferrer">JSR308 Type Annotations Compiler</a>, which uses as one of its package names java.lang.annotations.</p>
  
  <p>When groovyc tries to compile my code with this jar in its classpath, the following is printed:</p>
  
  <pre><code>groovyc -cp jsr308-compiler-1.7.5.jar EmptyClass.groovy 
  &gt;&gt;&gt; a serious error occurred: null
  &gt;&gt;&gt; stacktrace:
  java.lang.ExceptionInInitializerError
      at org.codehaus.groovy.classgen.Verifier.&lt;clinit&gt;(Verifier.java:137)
      at org.codehaus.groovy.control.CompilationUnit.&lt;init&gt;(CompilationUnit.java:171)
      at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.&lt;init&gt;(JavaAwareCompilationUnit.java:66)
      at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.&lt;init&gt;(JavaAwareCompilationUnit.java:57)
      at org.codehaus.groovy.tools.FileSystemCompiler.&lt;init&gt;(FileSystemCompiler.java:64)
      at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:224)
      at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:163)
      at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:203)
      at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:187)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:110)
      at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)
  Caused by: java.lang.SecurityException: Prohibited package name: java.lang.annotation
      at java.lang.ClassLoader.preDefineClass(ClassLoader.java:662)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:761)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
      at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:174)
      at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:146)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at org.codehaus.groovy.ast.ClassHelper.&lt;clinit&gt;(ClassHelper.java:129)
      ... 15 more
  </code></pre>
  
  <p>Running <code>javac -cp jsr308-compiler-1.7.5.jar EmptyClass.java</code> successfully compiles the dummy class.</p>
  
  <pre><code>java -version
  openjdk version "1.8.0_222"
  OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
  OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
  </code></pre>
  
  <pre><code>groovy -version
  Groovy Version: 3.0.0-beta-2 JVM: 1.8.0_222 Vendor: Private Build OS: Linux
  </code></pre>
  
  <p>From <a href="https://openjdk.java.net/projects/type-annotations/" rel="nofollow noreferrer">what I have read</a>, the Type Annotations Project was integrated into JDK 8 back in 2014, so I have no idea why groovyc would not recognize this dependency's right to use <code>java.lang.annotation</code> as a package name.</p>
  
  <p>[Update] As requested, here is the code for both EmptyClass.groovy and EmptyClass.java:</p>
  
  <pre><code>public class EmptyClass {
  
  }
  </code></pre>