alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (ValueTest.java)

This example Java source code file (ValueTest.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

string, valuetest

The ValueTest.java Java example source code

/*
 * @test /nodynamiccopyright/
 * @bug 8025272
 * @summary doclint needs to check for valid usage of at-value tag
 * @build DocLintTester
 * @run main DocLintTester -ref ValueTest.out ValueTest.java
 */

/** */
public class ValueTest {
    /*
     * Tests for {@value} without a reference
     */

    /** valid: {@value} */
    public static final boolean cBoolean = false;

    /** valid: {@value} */
    public static final byte cByte = 0;

    /** valid: {@value} */
    public static final short cShort = 0;

    /** valid: {@value} */
    public static final int cInt = 0;

    /** valid: {@value} */
    public static final long cLong = 0L;

    /** valid: {@value} */
    public static final float cFloat = 0.0f;

    /** valid: {@value} */
    public static final double cDouble = 0.0;

    /** valid: {@value} */
    public static final String cString = "";

    /** invalid class C: {@value} */
    public class C { }

    /** invalid enum E: {@value} */
    public enum E {
        /** invalid enum constant E1: {@value} */
        E1
    }

    /** invalid field 1: {@value} */
    public int f1;

    /** invalid field 2: {@value} */
    public int f2 = 3;


    /*
     * Tests for {@value} with a reference
     */

    /** valid: {@value Integer#SIZE} */
    public int intRef;

    /** invalid method: {@value Object#toString} */
    public int badMethod;

    /** invalid enum constant: {@value Thread.State#NEW} */
    public int badEnum;
}

Other Java examples (source code examples)

Here is a short list of links related to this Java ValueTest.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.