Does anyone else know what this means?

static final boolean $assertionsDisabled = !java/util/TaskQueue.desiredAssertionStatus();

which was seen in the source file java.util.TaskQueue.java

+3
source share
3 answers

Quotation 6.2.1 Overhead of confirmation :

It is helpful to understand how the approval mechanism works to see how approval statements can affect performance. When the compiler finds a statement in the class, it adds the generated static final field with the name to the class $assertionsDisabled. The field remains unassigned (this is a legitimate bytecode). The statement itself comes down to the wording of the form:

if ($assertionsDisabled)
  if (!boolean_expression)
    throw new AssertionError(String_expression);
+11
source

java- , $, _ , , $ _ $assertionsDisabled, java boolean.

java/util/TaskQueue.desiredAssertionStatus() . , java.util.TaskQueue.desiredAssertionStatus(). desiredAssertionStatus() TaskQueue.

. ! .

, ? (/ .), , java- "" . ?

java.util.TaskQueue.java. . , , . , IDE, , ?

+3

This is because this class has a statement, then the compiler creates this variable for itself.

+1
source

All Articles