B4J Question Java 9

Daestrum

Expert
Licensed User
Longtime User
Can we use Java 9 as it has been released now ?
 

Daestrum

Expert
Licensed User
Longtime User
I have found javaobject can cause some warn messages

To reduce them (to one line per warning) you can add
B4X:
 #VirtualMachineArgs: --illegal-access=warn

Then you just get one line of warning
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
First observation is a difference in font size for views between Java 8 and Java 9 for a B4J UI application (Look4How is a sample application in progress).
Have not explored further yet. See screenshots:
upload_2017-9-24_9-30-5.png
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Here is one of the messages (I know the code is not normal usage)
WARNING: Illegal reflective access by anywheresoftware.b4j.object.JavaObject (file:/C:/Program%20Files%20(x86)/Anywhere%20Software/B4J%20%205.82/Libraries/JavaObject.jar) to method sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.getType()

If I use
B4X:
Dim rtttype As Object = asJO(con ).RunMethodJO("getAnnotatedReturnType",Null).RunMethod("getType",Null)
I get the warning

If I use
B4X:
Dim rtttype As Object = asJO(Me).RunMethod("getReturnTypeInConstructor",Array(con))
...
public static Object getReturnTypeInConstructor(Constructor c){
Class<?> t = c.getAnnotatedReturnType().getType().getClass();
System.out.println("ret type : "+ c.getAnnotatedReturnType().getType().getTypeName());
return c.getAnnotatedReturnType().getType();
}
...
There is no warning issued.
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
First observation is a difference in font size for views between Java 8 and Java 9 for a B4J UI application (Look4How is a sample application in progress).
Have not explored further yet. See screenshots:
View attachment 59957
Maybe they also integrated a new css theme other than caspian?
 
Upvote 0

udg

Expert
Licensed User
Longtime User
No, they're simply growing older so they need larger characters to ease their reading ..eheh
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
There is a lot to explore in the JDK9. Might be worth building a summary of changes.
Just an example related to CSS - See the JDK9 Package javafx.css, select the CSS Reference Guide.

Tooltip: Set the tooltip durations, font size and background color. This applies to all views defined in a form.
Create an external Stylesheet "styles.css" in the dirassets folder, which is added to the B4J Files Manager:
B4X:
.tooltip {                 
    -fx-show-delay: 250ms;
    -fx-show-duration: 2500ms; 
    -fx-hide-delay: 200ms;
    -fx-background-radius: 2 2 2 2;
    -fx-background-color: linear-gradient(#FFFFFF, #DEDEDE);
    -fx-text-fill: black;
    -fx-font-size: 18px;
}

// add more styles

and load like
B4X:
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "styles.css"))
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
I have currently problems, that the css files of a mac and of windows seems to be different in size. Today i had to correct a design, which was ~ 15% bigger on a mac than on windows. Maybe the size is now identical. When i add a stylesheet with my app, should than be all sizes identical?
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Resolved High-DPI issue described in Post #6.

According Oracle JDK9 the High-DPI threshold changed to 125% on Windows.

Overriding the UI Scale to anothor value, is done by following command line argument:
B4X:
-Dglass.win.uiScale=<scale spec>
<scale spec> = [NNN%] | [NNNdpi] | [N.NNNN]
Example setting UI scale in the project attributes to 100%:
B4X:
#VirtualMachineArgs: -Dglass.win.uiScale=100%
with output:
upload_2017-9-26_10-41-57.png
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Whilst progressing with the CustomViews Library jRLViews (see attached) received a warning message when compiling the SliderX example (in folder examples/sliderx).

This comes after installing JDK9 and this kind of warning is documented by Oracle with the advice to report to the maintainers of a class to be aware for future releases - see below.

B4X:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by anywheresoftware.b4j.object.JavaObject (file:/C:/Daten/b4/b4j/opensource/jRLViews/Examples/SliderX/Objects/SliderEx.jar) to method com.sun.javafx.collections.VetoableListDecorator.add(java.lang.Object)
WARNING: Please consider reporting this to the maintainers of anywheresoftware.b4j.object.JavaObject
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
 

Attachments

  • jRLViews-050.zip
    206.8 KB · Views: 272
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
This comes after installing JDK9 and this kind of warning is documented by Oracle with the advice to report to the maintainers of a class to be aware for future releases - see below.
I get the same message for another library:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.PlatformDependent0 (file:/C:/dir/Master.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.PlatformDependent0
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
 
Upvote 0
Top