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

IndexOutOfBoundsException in UseEnumCollections #434

Open
nkavian opened this issue Aug 31, 2022 · 2 comments
Open

IndexOutOfBoundsException in UseEnumCollections #434

nkavian opened this issue Aug 31, 2022 · 2 comments

Comments

@nkavian
Copy link

nkavian commented Aug 31, 2022

It think it's this something like this signature from my class. There is no other usage of a collection or enum other than this inside the class.

enum AnEnum { A, B, C }
public void someMethod(final Collection<AnEnum> collection) {

Stack trace below.

Exception analyzing com.example.MyClass using detector com.mebigfatguy.fbcontrib.detect.UseEnumCollections
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
	at java.base/java.util.Objects.checkIndex(Objects.java:359)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	at com.mebigfatguy.fbcontrib.utils.TernaryPatcher.post(TernaryPatcher.java:87)
	at com.mebigfatguy.fbcontrib.detect.UseEnumCollections.sawOpcode(UseEnumCollections.java:207)
	at edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit(DismantleBytecode.java:878)
	at edu.umd.cs.findbugs.visitclass.BetterVisitor.visitCode(BetterVisitor.java:218)
	at edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitCode(PreorderVisitor.java:243)
	at com.mebigfatguy.fbcontrib.detect.UseEnumCollections.visitCode(UseEnumCollections.java:113)
	at org.apache.bcel.classfile.Code.accept(Code.java:131)
	at edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:315)
	at edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:397)
	at org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:213)
	at edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:38)
	at com.mebigfatguy.fbcontrib.detect.UseEnumCollections.visitClassContext(UseEnumCollections.java:88)
	at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
	at edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$1(FindBugs2.java:1108)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at edu.umd.cs.findbugs.CurrentThreadExecutorService.execute(CurrentThreadExecutorService.java:86)
	at java.base/java.util.concurrent.AbstractExecutorService.invokeAll(AbstractExecutorService.java:247)
	at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1118)
	at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
	at de.tobject.findbugs.builder.FindBugsWorker.runFindBugs(FindBugsWorker.java:314)
	at de.tobject.findbugs.builder.FindBugsWorker.work(FindBugsWorker.java:220)
	at de.tobject.findbugs.actions.FindBugsAction$StartedFromViewJob.runWithProgress(FindBugsAction.java:275)
	at de.tobject.findbugs.FindBugsJob.run(FindBugsJob.java:142)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
@mebigfatguy
Copy link
Owner

there had to have been some code using ? in this that tripped the error? Can you give a sample?

@nkavian
Copy link
Author

nkavian commented Mar 17, 2023

It's been so long, I don't know how to reproduce it. Feel free to close the ticket.

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

No branches or pull requests

2 participants