Java_Magazine_NovemberDecember_2018

(singke) #1

61


//java future/


would effectively represent the points as an array of struct
without risking the full dangers of low-level memory control.
However, while the initial aims of value types seem clear,
the feature has some far-reaching consequences. For Project
Valhalla to be successful, it must consider the logical conclu-
sions of introducing a third form of value. In particular, a need
arises to revisit the subject of generic types.
If Java is to include value types, the question naturally
occurs whether value types can be used in generic types—for
example, as the value for a type parameter. The high-level
design of value types has always assumed that they will be
valid as values of type parameters in a new, enhanced form
of generics.
This is a large and complex question that is not completely
answered by the current stage of the project. Instead, Oracle has
produced a very early preview as the current prototype, which
is referred to as LWorld 1 (or just LW1). It replaces the earlier
Minimal Value Types (MVT) prototype.
The current LW1 prototype is functional, but it is still at a
very, very early stage. Its target audience is advanced develop-
ers, library authors, and toolmakers.
In my next article, I will explore LW1 and its successor, LW2.
I will analyze the bytecode it currently generates and how it
might benefit upcoming releases of Java and the JVM. </article>

Ben Evans (@kittylyst) is a Java Champion, a tech fellow and founder at
jClarity, an organizer for the London Java Community (LJC), and a mem-
ber of the Java SE/EE Executive Committee. He has written four books
on programming, including the recent Optimizing Java (O’Reilly).

//java proposals of interest/


JEP 343, first written up in April 2018, proposes to
develop a simple packaging tool for Java apps. Rather
than just stopping at existing packaging norms (JAR,
WAR, and EAR), this proposal seeks to define a tool that
creates an executable containing the runtime environ-
ment and the app as a single file: an .msi or .exe file on
Microsoft Windows, a pkg or app file on macOS, and deb
or rpm on Linux.
In this sense, JEP 343 aims to duplicate the ability of
existing packaging tools, such as Inno Setup and Wix.
Interest in this topic is driven by two trends: the
greater use of containers, in which an entire app bundled
with the necessary runtime is a desirable deployment
option, and the advent of Java modules as of Java 9. With
modules and the jlink tool, it’s fairly straightforward to
identify the modules in the JRE needed to run the app—
leading to skinny deployables and executables.
The proposed solution, called jpackager, might
include some discussed options such as generating exe-
cutables that will meet the criteria for release through
Windows and macOS app stores. Also under consider-
ation is a similar solution that could launch multiple
applications simultaneously in the same container or on
the same platform.
If you’ve ever had to step users through the process
of downloading and installing a JRE so that they could
run your app, you understand how welcome a turnkey
solution such as the proposed tool would be.

JEP 343: Packaging Tool for
Self-Contained Java Apps
Free download pdf