Recently I've got to know that there are annotations like compact1
, compact2
, compact3
for some classes, in Java 8 API documentation.
Those seem to be called profile, as you can see on the overview page. (See the below images.) The profile, compact1, compact2, compact3 are not appear in Java 6 or 7 API documentation.
What do they mean in Java 8 API doc?
A compact profile (or simply profile) is a subset of the full Java SE Platform API. Because they have smaller storage footprints, profiles can enable many Java applications to run on resource-constrained devices.
A compact profile is a subset of the full Java SE Platform API. Because they have a smaller storage footprint, compact profiles can enable many Java applications to run on resource-constrained devices.
Compact profiles are subsets of the full Java platform APIs, to allow running with a smaller JRE. Many programs (especially in embedded environments) don't need libraries like Swing or CORBA -- they're just wasted space. From the Oracle Java SE Embedded 8 Compact Profiles Overview:
A compact profile is a subset of the full Java SE Platform API. Because they have a smaller storage footprint, compact profiles can enable many Java applications to run on resource-constrained devices. Choosing a compact profile that closely matches an application's functional needs minimizes the storage devoted to unused functions. There are new embedded developer tools in Java SE Embedded 8 including jrecreate and jdeps, which allow a developer to customize the Compact Profile runtime environment for a platform, and to find the Compact Profile dependencies for analysis during platform development.
Compact profiles address API choices only; they are unrelated to the Java virtual machine, the language proper, or tools. So, care must be taken to match the Java virtual machine supported functionality with the API support needed.
That page also lists the contents of each profile. The currently defined profiles all have a subset relationship (compact2 includes compact1, compact 3 includes compact2).
Use the -profile
option to javac
to compile against a profile. javac
will complain if the source uses an API not available in the profile, like in this example from the javac doc:
./javac -profile compact1 Paint.java Paint.java:5: error: Applet is not available in profile 'compact1' import java.applet.Applet;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With