Skip to content

IllegalAccessError from ThreeLetterTimeZoneID with JDK 16 #2250

Closed

Description

Description of the problem / feature request:

> Task :compileJava FAILED
/private/var/folders/jf/29g0fz_16w9_3y2db8ylkl540000gn/T/junit1380605189140352106/src/main/java/test/TimeZoneJava16.java:7: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
        return TimeZone.getTimeZone("PST");
                                   ^
     Please report this at https://github.com/google/error-prone/issues/new and include the following:
  
     error-prone version: 2.5.1
     BugPattern: ThreeLetterTimeZoneID
     Stack Trace:
     java.lang.IllegalAccessError: class com.google.errorprone.VisitorState (in unnamed module @0x51b6b93c) cannot access class com.sun.tools.javac.model.JavacElements (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.model to unnamed module @0x51b6b93c
  	at com.google.errorprone.VisitorState.getElements(VisitorState.java:244)
  	at com.google.errorprone.bugpatterns.ThreeLetterTimeZoneID.matchMethodInvocation(ThreeLetterTimeZoneID.java:79)
  	at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:450)

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

See tbroyer/gradle-errorprone-plugin#58

--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED fixes it.

Could there be an automated way of finding out all those cases? From the unit tests exercising all the bug patterns maybe?

What version of Error Prone are you using?

2.5.1

Have you found anything relevant by searching the web?

Related to #1157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions