CLDC 8

Adherence to the Java Language Specification

The general goal of CLDC 8 is to support all of the features of the The Java® Language Specification, Java SE 8 Edition as is feasible within the strict memory limits of CLDC target devices. Due to the restrictions of the CLDC Virtual Machine as defined in [Adherence to The Java Virtual Machine Specification] there are certain language features in The Java® Language Specification, Java SE 8 Edition that can not be used for CLDC.

This chapter summarizes these restrictions on features of The Java® Language Specification, Java SE 8 Edition.

Java sources conforming to JLS can be used to create class files that can be run on CLDC 8 as long as they:

These language features are discussed in more detail below.

No Finalization of Class Instances

A Virtual Machine conforming to CLDC does not support finalization of class instances (JLS8 §12.6). No application built to conform to the Connected Limited Device Configuration shall require that finalization is available.

Finalization as an approach to cleanup resources has been deprecated due to its fragile nature and non-deterministic behavior in multi-threaded concurrency.

Thread Groups and Daemon Threads

A Virtual Machine conforming to CLDC provides multithreading (JLS8 §17), but does not have support for thread groups or daemon threads. Thread operations such as starting of threads can be applied only to individual thread objects. If application programmers want to perform thread operations for groups of threads, explicit collection objects must be used at the application level to store the thread objects.

Exception and Error Classes

A Virtual Machine conforming to CLDC shall generally support exception handling as defined in JLS8 Chapter 11, with the exception that asynchronous exceptions (JLS8 §11.1.3) are not supported. Consequently, a fairly comprehensive set of exception classes has been included.

In contrast, the set of error classes included in the CLDC libraries is limited, and consequently the error handling capabilities of CLDC are considerably more limited. By default, a Virtual Machine conforming to CLDC supports only a very limited set of error classes from java.lang as defined in the API Javadoc.

When encountering any other error, the Virtual Machine throws an Error that is the nearest CLDC-supported superclass of the Error class that must be thrown according to The Java® Language Specification, Java SE 8 Edition

If the Virtual Machine conforming to CLDC implements additional error checks that are part of The Java® Language Specification, Java SE 8 Edition but that are not required by the CLDC Specification, the implementation shall throw the nearest CLDC-supported superclass of the Error class that is defined by The Java® Language Specification, Java SE 8 Edition.

Lambda Expressions

CLDC does not support Lambda Expressions (JLS8 §15.27).

Static or Default Methods on Interfaces

CLDC does not support static or default methods on interfaces (JLS8 §9.4).

CLDC 8

Copyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.