B4J Question Beta 6.80 java 8 access Set Problem

stevel05

Expert
Licensed User
Longtime User
The attached project works when compiled and run using B4j 6.51 and jdk1.8.0_181 or jdk1.8.0_192.

Running the same project with the B4j 6.80 Beta (using jdk1.8.0_181 or jdk1.8.0_192) the project compiles and runs, but hangs when accessing an UnmodifiableSet via Javaobject.

Unfortunately you will need the additional jars from my google drive to run it : https://drive.google.com/file/d/1nHeLkglrZofraWJ-xLMVKuX2LK8XkmM4/view?usp=sharing.

Info: It copies a small Git repository to the DirApps folder.
 

Attachments

  • GVT.zip
    34.5 KB · Views: 156
Last edited:

ThRuST

Well-Known Member
Licensed User
Longtime User
Well done Steve. Does it supports JDK v9.0.4 or have you not tested it yet? Since it's not easy to find I link to JDK v9.0.4 get it here

And here's a link to Erel's post about B4J v6.80 BETA with Java 11 support. You'll find it here
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Was going to try it and look but I don't have ABZipUnzip. I cant find a reference to the library to download it.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Does the unzip line unpack the .git.zip to the objects/.git directory, as I just get an empty directory output.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Good question, yes that is the idea, and the data is there as it reads is (at least when compiled in 6.51) This is a cut down version for checking the error, the original app does not copy the files there, they can be anywhere on the disk.

I hadn't looked in the folder I have tried copying it to the temp folder, result is the same, although the reported number of files is different but it still can't access the data stored in the set via JavaObject. I'll check that out as a separate issue I'm still getting my head around the git structure.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Got it working - as you said anything that uses javaobject to access the set fails.
I just wrote some java to do what your code did to log it and to convert to array.

The code is written straight off the top of my head so is really messy lol
 
Last edited:
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Oops forgot the code
B4X:
import java.util.*;
public static void logSet(Set s){
 System.out.println("Set is "+s);
}
public static Object[] setToArray(Set s){
 return s.toArray();
}
public static int getSetSize(Set s){
 return s.size();
}
#End If

(I also replaced all the File.DirApp etc with the real paths but this may not be an issue)
my unzip line looks like this or I get .git/.git
ABZ.ABUnzip("C:/b4j java 11/GitViewTest/Files/.git.zip","C:/b4j java 11/GitViewTest/Objects/")


this is the output I get now
Waiting for debugger to connect...
Program started.
(FileRepository) Repository[C:\b4j java 11\GitViewTest\Objects\.git]
(Git) Git[Repository[C:\b4j java 11\GitViewTest\Objects\.git]]
(Status) org.eclipse.jgit.api.Status@4ece3720
Set is [bin/classes/b4j/example/main.class, src/b4j/example/main.java, shell/src/b4j/example/main_subs_0.java, shell/bin/classes/b4j/example/main.class, shell/bin/classes/b4j/example/main_subs_0.class, shell/src/b4j/example/main.java, shell/bin/classes/subs.txt]
Convert to array
7
Done Conversion
7
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes that now works. Thanks Erel
 
Upvote 0
Top