Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnitIncompatibleType throws ClassCastException around assertArrayEquals #4291

Closed
XN137 opened this issue Feb 17, 2024 · 1 comment · Fixed by #4367
Closed

JUnitIncompatibleType throws ClassCastException around assertArrayEquals #4291

XN137 opened this issue Feb 17, 2024 · 1 comment · Fixed by #4367

Comments

@XN137
Copy link

XN137 commented Feb 17, 2024

building on jdk 11:

error-prone version: 2.25.0
BugPattern: JUnitIncompatibleType
Stack Trace:
java.lang.ClassCastException: class com.sun.tools.javac.code.Type$ClassType cannot be cast to class com.sun.tools.javac.code.Type$ArrayType (com.sun.tools.javac.code.Type$ClassType and com.sun.tools.javac.code.Type$ArrayType are in module jdk.compiler of loader 'app')
at com.google.errorprone.bugpatterns.collectionincompatibletype.JUnitIncompatibleType.matchMethodInvocation(JUnitIncompatibleType.java:84)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:449)
at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:746)
at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:150)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1666)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)

problematic code:

Map<MyKeyClass, List<byte[]>> byteArrayMap = ...

(...)

} else if (expectedValue instanceof byte[]) {
    assertArrayEquals((byte[]) expectedValue, byteArrayMap.get(index).get(position));
}
@cushon
Copy link
Collaborator

cushon commented Mar 13, 2024

I have a change out for review internally to fix the crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants