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

Class cast exception ch.ethz.globis.phtree.v16hd.NodeIteratorListReuse$NodeIterator #40

Closed
adaussy opened this issue Jan 20, 2025 · 4 comments
Assignees
Labels

Comments

@adaussy
Copy link

adaussy commented Jan 20, 2025

When I try to use the PhTree16HD implementation I get the following classcast exception:

Caused by: java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Lch.ethz.globis.phtree.v16hd.NodeIteratorListReuse$NodeIterator; ([Ljava.lang.Object; is in module java.base of loader 'bootstrap'; [Lch.ethz.globis.phtree.v16hd.NodeIteratorListReuse$NodeIterator; is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @4b243038)
	at ch.ethz.globis.phtree.v16hd.NodeIteratorListReuse$PhIteratorStack.<init>(NodeIteratorListReuse.java:44)
	at ch.ethz.globis.phtree.v16hd.NodeIteratorListReuse$PhIteratorStack.<init>(NodeIteratorListReuse.java:43)
	at ch.ethz.globis.phtree.v16hd.NodeIteratorListReuse.<init>(NodeIteratorListReuse.java:213)
	at ch.ethz.globis.phtree.v16hd.PhTree16HD.queryAll(PhTree16HD.java:524)
	at ch.ethz.globis.phtree.v16hd.PhTree16HD.queryAll(PhTree16HD.java:489)

The commit "c4a5edef8fa140d556ef3e18045295385548880c" change the implementation from

private final NodeIterator[] stack = new NodeIteratorListReuse.NodeIterator[64];

To

private final NodeIterator[] stack = (NodeIteratorListReuse.NodeIterator[]) new Object[64];

I think this the cause of the classcastexception. Is this a mistake or could you explain the purpose of that change?

Regards

(Anyway thanks for this awesome library!)

@tzaeschke tzaeschke self-assigned this Jan 20, 2025
@tzaeschke tzaeschke added the bug label Jan 20, 2025
@tzaeschke
Copy link
Owner

Thanks for reporting this!
This was an attempt to fix numerous compilation warnings. Apparently I didn't test it properly.

tzaeschke added a commit that referenced this issue Jan 23, 2025
tzaeschke added a commit that referenced this issue Jan 23, 2025
@tzaeschke
Copy link
Owner

@adaussy I forgot to mention, I merged a fix into the main branch. Feel free to have a look. I plan to do a new release in the next few weeks.

@tzaeschke
Copy link
Owner

tzaeschke commented Feb 2, 2025

I already made a release. This fixes #40. Please reopen if the problem persists.

@adaussy
Copy link
Author

adaussy commented Feb 3, 2025

Thanks I have switched to a new project but as soon as I get back to my previous project I will keep you updated.

Regards

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

No branches or pull requests

2 participants