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

java.lang.NoSuchMethodError - CharBuffer; #314

Open
TreshUp opened this issue Jan 24, 2022 · 2 comments
Open

java.lang.NoSuchMethodError - CharBuffer; #314

TreshUp opened this issue Jan 24, 2022 · 2 comments

Comments

@TreshUp
Copy link

TreshUp commented Jan 24, 2022

Hello, i have a problem of missing method CharBuffer when i'am using jpf (master branch).
Also after launching gradlew.bat i have 5 failed tests (testSimpleReadbackOk, testCalendarHourSetAfterYear, testSimpleParse, testFindResource, testFindResources). Could you please help me to solve this problem.
I found issue #220, but i'm using Java 8 - and variable JAVA_HOME was set. Also i tried to google problem.
Solution from google is to use same versions of JDK and JRE. but i have only one version - 1.8.0_301

java -version
java version "1.8.0_301"
Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)

Here is my testing java example - https://pastebin.com/6htjc5uk
I'm using third party library - edu-mines-jtk, but it was build by me with Java 8.

D:> "C:\Program Files\Java\jdk1.8.0_261\bin\javap.exe" -v .\ArrayInputStream.class | findstr major
major version: 52

And verification for mytest.class:

D:>"C:\Program Files\Java\jdk1.8.0_261\bin\javap.exe" -v "D:\mytest.class" | findstr major
major version: 52

Traceback:

java -jar "_Absolute_path_\jpf\jpf-core\build\RunJPF.jar" "_Absolute_path_\jpf\jpf-core\build\examples\mytest.jpf"
JavaPathfinder core system v8.0 (rev 0cf982c4a70c3478e2d4113c03bbc2b87f8ed777) - (C) 2005-2014 United States Government. All rights reserved.


====================================================== system under test
mytest.main()

====================================================== search started: 24.01.22 16:51

====================================================== error 1
gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.NoSuchMethodError: java.nio.ByteBuffer.asCharBuffer()Ljava/nio/CharBuffer;
        at edu.mines.jtk.io.ArrayInputAdapter.<init>(edu/mines/jtk/io/ArrayInputAdapter.java:117)
        at edu.mines.jtk.io.ArrayInputAdapter.<init>(edu/mines/jtk/io/ArrayInputAdapter.java:70)
        at edu.mines.jtk.io.ArrayInputStream.<init>(edu/mines/jtk/io/ArrayInputStream.java:74)
        at edu.mines.jtk.io.ArrayInputStream.<init>(edu/mines/jtk/io/ArrayInputStream.java:45)
        at edu.mines.jtk.io.ArrayInputStream.<init>(edu/mines/jtk/io/ArrayInputStream.java:54)
        at mytest.main(mytest.java:29)


====================================================== snapshot #1

Thank you in advance!

@cyrille-artho
Copy link
Member

In this case, a particular conversion method (from a byte buffer to a char buffer) is missing. Perhaps this can be added as a model class function. This task is trivial for ASCII encoding but becomes very complicated for Unicode (not that Java is particularly complicated for this, as data on disk is usually in UTF-8 but Java uses UTF-16 internally in memory).
Note that a model class does not have to be efficient, so any valid way to convert bytes to chars would work.

@quadhier
Copy link
Collaborator

All unit tests have passed now. But java.nio.* are not supported yet. So this might be an enhancement.

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

3 participants